react-window 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.js +34 -34
- package/dist/react-window.js.map +1 -1
- package/docs/assets/AriaRolesRoute-B8u4KZlN.js +2 -0
- package/docs/assets/AriaRolesRoute-B8u4KZlN.js.map +1 -0
- package/docs/assets/AriaRolesRoute-DrA2Z2g2.js +2 -0
- package/docs/assets/AriaRolesRoute-DrA2Z2g2.js.map +1 -0
- package/docs/assets/AriaRolesRoute-YProrOKU.js +2 -0
- package/docs/assets/AriaRolesRoute-YProrOKU.js.map +1 -0
- package/docs/assets/CellComponent.example-ChzwGLAD.js +2 -0
- package/docs/assets/{CellComponent.example-Cmj5vj6U.js.map → CellComponent.example-ChzwGLAD.js.map} +1 -1
- package/docs/assets/Code-BJ6U_DpT.js +2 -0
- package/docs/assets/Code-BJ6U_DpT.js.map +1 -0
- package/docs/assets/{ComponentProps-5QEdrETn.js → ComponentProps-0JkeHmLq.js} +2 -2
- package/docs/assets/{ComponentProps-5QEdrETn.js.map → ComponentProps-0JkeHmLq.js.map} +1 -1
- package/docs/assets/ContinueLink-Mq4XOwMu.js +2 -0
- package/docs/assets/{ContinueLink-jysYO6ZF.js.map → ContinueLink-Mq4XOwMu.js.map} +1 -1
- package/docs/assets/FixedRowHeightsRoute-DXFNDmnz.js +2 -0
- package/docs/assets/FixedRowHeightsRoute-DXFNDmnz.js.map +1 -0
- package/docs/assets/GettingStartedRoute-D-bI_IZb.js +2 -0
- package/docs/assets/GettingStartedRoute-D-bI_IZb.js.map +1 -0
- package/docs/assets/{Grid-vld19V9I.js → Grid-Cio8auWD.js} +2 -2
- package/docs/assets/Grid-Cio8auWD.js.map +1 -0
- package/docs/assets/{Header-CDZFHeTb.js → Header-DM8OHOd_.js} +2 -2
- package/docs/assets/{Header-CDZFHeTb.js.map → Header-DM8OHOd_.js.map} +1 -1
- package/docs/assets/HorizontalListsRoute-Dk2qJcyq.js +2 -0
- package/docs/assets/HorizontalListsRoute-Dk2qJcyq.js.map +1 -0
- package/docs/assets/ImperativeApiRoute-BdK7xl-u.js +2 -0
- package/docs/assets/ImperativeApiRoute-BdK7xl-u.js.map +1 -0
- package/docs/assets/ImperativeApiRoute-DdlTcZ7C.js +2 -0
- package/docs/assets/ImperativeApiRoute-DdlTcZ7C.js.map +1 -0
- package/docs/assets/{List-BgVuV26Q.js → List-B9HC1vRM.js} +2 -2
- package/docs/assets/{List-BgVuV26Q.js.map → List-B9HC1vRM.js.map} +1 -1
- package/docs/assets/{LoadingSpinner-C-xNF7A_.js → LoadingSpinner-CcA45RYo.js} +2 -2
- package/docs/assets/{LoadingSpinner-C-xNF7A_.js.map → LoadingSpinner-CcA45RYo.js.map} +1 -1
- package/docs/assets/{PageNotFound-iBStRMG4.js → PageNotFound-BaiFbANH.js} +2 -2
- package/docs/assets/{PageNotFound-iBStRMG4.js.map → PageNotFound-BaiFbANH.js.map} +1 -1
- package/docs/assets/{PlatformRequirementsRoute-DSVwe6jK.js → PlatformRequirementsRoute-BfE0JkzC.js} +2 -2
- package/docs/assets/{PlatformRequirementsRoute-DSVwe6jK.js.map → PlatformRequirementsRoute-BfE0JkzC.js.map} +1 -1
- package/docs/assets/{PropsRoute-BMJ0qMWy.js → PropsRoute-B2tWvN5Y.js} +2 -2
- package/docs/assets/{PropsRoute-BMJ0qMWy.js.map → PropsRoute-B2tWvN5Y.js.map} +1 -1
- package/docs/assets/{PropsRoute-WR0UoUn8.js → PropsRoute-E2EuXhKK.js} +2 -2
- package/docs/assets/{PropsRoute-WR0UoUn8.js.map → PropsRoute-E2EuXhKK.js.map} +1 -1
- package/docs/assets/RTLGridsRoute-BiJ_ARQb.js +2 -0
- package/docs/assets/RTLGridsRoute-BiJ_ARQb.js.map +1 -0
- package/docs/assets/RenderingGridRoute-BvlK0VIG.js +2 -0
- package/docs/assets/RenderingGridRoute-BvlK0VIG.js.map +1 -0
- package/docs/assets/ScratchpadRoute-wzxynGR2.js +2 -0
- package/docs/assets/{ScratchpadRoute-C2jx35Bk.js.map → ScratchpadRoute-wzxynGR2.js.map} +1 -1
- package/docs/assets/{Select-CEO0pd8j.js → Select-BtAY4kA-.js} +2 -2
- package/docs/assets/{Select-CEO0pd8j.js.map → Select-BtAY4kA-.js.map} +1 -1
- package/docs/assets/StickyRowsRoute-DUIWoMJJ.js +2 -0
- package/docs/assets/StickyRowsRoute-DUIWoMJJ.js.map +1 -0
- package/docs/assets/{SupportRoute-BneNHh_g.js → SupportRoute-DO1SyQwL.js} +2 -2
- package/docs/assets/{SupportRoute-BneNHh_g.js.map → SupportRoute-DO1SyQwL.js.map} +1 -1
- package/docs/assets/TabularDataRoute-DMwDahmo.js +2 -0
- package/docs/assets/TabularDataRoute-DMwDahmo.js.map +1 -0
- package/docs/assets/VariableRowHeightsRoute-B9mccfzh.js +2 -0
- package/docs/assets/VariableRowHeightsRoute-B9mccfzh.js.map +1 -0
- package/docs/assets/{arePropsEqual-Bd1V-lj7.js → arePropsEqual-MBk0PiJi.js} +2 -2
- package/docs/assets/{arePropsEqual-Bd1V-lj7.js.map → arePropsEqual-MBk0PiJi.js.map} +1 -1
- package/docs/assets/{index-1kZ13GgQ.js → index-3R9tv3eW.js} +3 -3
- package/docs/assets/{index-1kZ13GgQ.js.map → index-3R9tv3eW.js.map} +1 -1
- package/docs/assets/index-DbmHyJV-.css +1 -0
- package/docs/assets/{useCitiesByState-CRl37uUx.js → useCitiesByState-DlHLfAIQ.js} +2 -2
- package/docs/assets/{useCitiesByState-CRl37uUx.js.map → useCitiesByState-DlHLfAIQ.js.map} +1 -1
- package/docs/assets/{useContacts-CGODVxAU.js → useContacts-C-Fuwn4U.js} +2 -2
- package/docs/assets/{useContacts-CGODVxAU.js.map → useContacts-C-Fuwn4U.js.map} +1 -1
- package/docs/generated/code-snippets/CellComponent.json +1 -2
- package/docs/generated/code-snippets/CellComponentAriaRoles.json +1 -2
- package/docs/generated/code-snippets/FixedHeightList.json +1 -2
- package/docs/generated/code-snippets/FixedHeightRowComponent.json +1 -2
- package/docs/generated/code-snippets/FlexboxLayout.json +1 -2
- package/docs/generated/code-snippets/Grid.json +1 -2
- package/docs/generated/code-snippets/HorizontalList.json +1 -2
- package/docs/generated/code-snippets/HorizontalListCellRenderer.json +1 -2
- package/docs/generated/code-snippets/ListVariableRowHeights.json +1 -2
- package/docs/generated/code-snippets/ListWithStickyRows.json +1 -2
- package/docs/generated/code-snippets/RowComponentAriaRoles.json +1 -2
- package/docs/generated/code-snippets/RtlGrid.json +1 -2
- package/docs/generated/code-snippets/TableAriaOverrideProps.json +1 -2
- package/docs/generated/code-snippets/columnWidth.json +1 -2
- package/docs/generated/code-snippets/gridRefClickEventHandler.json +1 -2
- package/docs/generated/code-snippets/listRefClickEventHandler.json +1 -2
- package/docs/generated/code-snippets/rowHeight.json +1 -2
- package/docs/generated/code-snippets/useGridCallbackRef.json +1 -2
- package/docs/generated/code-snippets/useGridRef.json +1 -2
- package/docs/generated/code-snippets/useGridRefImport.json +1 -1
- package/docs/generated/code-snippets/useListCallbackRef.json +1 -2
- package/docs/generated/code-snippets/useListRef.json +1 -2
- package/docs/generated/code-snippets/useListRefImport.json +1 -1
- package/docs/index.html +6 -3
- package/docs/stats.html +1 -1
- package/package.json +4 -3
- package/docs/assets/AriaRolesRoute-Bp1v1tTi.js +0 -2
- package/docs/assets/AriaRolesRoute-Bp1v1tTi.js.map +0 -1
- package/docs/assets/AriaRolesRoute-CH6BGZED.js +0 -2
- package/docs/assets/AriaRolesRoute-CH6BGZED.js.map +0 -1
- package/docs/assets/AriaRolesRoute-DtxQ1Zyb.js +0 -2
- package/docs/assets/AriaRolesRoute-DtxQ1Zyb.js.map +0 -1
- package/docs/assets/CellComponent.example-Cmj5vj6U.js +0 -2
- package/docs/assets/ContinueLink-jysYO6ZF.js +0 -2
- package/docs/assets/FixedHeightList-HNBwl6P8.js +0 -2
- package/docs/assets/FixedHeightList-HNBwl6P8.js.map +0 -1
- package/docs/assets/FixedRowHeightsRoute-DX-Q4QkL.js +0 -2
- package/docs/assets/FixedRowHeightsRoute-DX-Q4QkL.js.map +0 -1
- package/docs/assets/FormattedCode-DJTpo7zC.js +0 -2
- package/docs/assets/FormattedCode-DJTpo7zC.js.map +0 -1
- package/docs/assets/GettingStartedRoute-ImtHIz0x.js +0 -2
- package/docs/assets/GettingStartedRoute-ImtHIz0x.js.map +0 -1
- package/docs/assets/Grid-vld19V9I.js.map +0 -1
- package/docs/assets/HorizontalListsRoute-NkWYfLJB.js +0 -2
- package/docs/assets/HorizontalListsRoute-NkWYfLJB.js.map +0 -1
- package/docs/assets/ImperativeApiRoute-DcSRabeU.js +0 -2
- package/docs/assets/ImperativeApiRoute-DcSRabeU.js.map +0 -1
- package/docs/assets/ImperativeApiRoute-UKz530Oz.js +0 -2
- package/docs/assets/ImperativeApiRoute-UKz530Oz.js.map +0 -1
- package/docs/assets/RTLGridsRoute-BQloHP6R.js +0 -2
- package/docs/assets/RTLGridsRoute-BQloHP6R.js.map +0 -1
- package/docs/assets/RenderingGridRoute-Dk1bImcY.js +0 -2
- package/docs/assets/RenderingGridRoute-Dk1bImcY.js.map +0 -1
- package/docs/assets/ScratchpadRoute-C2jx35Bk.js +0 -2
- package/docs/assets/StickyRowsRoute-uenoNibk.js +0 -2
- package/docs/assets/StickyRowsRoute-uenoNibk.js.map +0 -1
- package/docs/assets/TabularDataRoute-626oaEdE.js +0 -2
- package/docs/assets/TabularDataRoute-626oaEdE.js.map +0 -1
- package/docs/assets/VariableRowHeightsRoute-DYGtG5ua.js +0 -2
- package/docs/assets/VariableRowHeightsRoute-DYGtG5ua.js.map +0 -1
- package/docs/assets/index-CTUnf-2d.css +0 -1
- /package/docs/assets/{FormattedCode-nwWF-WcI.css → Code-nwWF-WcI.css} +0 -0
package/dist/react-window.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react/jsx-runtime"),i=require("react");function ie(e){let t=e;for(;t;){if(t.dir)return t.dir==="rtl";t=t.parentElement}return!1}function le(e,t){const[s,r]=i.useState(t==="rtl");return i.useLayoutEffect(()=>{e&&(t||r(ie(e)))},[t,e]),s}const P=typeof window<"u"?i.useLayoutEffect:i.useEffect;function Z(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}function ce({box:e,defaultHeight:t,defaultWidth:s,disabled:r,element:n,mode:o,style:c}){const{styleHeight:a,styleWidth:l}=i.useMemo(()=>({styleHeight:Z(c?.height),styleWidth:Z(c?.width)}),[c?.height,c?.width]),[u,f]=i.useState({height:t,width:s}),p=r||o==="only-height"&&a!==void 0||o==="only-width"&&l!==void 0||a!==void 0&&l!==void 0;return P(()=>{if(n===null||p)return;const V=new ResizeObserver(O=>{for(const k of O){const{contentRect:y,target:v}=k;n===v&&f(m=>m.height===y.height&&m.width===y.width?m:{height:y.height,width:y.width})}});return V.observe(n,{box:e}),()=>{V?.unobserve(n)}},[e,p,n,a,l]),i.useMemo(()=>({height:a??u.height,width:l??u.width}),[u,a,l])}function ae(e){const t=i.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return P(()=>{t.current=e},[e]),i.useCallback(s=>t.current?.(s),[t])}let H=null;function fe(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 r=document.createElement("div"),n=r.style;return n.width="100px",n.height="100px",t.appendChild(r),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 N({containerElement:e,direction:t,isRtl:s,scrollOffset:r}){if(t==="horizontal"&&s)switch(fe()){case"negative":return-r;case"positive-descending":{if(e){const{clientWidth:n,scrollLeft:o,scrollWidth:c}=e;return c-n-o}break}}return r}function G(e,t="Assertion error"){if(!e)throw console.error(t),Error(t)}function U(e,t){if(e===t)return!0;if(!!e!=!!t||(G(e!==void 0),G(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 ee({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);G(r!==void 0,"Unexpected bounds cache miss");const n=(r.scrollOffset+r.size)/e.size;return t*n}}function de({align:e,cachedBounds:t,index:s,itemCount:r,itemSize:n,containerScrollOffset:o,containerSize:c}){const a=ee({cachedBounds:t,itemCount:r,itemSize:n}),l=t.get(s),u=Math.max(0,Math.min(a-c,l.scrollOffset)),f=Math.max(0,l.scrollOffset-c+l.size);switch(e==="smart"&&(o>=f&&o<=u?e="auto":e="center"),e){case"start":return u;case"end":return f;case"center":return l.scrollOffset<=c/2?0:l.scrollOffset+l.size/2>=a-c/2?a-c:l.scrollOffset+l.size/2-c/2;case"auto":default:return o>=f&&o<=u?o:o<f?f:u}}function _({cachedBounds:e,containerScrollOffset:t,containerSize:s,itemCount:r,overscanCount:n}){const o=r-1;let c=0,a=-1,l=0,u=-1,f=0;for(;f<o;){const p=e.get(f);if(p.scrollOffset+p.size>t)break;f++}for(c=f,l=Math.max(0,c-n);f<o;){const p=e.get(f);if(p.scrollOffset+p.size>=t+s)break;f++}return a=Math.min(o,f),u=Math.min(r-1,a+n),c<0&&(c=0,a=-1,l=0,u=-1),{startIndexVisible:c,stopIndexVisible:a,startIndexOverscan:l,stopIndexOverscan:u}}function ue({itemCount:e,itemProps:t,itemSize:s}){const r=new Map;return{get(n){for(G(n<e,`Invalid index ${n}`);r.size-1<n;){const c=r.size;let a;switch(typeof s){case"function":{a=s(c,t);break}case"number":{a=s;break}}if(c===0)r.set(c,{size:a,scrollOffset:0});else{const l=r.get(c-1);G(l!==void 0,`Unexpected bounds cache miss for index ${n}`),r.set(c,{scrollOffset:l.scrollOffset+l.size,size:a})}}const o=r.get(n);return G(o!==void 0,`Unexpected bounds cache miss for index ${n}`),o},set(n,o){r.set(n,o)},get size(){return r.size}}}function he({itemCount:e,itemProps:t,itemSize:s}){return i.useMemo(()=>ue({itemCount:e,itemProps:t,itemSize:s}),[e,t,s])}function xe({containerSize:e,itemSize:t}){let s;switch(typeof t){case"string":{G(t.endsWith("%"),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),G(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 K({containerElement:e,containerStyle:t,defaultContainerSize:s=0,direction:r,isRtl:n=!1,itemCount:o,itemProps:c,itemSize:a,onResize:l,overscanCount:u}){const[f,p]=i.useState({startIndexVisible:0,startIndexOverscan:0,stopIndexVisible:-1,stopIndexOverscan:-1}),{startIndexVisible:V,startIndexOverscan:O,stopIndexVisible:k,stopIndexOverscan:y}={startIndexVisible:Math.min(o-1,f.startIndexVisible),startIndexOverscan:Math.min(o-1,f.startIndexOverscan),stopIndexVisible:Math.min(o-1,f.stopIndexVisible),stopIndexOverscan:Math.min(o-1,f.stopIndexOverscan)},{height:v=s,width:m=s}=ce({defaultHeight:r==="vertical"?s:void 0,defaultWidth:r==="horizontal"?s:void 0,element:e,mode:r==="vertical"?"only-height":"only-width",style:t}),L=i.useRef({height:0,width:0}),S=r==="vertical"?v:m,d=xe({containerSize:S,itemSize:a});i.useLayoutEffect(()=>{if(typeof l=="function"){const h=L.current;(h.height!==v||h.width!==m)&&(l({height:v,width:m},{...h}),h.height=v,h.width=m)}},[v,l,m]);const g=he({itemCount:o,itemProps:c,itemSize:d}),z=i.useCallback(h=>g.get(h),[g]),T=i.useCallback(()=>ee({cachedBounds:g,itemCount:o,itemSize:d}),[g,o,d]),R=i.useCallback(h=>{const I=N({containerElement:e,direction:r,isRtl:n,scrollOffset:h});return _({cachedBounds:g,containerScrollOffset:I,containerSize:S,itemCount:o,overscanCount:u})},[g,e,S,r,n,o,u]);P(()=>{const h=(r==="vertical"?e?.scrollTop:e?.scrollLeft)??0;p(R(h))},[e,r,R]),P(()=>{if(!e)return;const h=()=>{p(I=>{const{scrollLeft:x,scrollTop:b}=e,M=N({containerElement:e,direction:r,isRtl:n,scrollOffset:r==="vertical"?b:x}),D=_({cachedBounds:g,containerScrollOffset:M,containerSize:S,itemCount:o,overscanCount:u});return U(D,I)?I:D})};return e.addEventListener("scroll",h),()=>{e.removeEventListener("scroll",h)}},[g,e,S,r,o,u]);const E=ae(({align:h="auto",containerScrollOffset:I,index:x})=>{let b=de({align:h,cachedBounds:g,containerScrollOffset:I,containerSize:S,index:x,itemCount:o,itemSize:d});if(e){if(b=N({containerElement:e,direction:r,isRtl:n,scrollOffset:b}),typeof e.scrollTo!="function"){const M=R(b);U(f,M)||p(M)}return b}});return{getCellBounds:z,getEstimatedSize:T,scrollToIndex:E,startIndexOverscan:O,startIndexVisible:V,stopIndexOverscan:y,stopIndexVisible:k}}function te(e){return i.useMemo(()=>e,Object.values(e))}function se(e,t){const{ariaAttributes:s,style:r,...n}=e,{ariaAttributes:o,style:c,...a}=t;return U(s,o)&&U(r,c)&&U(n,a)}function pe({cellComponent:e,cellProps:t,children:s,className:r,columnCount:n,columnWidth:o,defaultHeight:c=0,defaultWidth:a=0,dir:l,gridRef:u,onCellsRendered:f,onResize:p,overscanCount:V=3,rowCount:O,rowHeight:k,style:y,tagName:v="div",...m}){const L=te(t),S=i.useMemo(()=>i.memo(e,se),[e]),[d,g]=i.useState(null),z=le(d,l),{getCellBounds:T,getEstimatedSize:R,startIndexOverscan:E,startIndexVisible:h,scrollToIndex:I,stopIndexOverscan:x,stopIndexVisible:b}=K({containerElement:d,defaultContainerSize:a,direction:"horizontal",isRtl:z,itemCount:n,itemProps:L,itemSize:o,onResize:p,overscanCount:V}),{getCellBounds:M,getEstimatedSize:D,startIndexOverscan:B,startIndexVisible:Q,scrollToIndex:Y,stopIndexOverscan:q,stopIndexVisible:X}=K({containerElement:d,defaultContainerSize:c,direction:"vertical",itemCount:O,itemProps:L,itemSize:k,onResize:p,overscanCount:V});i.useImperativeHandle(u,()=>({get element(){return d},scrollToCell({behavior:W="auto",columnAlign:w="auto",columnIndex:j,rowAlign:A="auto",rowIndex:$}){const F=I({align:w,containerScrollOffset:d?.scrollLeft??0,index:j}),ne=Y({align:A,containerScrollOffset:d?.scrollTop??0,index:$});typeof d?.scrollTo=="function"&&d.scrollTo({behavior:W,left:F,top:ne})},scrollToColumn({align:W="auto",behavior:w="auto",index:j}){const A=I({align:W,containerScrollOffset:d?.scrollLeft??0,index:j});typeof d?.scrollTo=="function"&&d.scrollTo({behavior:w,left:A})},scrollToRow({align:W="auto",behavior:w="auto",index:j}){const A=Y({align:W,containerScrollOffset:d?.scrollTop??0,index:j});typeof d?.scrollTo=="function"&&d.scrollTo({behavior:w,top:A})}}),[d,I,Y]),i.useEffect(()=>{E>=0&&x>=0&&B>=0&&q>=0&&f&&f({columnStartIndex:h,columnStopIndex:b,rowStartIndex:Q,rowStopIndex:X},{columnStartIndex:E,columnStopIndex:x,rowStartIndex:B,rowStopIndex:q})},[f,E,h,x,b,B,Q,q,X]);const re=i.useMemo(()=>{const W=[];if(n>0&&O>0)for(let w=B;w<=q;w++){const j=M(w),A=[];for(let $=E;$<=x;$++){const F=T($);A.push(i.createElement(S,{...L,ariaAttributes:{"aria-colindex":$+1,role:"gridcell"},columnIndex:$,key:$,rowIndex:w,style:{position:"absolute",left:z?void 0:0,right:z?0:void 0,transform:`translate(${z?-F.scrollOffset:F.scrollOffset}px, ${j.scrollOffset}px)`,height:O>1?j.size:"100%",width:F.size}}))}W.push(J.jsx("div",{role:"row","aria-rowindex":w+1,children:A},w))}return W},[S,L,n,E,x,T,M,z,O,B,q]),oe=J.jsx("div",{"aria-hidden":!0,style:{height:D(),width:R(),zIndex:-1}});return i.createElement(v,{"aria-colcount":n,"aria-rowcount":O,role:"grid",...m,className:r,dir:l,ref:g,style:{position:"relative",width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y}},re,s,oe)}const ge=i.useState,ve=i.useRef;function Ie({children:e,className:t,defaultHeight:s=0,listRef:r,onResize:n,onRowsRendered:o,overscanCount:c=3,rowComponent:a,rowCount:l,rowHeight:u,rowProps:f,tagName:p="div",style:V,...O}){const k=te(f),y=i.useMemo(()=>i.memo(a,se),[a]),[v,m]=i.useState(null),{getCellBounds:L,getEstimatedSize:S,scrollToIndex:d,startIndexOverscan:g,startIndexVisible:z,stopIndexOverscan:T,stopIndexVisible:R}=K({containerElement:v,defaultContainerSize:s,direction:"vertical",itemCount:l,itemProps:k,itemSize:u,onResize:n,overscanCount:c});i.useImperativeHandle(r,()=>({get element(){return v},scrollToRow({align:I="auto",behavior:x="auto",index:b}){const M=d({align:I,containerScrollOffset:v?.scrollTop??0,index:b});typeof v?.scrollTo=="function"&&v.scrollTo({behavior:x,top:M})}}),[v,d]),i.useEffect(()=>{g>=0&&T>=0&&o&&o({startIndex:z,stopIndex:R},{startIndex:g,stopIndex:T})},[o,g,z,T,R]);const E=i.useMemo(()=>{const I=[];if(l>0)for(let x=g;x<=T;x++){const b=L(x);I.push(i.createElement(y,{...k,ariaAttributes:{"aria-posinset":x+1,"aria-setsize":l,role:"listitem"},key:x,index:x,style:{position:"absolute",left:0,transform:`translateY(${b.scrollOffset}px)`,height:b.size,width:"100%"}}))}return I},[y,L,l,k,g,T]),h=J.jsx("div",{"aria-hidden":!0,style:{height:S(),width:"100%",zIndex:-1}});return i.createElement(p,{role:"list",...O,className:t,ref:m,style:{position:"relative",maxHeight:"100%",flexGrow:1,overflowY:"auto",...V}},E,e,h)}const be=i.useState,me=i.useRef;let C=-1;function we(e=!1){if(C===-1||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",document.body.appendChild(t),C=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return C}exports.Grid=pe;exports.List=Ie;exports.getScrollbarSize=we;exports.useGridCallbackRef=ge;exports.useGridRef=ve;exports.useListCallbackRef=be;exports.useListRef=me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react/jsx-runtime"),i=require("react");function ie(e){let t=e;for(;t;){if(t.dir)return t.dir==="rtl";t=t.parentElement}return!1}function le(e,t){const[s,r]=i.useState(t==="rtl");return i.useLayoutEffect(()=>{e&&(t||r(ie(e)))},[t,e]),s}const P=typeof window<"u"?i.useLayoutEffect:i.useEffect;function Z(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}function ce({box:e,defaultHeight:t,defaultWidth:s,disabled:r,element:n,mode:o,style:c}){const{styleHeight:a,styleWidth:l}=i.useMemo(()=>({styleHeight:Z(c?.height),styleWidth:Z(c?.width)}),[c?.height,c?.width]),[d,f]=i.useState({height:t,width:s}),p=r||o==="only-height"&&a!==void 0||o==="only-width"&&l!==void 0||a!==void 0&&l!==void 0;return P(()=>{if(n===null||p)return;const V=new ResizeObserver(S=>{for(const k of S){const{contentRect:O,target:v}=k;n===v&&f(m=>m.height===O.height&&m.width===O.width?m:{height:O.height,width:O.width})}});return V.observe(n,{box:e}),()=>{V?.unobserve(n)}},[e,p,n,a,l]),i.useMemo(()=>({height:a??d.height,width:l??d.width}),[d,a,l])}function ae(e){const t=i.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return P(()=>{t.current=e},[e]),i.useCallback(s=>t.current?.(s),[t])}let H=null;function fe(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 r=document.createElement("div"),n=r.style;return n.width="100px",n.height="100px",t.appendChild(r),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 C({containerElement:e,direction:t,isRtl:s,scrollOffset:r}){if(t==="horizontal"&&s)switch(fe()){case"negative":return-r;case"positive-descending":{if(e){const{clientWidth:n,scrollLeft:o,scrollWidth:c}=e;return c-n-o}break}}return r}function G(e,t="Assertion error"){if(!e)throw console.error(t),Error(t)}function U(e,t){if(e===t)return!0;if(!!e!=!!t||(G(e!==void 0),G(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 ee({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);G(r!==void 0,"Unexpected bounds cache miss");const n=(r.scrollOffset+r.size)/e.size;return t*n}}function ue({align:e,cachedBounds:t,index:s,itemCount:r,itemSize:n,containerScrollOffset:o,containerSize:c}){const a=ee({cachedBounds:t,itemCount:r,itemSize:n}),l=t.get(s),d=Math.max(0,Math.min(a-c,l.scrollOffset)),f=Math.max(0,l.scrollOffset-c+l.size);switch(e==="smart"&&(o>=f&&o<=d?e="auto":e="center"),e){case"start":return d;case"end":return f;case"center":return l.scrollOffset<=c/2?0:l.scrollOffset+l.size/2>=a-c/2?a-c:l.scrollOffset+l.size/2-c/2;case"auto":default:return o>=f&&o<=d?o:o<f?f:d}}function _({cachedBounds:e,containerScrollOffset:t,containerSize:s,itemCount:r,overscanCount:n}){const o=r-1;let c=0,a=-1,l=0,d=-1,f=0;for(;f<o;){const p=e.get(f);if(p.scrollOffset+p.size>t)break;f++}for(c=f,l=Math.max(0,c-n);f<o;){const p=e.get(f);if(p.scrollOffset+p.size>=t+s)break;f++}return a=Math.min(o,f),d=Math.min(r-1,a+n),c<0&&(c=0,a=-1,l=0,d=-1),{startIndexVisible:c,stopIndexVisible:a,startIndexOverscan:l,stopIndexOverscan:d}}function de({itemCount:e,itemProps:t,itemSize:s}){const r=new Map;return{get(n){for(G(n<e,`Invalid index ${n}`);r.size-1<n;){const c=r.size;let a;switch(typeof s){case"function":{a=s(c,t);break}case"number":{a=s;break}}if(c===0)r.set(c,{size:a,scrollOffset:0});else{const l=r.get(c-1);G(l!==void 0,`Unexpected bounds cache miss for index ${n}`),r.set(c,{scrollOffset:l.scrollOffset+l.size,size:a})}}const o=r.get(n);return G(o!==void 0,`Unexpected bounds cache miss for index ${n}`),o},set(n,o){r.set(n,o)},get size(){return r.size}}}function he({itemCount:e,itemProps:t,itemSize:s}){return i.useMemo(()=>de({itemCount:e,itemProps:t,itemSize:s}),[e,t,s])}function xe({containerSize:e,itemSize:t}){let s;switch(typeof t){case"string":{G(t.endsWith("%"),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),G(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 K({containerElement:e,containerStyle:t,defaultContainerSize:s=0,direction:r,isRtl:n=!1,itemCount:o,itemProps:c,itemSize:a,onResize:l,overscanCount:d}){const[f,p]=i.useState({startIndexVisible:0,startIndexOverscan:0,stopIndexVisible:-1,stopIndexOverscan:-1}),{startIndexVisible:V,startIndexOverscan:S,stopIndexVisible:k,stopIndexOverscan:O}={startIndexVisible:Math.min(o-1,f.startIndexVisible),startIndexOverscan:Math.min(o-1,f.startIndexOverscan),stopIndexVisible:Math.min(o-1,f.stopIndexVisible),stopIndexOverscan:Math.min(o-1,f.stopIndexOverscan)},{height:v=s,width:m=s}=ce({defaultHeight:r==="vertical"?s:void 0,defaultWidth:r==="horizontal"?s:void 0,element:e,mode:r==="vertical"?"only-height":"only-width",style:t}),L=i.useRef({height:0,width:0}),y=r==="vertical"?v:m,u=xe({containerSize:y,itemSize:a});i.useLayoutEffect(()=>{if(typeof l=="function"){const h=L.current;(h.height!==v||h.width!==m)&&(l({height:v,width:m},{...h}),h.height=v,h.width=m)}},[v,l,m]);const g=he({itemCount:o,itemProps:c,itemSize:u}),z=i.useCallback(h=>g.get(h),[g]),T=i.useCallback(()=>ee({cachedBounds:g,itemCount:o,itemSize:u}),[g,o,u]),R=i.useCallback(h=>{const I=C({containerElement:e,direction:r,isRtl:n,scrollOffset:h});return _({cachedBounds:g,containerScrollOffset:I,containerSize:y,itemCount:o,overscanCount:d})},[g,e,y,r,n,o,d]);P(()=>{const h=(r==="vertical"?e?.scrollTop:e?.scrollLeft)??0;p(R(h))},[e,r,R]),P(()=>{if(!e)return;const h=()=>{p(I=>{const{scrollLeft:x,scrollTop:b}=e,M=C({containerElement:e,direction:r,isRtl:n,scrollOffset:r==="vertical"?b:x}),D=_({cachedBounds:g,containerScrollOffset:M,containerSize:y,itemCount:o,overscanCount:d});return U(D,I)?I:D})};return e.addEventListener("scroll",h),()=>{e.removeEventListener("scroll",h)}},[g,e,y,r,o,d]);const E=ae(({align:h="auto",containerScrollOffset:I,index:x})=>{let b=ue({align:h,cachedBounds:g,containerScrollOffset:I,containerSize:y,index:x,itemCount:o,itemSize:u});if(e){if(b=C({containerElement:e,direction:r,isRtl:n,scrollOffset:b}),typeof e.scrollTo!="function"){const M=R(b);U(f,M)||p(M)}return b}});return{getCellBounds:z,getEstimatedSize:T,scrollToIndex:E,startIndexOverscan:S,startIndexVisible:V,stopIndexOverscan:O,stopIndexVisible:k}}function te(e){return i.useMemo(()=>e,Object.values(e))}function se(e,t){const{ariaAttributes:s,style:r,...n}=e,{ariaAttributes:o,style:c,...a}=t;return U(s,o)&&U(r,c)&&U(n,a)}function pe({cellComponent:e,cellProps:t,children:s,className:r,columnCount:n,columnWidth:o,defaultHeight:c=0,defaultWidth:a=0,dir:l,gridRef:d,onCellsRendered:f,onResize:p,overscanCount:V=3,rowCount:S,rowHeight:k,style:O,tagName:v="div",...m}){const L=te(t),y=i.useMemo(()=>i.memo(e,se),[e]),[u,g]=i.useState(null),z=le(u,l),{getCellBounds:T,getEstimatedSize:R,startIndexOverscan:E,startIndexVisible:h,scrollToIndex:I,stopIndexOverscan:x,stopIndexVisible:b}=K({containerElement:u,defaultContainerSize:a,direction:"horizontal",isRtl:z,itemCount:n,itemProps:L,itemSize:o,onResize:p,overscanCount:V}),{getCellBounds:M,getEstimatedSize:D,startIndexOverscan:B,startIndexVisible:Q,scrollToIndex:Y,stopIndexOverscan:q,stopIndexVisible:X}=K({containerElement:u,defaultContainerSize:c,direction:"vertical",itemCount:S,itemProps:L,itemSize:k,onResize:p,overscanCount:V});i.useImperativeHandle(d,()=>({get element(){return u},scrollToCell({behavior:W="auto",columnAlign:w="auto",columnIndex:j,rowAlign:A="auto",rowIndex:$}){const F=I({align:w,containerScrollOffset:u?.scrollLeft??0,index:j}),ne=Y({align:A,containerScrollOffset:u?.scrollTop??0,index:$});typeof u?.scrollTo=="function"&&u.scrollTo({behavior:W,left:F,top:ne})},scrollToColumn({align:W="auto",behavior:w="auto",index:j}){const A=I({align:W,containerScrollOffset:u?.scrollLeft??0,index:j});typeof u?.scrollTo=="function"&&u.scrollTo({behavior:w,left:A})},scrollToRow({align:W="auto",behavior:w="auto",index:j}){const A=Y({align:W,containerScrollOffset:u?.scrollTop??0,index:j});typeof u?.scrollTo=="function"&&u.scrollTo({behavior:w,top:A})}}),[u,I,Y]),i.useEffect(()=>{E>=0&&x>=0&&B>=0&&q>=0&&f&&f({columnStartIndex:h,columnStopIndex:b,rowStartIndex:Q,rowStopIndex:X},{columnStartIndex:E,columnStopIndex:x,rowStartIndex:B,rowStopIndex:q})},[f,E,h,x,b,B,Q,q,X]);const re=i.useMemo(()=>{const W=[];if(n>0&&S>0)for(let w=B;w<=q;w++){const j=M(w),A=[];for(let $=E;$<=x;$++){const F=T($);A.push(i.createElement(y,{...L,ariaAttributes:{"aria-colindex":$+1,role:"gridcell"},columnIndex:$,key:$,rowIndex:w,style:{position:"absolute",left:z?void 0:0,right:z?0:void 0,transform:`translate(${z?-F.scrollOffset:F.scrollOffset}px, ${j.scrollOffset}px)`,height:j.size,width:F.size}}))}W.push(J.jsx("div",{role:"row","aria-rowindex":w+1,children:A},w))}return W},[y,L,n,E,x,T,M,z,S,B,q]),oe=J.jsx("div",{"aria-hidden":!0,style:{height:D(),width:R(),zIndex:-1}});return i.createElement(v,{"aria-colcount":n,"aria-rowcount":S,role:"grid",...m,className:r,dir:l,ref:g,style:{position:"relative",width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...O}},re,s,oe)}const ge=i.useState,ve=i.useRef;function Ie({children:e,className:t,defaultHeight:s=0,listRef:r,onResize:n,onRowsRendered:o,overscanCount:c=3,rowComponent:a,rowCount:l,rowHeight:d,rowProps:f,tagName:p="div",style:V,...S}){const k=te(f),O=i.useMemo(()=>i.memo(a,se),[a]),[v,m]=i.useState(null),{getCellBounds:L,getEstimatedSize:y,scrollToIndex:u,startIndexOverscan:g,startIndexVisible:z,stopIndexOverscan:T,stopIndexVisible:R}=K({containerElement:v,defaultContainerSize:s,direction:"vertical",itemCount:l,itemProps:k,itemSize:d,onResize:n,overscanCount:c});i.useImperativeHandle(r,()=>({get element(){return v},scrollToRow({align:I="auto",behavior:x="auto",index:b}){const M=u({align:I,containerScrollOffset:v?.scrollTop??0,index:b});typeof v?.scrollTo=="function"&&v.scrollTo({behavior:x,top:M})}}),[v,u]),i.useEffect(()=>{g>=0&&T>=0&&o&&o({startIndex:z,stopIndex:R},{startIndex:g,stopIndex:T})},[o,g,z,T,R]);const E=i.useMemo(()=>{const I=[];if(l>0)for(let x=g;x<=T;x++){const b=L(x);I.push(i.createElement(O,{...k,ariaAttributes:{"aria-posinset":x+1,"aria-setsize":l,role:"listitem"},key:x,index:x,style:{position:"absolute",left:0,transform:`translateY(${b.scrollOffset}px)`,height:b.size,width:"100%"}}))}return I},[O,L,l,k,g,T]),h=J.jsx("div",{"aria-hidden":!0,style:{height:y(),width:"100%",zIndex:-1}});return i.createElement(p,{role:"list",...S,className:t,ref:m,style:{position:"relative",maxHeight:"100%",flexGrow:1,overflowY:"auto",...V}},E,e,h)}const be=i.useState,me=i.useRef;let N=-1;function we(e=!1){if(N===-1||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",document.body.appendChild(t),N=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return N}exports.Grid=pe;exports.List=Ie;exports.getScrollbarSize=we;exports.useGridCallbackRef=ge;exports.useGridRef=ve;exports.useListCallbackRef=be;exports.useListRef=me;
|
|
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/utils/shallowCompare.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/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 { 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 { 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}): {\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n} {\n const maxIndex = itemCount - 1;\n\n let startIndexVisible = 0;\n let stopIndexVisible = -1;\n let startIndexOverscan = 0;\n let stopIndexOverscan = -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 startIndexVisible = currentIndex;\n startIndexOverscan = Math.max(0, startIndexVisible - 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 stopIndexVisible = Math.min(maxIndex, currentIndex);\n stopIndexOverscan = Math.min(itemCount - 1, stopIndexVisible + overscanCount);\n\n if (startIndexVisible < 0) {\n startIndexVisible = 0;\n stopIndexVisible = -1;\n startIndexOverscan = 0;\n stopIndexOverscan = -1;\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan,\n stopIndexOverscan\n };\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 { shallowCompare } from \"../utils/shallowCompare\";\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<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>({\n startIndexVisible: 0,\n startIndexOverscan: 0,\n stopIndexVisible: -1,\n stopIndexOverscan: -1\n });\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 {\n startIndexVisible,\n startIndexOverscan,\n stopIndexVisible,\n stopIndexOverscan\n } = {\n startIndexVisible: Math.min(itemCount - 1, indices.startIndexVisible),\n startIndexOverscan: Math.min(itemCount - 1, indices.startIndexOverscan),\n stopIndexVisible: Math.min(itemCount - 1, indices.stopIndexVisible),\n stopIndexOverscan: Math.min(itemCount - 1, indices.stopIndexOverscan)\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 (shallowCompare(next, prev)) {\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 (!shallowCompare(indices, next)) {\n setIndices(next);\n }\n }\n\n return scrollOffset;\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\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 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: { ariaAttributes: object; style: CSSProperties },\n nextProps: { ariaAttributes: object; style: CSSProperties }\n): boolean {\n const {\n ariaAttributes: prevAriaAttributes,\n style: prevStyle,\n ...prevRest\n } = prevProps;\n const {\n ariaAttributes: nextAriaAttributes,\n style: nextStyle,\n ...nextRest\n } = nextProps;\n\n return (\n shallowCompare(prevAriaAttributes, nextAriaAttributes) &&\n shallowCompare(prevStyle, nextStyle) &&\n shallowCompare(prevRest, nextRest)\n );\n}\n","import {\n createElement,\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, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<\n CellProps extends object,\n TagName extends TagNames = \"div\"\n>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n children,\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 tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>) {\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 startIndexOverscan: columnStartIndexOverscan,\n startIndexVisible: columnStartIndexVisible,\n scrollToIndex: scrollToColumnIndex,\n stopIndexOverscan: columnStopIndexOverscan,\n stopIndexVisible: columnStopIndexVisible\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 startIndexOverscan: rowStartIndexOverscan,\n startIndexVisible: rowStartIndexVisible,\n scrollToIndex: scrollToRowIndex,\n stopIndexOverscan: rowStopIndexOverscan,\n stopIndexVisible: rowStopIndexVisible\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 columnStartIndexOverscan >= 0 &&\n columnStopIndexOverscan >= 0 &&\n rowStartIndexOverscan >= 0 &&\n rowStopIndexOverscan >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered(\n {\n columnStartIndex: columnStartIndexVisible,\n columnStopIndex: columnStopIndexVisible,\n rowStartIndex: rowStartIndexVisible,\n rowStopIndex: rowStopIndexVisible\n },\n {\n columnStartIndex: columnStartIndexOverscan,\n columnStopIndex: columnStopIndexOverscan,\n rowStartIndex: rowStartIndexOverscan,\n rowStopIndex: rowStopIndexOverscan\n }\n );\n }\n }, [\n onCellsRendered,\n columnStartIndexOverscan,\n columnStartIndexVisible,\n columnStopIndexOverscan,\n columnStopIndexVisible,\n rowStartIndexOverscan,\n rowStartIndexVisible,\n rowStopIndexOverscan,\n rowStopIndexVisible\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (\n let rowIndex = rowStartIndexOverscan;\n rowIndex <= rowStopIndexOverscan;\n rowIndex++\n ) {\n const rowBounds = getRowBounds(rowIndex);\n\n const columns: ReactNode[] = [];\n\n for (\n let columnIndex = columnStartIndexOverscan;\n columnIndex <= columnStopIndexOverscan;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n columns.push(\n <CellComponent\n {...(cellProps as CellProps)}\n ariaAttributes={{\n \"aria-colindex\": columnIndex + 1,\n role: \"gridcell\"\n }}\n columnIndex={columnIndex}\n key={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 children.push(\n <div key={rowIndex} role=\"row\" aria-rowindex={rowIndex + 1}>\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndexOverscan,\n rowStopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedHeight(),\n width: getEstimatedWidth(),\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n \"aria-colcount\": columnCount,\n \"aria-rowcount\": rowCount,\n role: \"grid\",\n ...rest,\n className,\n dir,\n ref: setElement,\n style: {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\",\n ...style\n }\n },\n cells,\n children,\n sizingElement\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 createElement,\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, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { ListProps } from \"./types\";\n\nexport function List<\n RowProps extends object,\n TagName extends TagNames = \"div\"\n>({\n children,\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 tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>) {\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 startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\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 (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onRowsRendered) {\n onRowsRendered(\n {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n },\n {\n startIndex: startIndexOverscan,\n stopIndex: stopIndexOverscan\n }\n );\n }\n }, [\n onRowsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n ariaAttributes={{\n \"aria-posinset\": index + 1,\n \"aria-setsize\": rowCount,\n role: \"listitem\"\n }}\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 }, [\n RowComponent,\n getCellBounds,\n rowCount,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedSize(),\n width: \"100%\",\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n role: \"list\",\n ...rest,\n className,\n ref: setElement,\n style: {\n position: \"relative\",\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\",\n ...style\n }\n },\n rows,\n children,\n sizingElement\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","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","startIndexOverscan","stopIndexOverscan","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","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","tagName","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndexOverscan","columnStartIndexVisible","scrollToColumnIndex","columnStopIndexOverscan","columnStopIndexVisible","getRowBounds","getEstimatedHeight","rowStartIndexOverscan","rowStartIndexVisible","scrollToRowIndex","rowStopIndexOverscan","rowStopIndexVisible","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","left","top","cells","rowBounds","columns","columnBounds","createElement","jsx","sizingElement","useGridCallbackRef","useGridRef","List","listRef","onRowsRendered","RowComponentProp","rowPropsUnstable","rowProps","RowComponent","rows","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"wIAAO,SAASA,GAAMC,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,GAAMC,CAAO,CAAC,EAG7B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CChBO,MAAMI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AAM,SAAW,SAEjB,SAAS,KAAK,YAAY8J,CAAG,EAE7B7F,EAAO6F,EAAI,YAAcA,EAAI,YAE7B,SAAS,KAAK,YAAYA,CAAG,CAC/B,CAEA,OAAO7F,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/utils/shallowCompare.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/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 { 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 { 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}): {\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n} {\n const maxIndex = itemCount - 1;\n\n let startIndexVisible = 0;\n let stopIndexVisible = -1;\n let startIndexOverscan = 0;\n let stopIndexOverscan = -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 startIndexVisible = currentIndex;\n startIndexOverscan = Math.max(0, startIndexVisible - 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 stopIndexVisible = Math.min(maxIndex, currentIndex);\n stopIndexOverscan = Math.min(itemCount - 1, stopIndexVisible + overscanCount);\n\n if (startIndexVisible < 0) {\n startIndexVisible = 0;\n stopIndexVisible = -1;\n startIndexOverscan = 0;\n stopIndexOverscan = -1;\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan,\n stopIndexOverscan\n };\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 { shallowCompare } from \"../utils/shallowCompare\";\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<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>({\n startIndexVisible: 0,\n startIndexOverscan: 0,\n stopIndexVisible: -1,\n stopIndexOverscan: -1\n });\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 {\n startIndexVisible,\n startIndexOverscan,\n stopIndexVisible,\n stopIndexOverscan\n } = {\n startIndexVisible: Math.min(itemCount - 1, indices.startIndexVisible),\n startIndexOverscan: Math.min(itemCount - 1, indices.startIndexOverscan),\n stopIndexVisible: Math.min(itemCount - 1, indices.stopIndexVisible),\n stopIndexOverscan: Math.min(itemCount - 1, indices.stopIndexOverscan)\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 (shallowCompare(next, prev)) {\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 (!shallowCompare(indices, next)) {\n setIndices(next);\n }\n }\n\n return scrollOffset;\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\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 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: { ariaAttributes: object; style: CSSProperties },\n nextProps: { ariaAttributes: object; style: CSSProperties }\n): boolean {\n const {\n ariaAttributes: prevAriaAttributes,\n style: prevStyle,\n ...prevRest\n } = prevProps;\n const {\n ariaAttributes: nextAriaAttributes,\n style: nextStyle,\n ...nextRest\n } = nextProps;\n\n return (\n shallowCompare(prevAriaAttributes, nextAriaAttributes) &&\n shallowCompare(prevStyle, nextStyle) &&\n shallowCompare(prevRest, nextRest)\n );\n}\n","import {\n createElement,\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, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<\n CellProps extends object,\n TagName extends TagNames = \"div\"\n>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n children,\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 tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>) {\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 startIndexOverscan: columnStartIndexOverscan,\n startIndexVisible: columnStartIndexVisible,\n scrollToIndex: scrollToColumnIndex,\n stopIndexOverscan: columnStopIndexOverscan,\n stopIndexVisible: columnStopIndexVisible\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 startIndexOverscan: rowStartIndexOverscan,\n startIndexVisible: rowStartIndexVisible,\n scrollToIndex: scrollToRowIndex,\n stopIndexOverscan: rowStopIndexOverscan,\n stopIndexVisible: rowStopIndexVisible\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 columnStartIndexOverscan >= 0 &&\n columnStopIndexOverscan >= 0 &&\n rowStartIndexOverscan >= 0 &&\n rowStopIndexOverscan >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered(\n {\n columnStartIndex: columnStartIndexVisible,\n columnStopIndex: columnStopIndexVisible,\n rowStartIndex: rowStartIndexVisible,\n rowStopIndex: rowStopIndexVisible\n },\n {\n columnStartIndex: columnStartIndexOverscan,\n columnStopIndex: columnStopIndexOverscan,\n rowStartIndex: rowStartIndexOverscan,\n rowStopIndex: rowStopIndexOverscan\n }\n );\n }\n }, [\n onCellsRendered,\n columnStartIndexOverscan,\n columnStartIndexVisible,\n columnStopIndexOverscan,\n columnStopIndexVisible,\n rowStartIndexOverscan,\n rowStartIndexVisible,\n rowStopIndexOverscan,\n rowStopIndexVisible\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (\n let rowIndex = rowStartIndexOverscan;\n rowIndex <= rowStopIndexOverscan;\n rowIndex++\n ) {\n const rowBounds = getRowBounds(rowIndex);\n\n const columns: ReactNode[] = [];\n\n for (\n let columnIndex = columnStartIndexOverscan;\n columnIndex <= columnStopIndexOverscan;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n columns.push(\n <CellComponent\n {...(cellProps as CellProps)}\n ariaAttributes={{\n \"aria-colindex\": columnIndex + 1,\n role: \"gridcell\"\n }}\n columnIndex={columnIndex}\n key={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: rowBounds.size,\n width: columnBounds.size\n }}\n />\n );\n }\n\n children.push(\n <div key={rowIndex} role=\"row\" aria-rowindex={rowIndex + 1}>\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndexOverscan,\n rowStopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedHeight(),\n width: getEstimatedWidth(),\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n \"aria-colcount\": columnCount,\n \"aria-rowcount\": rowCount,\n role: \"grid\",\n ...rest,\n className,\n dir,\n ref: setElement,\n style: {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\",\n ...style\n }\n },\n cells,\n children,\n sizingElement\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 createElement,\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, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { ListProps } from \"./types\";\n\nexport function List<\n RowProps extends object,\n TagName extends TagNames = \"div\"\n>({\n children,\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 tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>) {\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 startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\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 (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onRowsRendered) {\n onRowsRendered(\n {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n },\n {\n startIndex: startIndexOverscan,\n stopIndex: stopIndexOverscan\n }\n );\n }\n }, [\n onRowsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n ariaAttributes={{\n \"aria-posinset\": index + 1,\n \"aria-setsize\": rowCount,\n role: \"listitem\"\n }}\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 }, [\n RowComponent,\n getCellBounds,\n rowCount,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedSize(),\n width: \"100%\",\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n role: \"list\",\n ...rest,\n className,\n ref: setElement,\n style: {\n position: \"relative\",\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\",\n ...style\n }\n },\n rows,\n children,\n sizingElement\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","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","startIndexOverscan","stopIndexOverscan","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","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","tagName","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndexOverscan","columnStartIndexVisible","scrollToColumnIndex","columnStopIndexOverscan","columnStopIndexVisible","getRowBounds","getEstimatedHeight","rowStartIndexOverscan","rowStartIndexVisible","scrollToRowIndex","rowStopIndexOverscan","rowStopIndexVisible","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","left","top","cells","rowBounds","columns","columnBounds","createElement","jsx","sizingElement","useGridCallbackRef","useGridRef","List","listRef","onRowsRendered","RowComponentProp","rowPropsUnstable","rowProps","RowComponent","rows","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"wIAAO,SAASA,GAAMC,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,GAAMC,CAAO,CAAC,EAG7B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CChB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jB,SAAS,KAAK,YAAY8J,CAAG,EAE7B7F,EAAO6F,EAAI,YAAcA,EAAI,YAE7B,SAAS,KAAK,YAAYA,CAAG,CAC/B,CAEA,OAAO7F,CACT"}
|
package/dist/react-window.js
CHANGED
|
@@ -50,12 +50,12 @@ function ge({
|
|
|
50
50
|
return J(() => {
|
|
51
51
|
if (o === null || p)
|
|
52
52
|
return;
|
|
53
|
-
const T = new ResizeObserver((
|
|
54
|
-
for (const V of
|
|
55
|
-
const { contentRect:
|
|
56
|
-
o === g && d((b) => b.height ===
|
|
57
|
-
height:
|
|
58
|
-
width:
|
|
53
|
+
const T = new ResizeObserver((y) => {
|
|
54
|
+
for (const V of y) {
|
|
55
|
+
const { contentRect: w, target: g } = V;
|
|
56
|
+
o === g && d((b) => b.height === w.height && b.width === w.width ? b : {
|
|
57
|
+
height: w.height,
|
|
58
|
+
width: w.width
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -307,9 +307,9 @@ function C({
|
|
|
307
307
|
stopIndexOverscan: -1
|
|
308
308
|
}), {
|
|
309
309
|
startIndexVisible: T,
|
|
310
|
-
startIndexOverscan:
|
|
310
|
+
startIndexOverscan: y,
|
|
311
311
|
stopIndexVisible: V,
|
|
312
|
-
stopIndexOverscan:
|
|
312
|
+
stopIndexOverscan: w
|
|
313
313
|
} = {
|
|
314
314
|
startIndexVisible: Math.min(n - 1, d.startIndexVisible),
|
|
315
315
|
startIndexOverscan: Math.min(n - 1, d.startIndexOverscan),
|
|
@@ -324,7 +324,7 @@ function C({
|
|
|
324
324
|
}), k = K({
|
|
325
325
|
height: 0,
|
|
326
326
|
width: 0
|
|
327
|
-
}),
|
|
327
|
+
}), O = r === "vertical" ? g : b, a = Oe({ containerSize: O, itemSize: c });
|
|
328
328
|
ee(() => {
|
|
329
329
|
if (typeof i == "function") {
|
|
330
330
|
const u = k.current;
|
|
@@ -356,7 +356,7 @@ function C({
|
|
|
356
356
|
return oe({
|
|
357
357
|
cachedBounds: x,
|
|
358
358
|
containerScrollOffset: I,
|
|
359
|
-
containerSize:
|
|
359
|
+
containerSize: O,
|
|
360
360
|
itemCount: n,
|
|
361
361
|
overscanCount: f
|
|
362
362
|
});
|
|
@@ -364,7 +364,7 @@ function C({
|
|
|
364
364
|
[
|
|
365
365
|
x,
|
|
366
366
|
e,
|
|
367
|
-
|
|
367
|
+
O,
|
|
368
368
|
r,
|
|
369
369
|
o,
|
|
370
370
|
n,
|
|
@@ -387,7 +387,7 @@ function C({
|
|
|
387
387
|
}), q = oe({
|
|
388
388
|
cachedBounds: x,
|
|
389
389
|
containerScrollOffset: E,
|
|
390
|
-
containerSize:
|
|
390
|
+
containerSize: O,
|
|
391
391
|
itemCount: n,
|
|
392
392
|
overscanCount: f
|
|
393
393
|
});
|
|
@@ -400,7 +400,7 @@ function C({
|
|
|
400
400
|
}, [
|
|
401
401
|
x,
|
|
402
402
|
e,
|
|
403
|
-
|
|
403
|
+
O,
|
|
404
404
|
r,
|
|
405
405
|
n,
|
|
406
406
|
f
|
|
@@ -415,7 +415,7 @@ function C({
|
|
|
415
415
|
align: u,
|
|
416
416
|
cachedBounds: x,
|
|
417
417
|
containerScrollOffset: I,
|
|
418
|
-
containerSize:
|
|
418
|
+
containerSize: O,
|
|
419
419
|
index: h,
|
|
420
420
|
itemCount: n,
|
|
421
421
|
itemSize: a
|
|
@@ -438,9 +438,9 @@ function C({
|
|
|
438
438
|
getCellBounds: z,
|
|
439
439
|
getEstimatedSize: S,
|
|
440
440
|
scrollToIndex: L,
|
|
441
|
-
startIndexOverscan:
|
|
441
|
+
startIndexOverscan: y,
|
|
442
442
|
startIndexVisible: T,
|
|
443
|
-
stopIndexOverscan:
|
|
443
|
+
stopIndexOverscan: w,
|
|
444
444
|
stopIndexVisible: V
|
|
445
445
|
};
|
|
446
446
|
}
|
|
@@ -473,13 +473,13 @@ function Se({
|
|
|
473
473
|
onCellsRendered: d,
|
|
474
474
|
onResize: p,
|
|
475
475
|
overscanCount: T = 3,
|
|
476
|
-
rowCount:
|
|
476
|
+
rowCount: y,
|
|
477
477
|
rowHeight: V,
|
|
478
|
-
style:
|
|
478
|
+
style: w,
|
|
479
479
|
tagName: g = "div",
|
|
480
480
|
...b
|
|
481
481
|
}) {
|
|
482
|
-
const k = de(t),
|
|
482
|
+
const k = de(t), O = H(
|
|
483
483
|
() => ie(e, ae),
|
|
484
484
|
[e]
|
|
485
485
|
), [a, x] = j(null), z = xe(a, i), {
|
|
@@ -512,7 +512,7 @@ function Se({
|
|
|
512
512
|
containerElement: a,
|
|
513
513
|
defaultContainerSize: l,
|
|
514
514
|
direction: "vertical",
|
|
515
|
-
itemCount:
|
|
515
|
+
itemCount: y,
|
|
516
516
|
itemProps: k,
|
|
517
517
|
itemSize: V,
|
|
518
518
|
onResize: p,
|
|
@@ -606,14 +606,14 @@ function Se({
|
|
|
606
606
|
]);
|
|
607
607
|
const fe = H(() => {
|
|
608
608
|
const R = [];
|
|
609
|
-
if (o > 0 &&
|
|
609
|
+
if (o > 0 && y > 0)
|
|
610
610
|
for (let m = F; m <= U; m++) {
|
|
611
611
|
const W = E(m), A = [];
|
|
612
612
|
for (let $ = L; $ <= h; $++) {
|
|
613
613
|
const D = S($);
|
|
614
614
|
A.push(
|
|
615
615
|
/* @__PURE__ */ P(
|
|
616
|
-
|
|
616
|
+
O,
|
|
617
617
|
{
|
|
618
618
|
...k,
|
|
619
619
|
ariaAttributes: {
|
|
@@ -628,7 +628,7 @@ function Se({
|
|
|
628
628
|
left: z ? void 0 : 0,
|
|
629
629
|
right: z ? 0 : void 0,
|
|
630
630
|
transform: `translate(${z ? -D.scrollOffset : D.scrollOffset}px, ${W.scrollOffset}px)`,
|
|
631
|
-
height:
|
|
631
|
+
height: W.size,
|
|
632
632
|
width: D.size
|
|
633
633
|
}
|
|
634
634
|
}
|
|
@@ -641,7 +641,7 @@ function Se({
|
|
|
641
641
|
}
|
|
642
642
|
return R;
|
|
643
643
|
}, [
|
|
644
|
-
|
|
644
|
+
O,
|
|
645
645
|
k,
|
|
646
646
|
o,
|
|
647
647
|
L,
|
|
@@ -649,7 +649,7 @@ function Se({
|
|
|
649
649
|
S,
|
|
650
650
|
E,
|
|
651
651
|
z,
|
|
652
|
-
|
|
652
|
+
y,
|
|
653
653
|
F,
|
|
654
654
|
U
|
|
655
655
|
]), ue = /* @__PURE__ */ _(
|
|
@@ -667,7 +667,7 @@ function Se({
|
|
|
667
667
|
g,
|
|
668
668
|
{
|
|
669
669
|
"aria-colcount": o,
|
|
670
|
-
"aria-rowcount":
|
|
670
|
+
"aria-rowcount": y,
|
|
671
671
|
role: "grid",
|
|
672
672
|
...b,
|
|
673
673
|
className: r,
|
|
@@ -681,7 +681,7 @@ function Se({
|
|
|
681
681
|
maxWidth: "100%",
|
|
682
682
|
flexGrow: 1,
|
|
683
683
|
overflow: "auto",
|
|
684
|
-
...
|
|
684
|
+
...w
|
|
685
685
|
}
|
|
686
686
|
},
|
|
687
687
|
fe,
|
|
@@ -704,14 +704,14 @@ function ke({
|
|
|
704
704
|
rowProps: d,
|
|
705
705
|
tagName: p = "div",
|
|
706
706
|
style: T,
|
|
707
|
-
...
|
|
707
|
+
...y
|
|
708
708
|
}) {
|
|
709
|
-
const V = de(d),
|
|
709
|
+
const V = de(d), w = H(
|
|
710
710
|
() => ie(c, ae),
|
|
711
711
|
[c]
|
|
712
712
|
), [g, b] = j(null), {
|
|
713
713
|
getCellBounds: k,
|
|
714
|
-
getEstimatedSize:
|
|
714
|
+
getEstimatedSize: O,
|
|
715
715
|
scrollToIndex: a,
|
|
716
716
|
startIndexOverscan: x,
|
|
717
717
|
startIndexVisible: z,
|
|
@@ -775,7 +775,7 @@ function ke({
|
|
|
775
775
|
const v = k(h);
|
|
776
776
|
I.push(
|
|
777
777
|
/* @__PURE__ */ P(
|
|
778
|
-
|
|
778
|
+
w,
|
|
779
779
|
{
|
|
780
780
|
...V,
|
|
781
781
|
ariaAttributes: {
|
|
@@ -798,7 +798,7 @@ function ke({
|
|
|
798
798
|
}
|
|
799
799
|
return I;
|
|
800
800
|
}, [
|
|
801
|
-
|
|
801
|
+
w,
|
|
802
802
|
k,
|
|
803
803
|
i,
|
|
804
804
|
V,
|
|
@@ -809,7 +809,7 @@ function ke({
|
|
|
809
809
|
{
|
|
810
810
|
"aria-hidden": !0,
|
|
811
811
|
style: {
|
|
812
|
-
height:
|
|
812
|
+
height: O(),
|
|
813
813
|
width: "100%",
|
|
814
814
|
zIndex: -1
|
|
815
815
|
}
|
|
@@ -819,7 +819,7 @@ function ke({
|
|
|
819
819
|
p,
|
|
820
820
|
{
|
|
821
821
|
role: "list",
|
|
822
|
-
...
|
|
822
|
+
...y,
|
|
823
823
|
className: t,
|
|
824
824
|
ref: b,
|
|
825
825
|
style: {
|