react-window 2.3.2 → 2.3.4
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.d.ts +1 -1
- package/dist/react-window.js +599 -561
- package/dist/react-window.js.map +1 -1
- package/package.json +2 -2
package/dist/react-window.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("react/jsx-runtime"),c=require("react");function ue(e){let t=e;for(;t;){if(t.dir)return t.dir==="rtl";t=t.parentElement}return!1}function fe(e,t){const[s,r]=c.useState(t==="rtl");return c.useLayoutEffect(()=>{t?r(t==="rtl"):e&&r(ue(e))},[t,e]),s}const U=typeof window<"u"?c.useLayoutEffect:c.useEffect;function re(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}function de({box:e,defaultHeight:t,defaultWidth:s,disabled:r,element:o,mode:n,style:u}){const{styleHeight:a,styleWidth:l}=c.useMemo(()=>({styleHeight:re(u?.height),styleWidth:re(u?.width)}),[u?.height,u?.width]),[f,i]=c.useState({height:t,width:s}),d=r||n==="only-height"&&a!==void 0||n==="only-width"&&l!==void 0||a!==void 0&&l!==void 0;return U(()=>{if(o===null||d)return;const h=new ResizeObserver(p=>{for(const m of p){const{contentRect:g,target:I}=m;o===I&&i(v=>v.height===g.height&&v.width===g.width?v:{height:g.height,width:g.width})}});return h.observe(o,{box:e}),()=>{h?.unobserve(o)}},[e,d,o,a,l]),c.useMemo(()=>({height:a??f.height,width:l??f.width}),[f,a,l])}function Q(e){const t=c.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return U(()=>{t.current=e},[e]),c.useCallback((...s)=>t.current?.(...s),[t])}let q=null;function he(e=!1){if(q===null||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",s.direction="rtl";const r=document.createElement("div"),o=r.style;return o.width="100px",o.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?q="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?q="negative":q="positive-ascending"),document.body.removeChild(t),q}return q}function J({containerElement:e,direction:t,isRtl:s,scrollOffset:r}){if(t==="horizontal"&&s)switch(he()){case"negative":return-r;case"positive-descending":{if(e){const{clientWidth:o,scrollWidth:n}=e;return n-o-r}break}}return r}function k(e,t="Assertion error"){if(!e)throw console.error(t),Error(t)}function B(e,t){if(e===t)return!0;if(!!e!=!!t||(k(e!==void 0),k(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(const s in e)if(!Object.hasOwn(t,s)||!Object.is(t[s],e[s]))return!1;return!0}function ne({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);k(r!==void 0,"Unexpected bounds cache miss");const o=(r.scrollOffset+r.size)/e.size;return t*o}}function pe({align:e,cachedBounds:t,index:s,itemCount:r,itemSize:o,containerScrollOffset:n,containerSize:u}){if(s<0||s>=r)throw RangeError(`Invalid index specified: ${s}`,{cause:`Index ${s} is not within the range of 0 - ${r-1}`});const a=t.get(s),l=ne({cachedBounds:t,itemCount:r,itemSize:o}),f=Math.max(0,Math.min(l-u,a.scrollOffset)),i=Math.max(0,a.scrollOffset-u+a.size),d=a.size>u?n>=a.scrollOffset&&n<=i:n>=i&&n<=a.scrollOffset;switch(e==="smart"&&(e=d?"auto":"center"),e){case"start":return f;case"end":return i;case"center":return Math.max(0,Math.min(l-u,a.scrollOffset+a.size/2-u/2));case"auto":default:return d?n:n<i?i:f}}function P({cachedBounds:e,containerScrollOffset:t,containerSize:s,itemCount:r,overscanCount:o}){const n=r-1;if(r===0)return{startIndexVisible:0,stopIndexVisible:-1,startIndexOverscan:0,stopIndexOverscan:-1};let u,a;const{itemSize:l}=e;if(l!==void 0&&l>0)u=Math.max(0,Math.min(n,Math.floor(t/l))),a=Math.max(u,Math.min(n,Math.ceil((t+s)/l)-1));else{let f=0,i=Math.min(n,Math.max(0,e.size-1)),d=1;for(;i<n;){const h=e.get(i);if(h.scrollOffset+h.size>t)break;f=i+1,i=Math.min(n,i+d),d*=2}for(;f<i;){const h=Math.floor((f+i)/2),p=e.get(h);p.scrollOffset+p.size>t?i=h:f=h+1}for(u=f,a=f;a<n;){const h=e.get(a);if(h.scrollOffset+h.size>=t+s)break;a++}}return{startIndexVisible:u,stopIndexVisible:a,startIndexOverscan:Math.max(0,u-o),stopIndexOverscan:Math.min(n,a+o)}}function ge({itemCount:e,itemProps:t,itemSize:s}){const r=new Map;return{itemSize:typeof s=="number"?s:void 0,get(o){if(k(o<e,`Invalid index ${o}`),typeof s=="number"){k(o>=0,`Invalid index ${o}`);let u=r.get(o);return u===void 0&&(u={size:s,scrollOffset:o*s},r.set(o,u)),u}for(;r.size-1<o;){const u=r.size,a=s(u,t);if(u===0)r.set(u,{size:a,scrollOffset:0});else{const l=r.get(u-1);k(l!==void 0,`Unexpected bounds cache miss for index ${o}`),r.set(u,{scrollOffset:l.scrollOffset+l.size,size:a})}}const n=r.get(o);return k(n!==void 0,`Unexpected bounds cache miss for index ${o}`),n},set(o,n){r.set(o,n)},get size(){return r.size}}}function ve({itemCount:e,itemProps:t,itemSize:s}){return c.useMemo(()=>ge({itemCount:e,itemProps:t,itemSize:s}),[e,t,s])}function be({containerSize:e,itemSize:t}){let s;switch(typeof t){case"string":{k(t.endsWith("%"),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),k(e!==void 0,"Container size must be defined if a percentage item size is specified"),s=e*parseFloat(t)/100;break}default:{s=t;break}}return s}function te({containerElement:e,containerStyle:t,defaultContainerSize:s=0,direction:r,isRtl:o=!1,itemCount:n,itemProps:u,itemSize:a,onResize:l,overscanCount:f}){const{height:i=s,width:d=s}=de({defaultHeight:r==="vertical"?s:void 0,defaultWidth:r==="horizontal"?s:void 0,element:e,mode:r==="vertical"?"only-height":"only-width",style:t}),h=c.useRef({height:0,width:0}),p=r==="vertical"?i:d,m=be({containerSize:p,itemSize:a});c.useLayoutEffect(()=>{if(typeof l=="function"){const b=h.current;(b.height!==i||b.width!==d)&&(l({height:i,width:d},{...b}),b.height=i,b.width=d)}},[i,l,d]);const g=ve({itemCount:n,itemProps:u,itemSize:m}),I=c.useCallback(b=>g.get(b),[g]),[v,W]=c.useState(()=>P({cachedBounds:g,containerScrollOffset:0,containerSize:p,itemCount:n,overscanCount:f})),{startIndexVisible:E,startIndexOverscan:T,stopIndexVisible:$,stopIndexOverscan:x}={startIndexVisible:Math.min(n-1,v.startIndexVisible),startIndexOverscan:Math.min(n-1,v.startIndexOverscan),stopIndexVisible:Math.min(n-1,v.stopIndexVisible),stopIndexOverscan:Math.min(n-1,v.stopIndexOverscan)},C=c.useCallback(()=>ne({cachedBounds:g,itemCount:n,itemSize:m}),[g,n,m]),w=c.useCallback(b=>{const O=J({containerElement:e,direction:r,isRtl:o,scrollOffset:b});return P({cachedBounds:g,containerScrollOffset:O,containerSize:p,itemCount:n,overscanCount:f})},[g,e,p,r,o,n,f]);U(()=>{const b=(r==="vertical"?e?.scrollTop:e?.scrollLeft)??0;W(w(b))},[e,r,w]),U(()=>{if(!e)return;const b=()=>{W(O=>{const{scrollLeft:A,scrollTop:y}=e,z=J({containerElement:e,direction:r,isRtl:o,scrollOffset:r==="vertical"?y:A}),G=P({cachedBounds:g,containerScrollOffset:z,containerSize:p,itemCount:n,overscanCount:f});return B(G,O)?O:G})};return e.addEventListener("scroll",b),()=>{e.removeEventListener("scroll",b)}},[g,e,p,r,o,n,f]);const D=Q(({align:b="auto",containerScrollOffset:O,index:A})=>{let y=pe({align:b,cachedBounds:g,containerScrollOffset:J({containerElement:e,direction:r,isRtl:o,scrollOffset:O}),containerSize:p,index:A,itemCount:n,itemSize:m});if(e){if(y=J({containerElement:e,direction:r,isRtl:o,scrollOffset:y}),typeof e.scrollTo!="function"){const z=w(y);B(v,z)||W(z)}return y}});return{getCellBounds:I,getEstimatedSize:C,scrollToIndex:D,startIndexOverscan:T,startIndexVisible:E,stopIndexOverscan:x,stopIndexVisible:$}}function oe(e){const[t,s]=c.useState(e);return B(t,e)?t:(s(e),e)}function ie(e,t){const{ariaAttributes:s,style:r,...o}=e,{ariaAttributes:n,style:u,...a}=t;return B(s,n)&&B(r,u)&&B(o,a)}function me({cellComponent:e,cellProps:t,children:s,className:r,columnCount:o,columnKey:n,columnWidth:u,defaultHeight:a=0,defaultWidth:l=0,dir:f,gridRef:i,onCellsRendered:d,onResize:h,overscanCount:p=3,rowCount:m,rowHeight:g,rowKey:I,style:v,tagName:W="div",...E}){const T=oe(t),$=c.useMemo(()=>c.memo(e,ie),[e]),[x,C]=c.useState(null),w=fe(x,f),{getCellBounds:D,getEstimatedSize:b,startIndexOverscan:O,startIndexVisible:A,scrollToIndex:y,stopIndexOverscan:z,stopIndexVisible:G}=te({containerElement:x,containerStyle:v,defaultContainerSize:l,direction:"horizontal",isRtl:w,itemCount:o,itemProps:T,itemSize:u,onResize:h,overscanCount:p}),{getCellBounds:R,getEstimatedSize:M,startIndexOverscan:L,startIndexVisible:X,scrollToIndex:Z,stopIndexOverscan:N,stopIndexVisible:se}=te({containerElement:x,containerStyle:v,defaultContainerSize:a,direction:"vertical",itemCount:m,itemProps:T,itemSize:g,onResize:h,overscanCount:p});c.useImperativeHandle(i,()=>({get element(){return x},scrollToCell({behavior:H="auto",columnAlign:S="auto",columnIndex:F,rowAlign:j="auto",rowIndex:V}){const _=y({align:S,containerScrollOffset:x?.scrollLeft??0,index:F}),ae=Z({align:j,containerScrollOffset:x?.scrollTop??0,index:V});typeof x?.scrollTo=="function"&&x.scrollTo({behavior:H,left:_,top:ae})},scrollToColumn({align:H="auto",behavior:S="auto",index:F}){const j=y({align:H,containerScrollOffset:x?.scrollLeft??0,index:F});typeof x?.scrollTo=="function"&&x.scrollTo({behavior:S,left:j})},scrollToRow({align:H="auto",behavior:S="auto",index:F}){const j=Z({align:H,containerScrollOffset:x?.scrollTop??0,index:F});typeof x?.scrollTo=="function"&&x.scrollTo({behavior:S,top:j})}}),[x,y,Z]),c.useEffect(()=>{O>=0&&z>=0&&L>=0&&N>=0&&d&&d({columnStartIndex:A,columnStopIndex:G,rowStartIndex:X,rowStopIndex:se},{columnStartIndex:O,columnStopIndex:z,rowStartIndex:L,rowStopIndex:N})},[d,O,A,z,G,L,X,N,se]);const ce=c.useMemo(()=>{const H=[];if(o>0&&m>0)for(let S=L;S<=N;S++){const F=R(S),j=[];for(let V=O;V<=z;V++){const _=D(V);j.push(c.createElement($,{...T,ariaAttributes:{"aria-colindex":V+1,role:"gridcell"},columnIndex:V,key:n?n({columnIndex:V,data:T,rowIndex:S}):V,rowIndex:S,style:{position:"absolute",left:w?void 0:0,right:w?0:void 0,transform:`translate(${w?-_.scrollOffset:_.scrollOffset}px, ${F.scrollOffset}px)`,height:F.size,width:_.size}}))}H.push(ee.jsx("div",{role:"row","aria-rowindex":S+1,children:j},I?I({data:T,rowIndex:S}):S))}return H},[$,T,o,n,O,z,D,R,w,m,I,L,N]),le=ee.jsx("div",{"aria-hidden":!0,style:{height:M(),width:b(),zIndex:-1}});return c.createElement(W,{"aria-colcount":o,"aria-rowcount":m,role:"grid",...E,className:r,dir:f,ref:C,style:{position:"relative",maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...v}},ce,s,le)}const xe=c.useState,we=c.useRef;function Ie(e){return e!=null&&typeof e=="object"&&"getAverageRowHeight"in e&&typeof e.getAverageRowHeight=="function"}function Oe({element:e,getCellBounds:t,isDynamicRowHeight:s,rowCount:r,rowElements:o,scrollToIndex:n}){const u=c.useRef(null),a=c.useRef(void 0),l=Q(()=>{u.current=null,a.current!==void 0&&(cancelAnimationFrame(a.current),a.current=void 0)}),f=Q(()=>{a.current=void 0;const i=u.current;if(!i)return;if(!e||!s||i.index>=r||performance.now()>=i.deadline){l();return}const d=n({align:i.align,containerScrollOffset:e.scrollTop,index:i.index});if(d!==void 0){const h=Math.max(0,Math.min(d,e.scrollHeight-e.clientHeight));if(Math.abs(h-e.scrollTop)>1)i.stableFrames=0,e.scrollTo({behavior:"instant",top:h});else{const p=o.current;if(!(p.some(I=>I.getAttribute(Y)===`${i.index}`)&&p.every(I=>{const v=Number(I.getAttribute(Y));return Math.abs(t(v).size-I.offsetHeight)<=1})))i.stableFrames=0;else if(++i.stableFrames>=2){l();return}}}a.current=requestAnimationFrame(f)});return U(()=>{if(!e)return;const i=d=>{switch(d.key){case"ArrowUp":case"ArrowDown":case"PageUp":case"PageDown":case"Home":case"End":case" ":l()}};return e.addEventListener("wheel",l,{passive:!0}),e.addEventListener("touchstart",l,{passive:!0}),e.addEventListener("pointerdown",l),e.addEventListener("keydown",i),()=>{l(),e.removeEventListener("wheel",l),e.removeEventListener("touchstart",l),e.removeEventListener("pointerdown",l),e.removeEventListener("keydown",i)}},[l,e]),c.useCallback(({align:i="auto",behavior:d="auto",index:h})=>{s&&i==="smart"&&(i=n({align:"auto",containerScrollOffset:e?.scrollTop??0,index:h})===(e?.scrollTop??0)?"auto":"center");const p=n({align:i,containerScrollOffset:e?.scrollTop??0,index:h});l(),typeof e?.scrollTo=="function"&&(s&&(u.current={align:i,index:h,deadline:performance.now()+1e3,stableFrames:0},a.current=requestAnimationFrame(f)),e.scrollTo({behavior:s?"instant":d,top:p}))},[l,f,e,s,n])}const Y="data-react-window-index";function Se({children:e,className:t,defaultHeight:s=0,listRef:r,onResize:o,onRowsRendered:n,overscanCount:u=3,rowComponent:a,rowCount:l,rowHeight:f,rowKey:i,rowProps:d,tagName:h="div",style:p,...m}){const g=oe(d),I=c.useMemo(()=>c.memo(a,ie),[a]),[v,W]=c.useState(null),E=Ie(f),T=c.useMemo(()=>E?R=>f.getRowHeight(R)??f.getAverageRowHeight():f,[E,f]),{getCellBounds:$,getEstimatedSize:x,scrollToIndex:C,startIndexOverscan:w,startIndexVisible:D,stopIndexOverscan:b,stopIndexVisible:O}=te({containerElement:v,containerStyle:p,defaultContainerSize:s,direction:"vertical",itemCount:l,itemProps:g,itemSize:T,onResize:o,overscanCount:u}),A=c.useRef([]),y=Oe({element:v,getCellBounds:$,isDynamicRowHeight:E,rowCount:l,rowElements:A,scrollToIndex:C});c.useImperativeHandle(r,()=>({get element(){return v},scrollToRow:y}),[v,y]),U(()=>{if(!v)return;const R=Array.from(v.children).slice(0,w<0?0:b-w+1).filter((M,L)=>{if(M.hasAttribute("aria-hidden"))return!1;const X=`${w+L}`;return M.setAttribute(Y,X),!0});if(A.current=R,E)return f.observeRowElements(R)},[I,v,E,l,f,i,g,w,b]),c.useEffect(()=>{w>=0&&b>=0&&n&&n({startIndex:D,stopIndex:O},{startIndex:w,stopIndex:b})},[n,w,D,b,O]);const z=c.useMemo(()=>{const R=[];if(l>0)for(let M=w;M<=b;M++){const L=$(M);R.push(c.createElement(I,{...g,ariaAttributes:{"aria-posinset":M+1,"aria-setsize":l,role:"listitem"},key:i?i(M,g):M,index:M,style:{position:"absolute",left:0,transform:`translateY(${L.scrollOffset}px)`,height:E?void 0:L.size,width:"100%"}}))}return R},[I,$,E,l,i,g,w,b]),G=ee.jsx("div",{"aria-hidden":!0,style:{height:x(),width:"100%",zIndex:-1}});return c.createElement(h,{role:"list",...m,className:t,ref:W,style:{position:"relative",maxHeight:"100%",flexGrow:1,overflowY:"auto",...p}},z,e,G)}function ye({defaultRowHeight:e,key:t}){const[s,r]=c.useState({key:t,map:new Map});s.key!==t&&r({key:t,map:new Map});const{map:o}=s,n=c.useCallback(()=>{let d=0;return o.forEach(h=>{d+=h}),d===0?e:d/o.size},[e,o]),u=c.useCallback(d=>{const h=o.get(d);return h!==void 0?h:e},[e,o]),a=c.useCallback((d,h)=>{r(p=>{if(p.map.get(d)===h)return p;const m=new Map(p.map);return m.set(d,h),{...p,map:m}})},[]),l=Q(d=>{d.length!==0&&d.forEach(h=>{const{borderBoxSize:p,target:m}=h,g=m.getAttribute(Y);k(g!==null,`Invalid ${Y} attribute value`);const I=parseInt(g),{blockSize:v}=p[0];v&&a(I,v)})}),[f]=c.useState(()=>{if(typeof ResizeObserver<"u")return new ResizeObserver(l)});c.useEffect(()=>{if(f)return()=>{f.disconnect()}},[f]);const i=c.useCallback(d=>f?(d.forEach(h=>f.observe(h)),()=>{d.forEach(h=>f.unobserve(h))}):()=>{},[f]);return c.useMemo(()=>({getAverageRowHeight:n,getRowHeight:u,setRowHeight:a,observeRowElements:i}),[n,u,a,i])}const ze=c.useState,Me=c.useRef;let K=-1;function Ee(e=!1){if(K===-1||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",document.body.appendChild(t),K=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return K}exports.Grid=me;exports.List=Se;exports.getScrollbarSize=Ee;exports.useDynamicRowHeight=ye;exports.useGridCallbackRef=xe;exports.useGridRef=we;exports.useListCallbackRef=ze;exports.useListRef=Me;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),c=require("react");function he(e){let t=e;for(;t;){if(t.dir)return t.dir==="rtl";t=t.parentElement}return!1}function ve(e,t){const[s,r]=c.useState(t==="rtl");return c.useLayoutEffect(()=>{t?r(t==="rtl"):e&&r(he(e))},[t,e]),s}const U=typeof window<"u"?c.useLayoutEffect:c.useEffect;function ee(e){return e?.ownerDocument.defaultView??window}function ie(e){return ee(e).ResizeObserver??(typeof ResizeObserver<"u"?ResizeObserver:void 0)}function se(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}function pe({box:e,defaultHeight:t,defaultWidth:s,disabled:r,element:n,mode:i,style:a}){const{styleHeight:u,styleWidth:l}=c.useMemo(()=>({styleHeight:se(a?.height),styleWidth:se(a?.width)}),[a?.height,a?.width]),[f,v]=c.useState({height:t,width:s}),o=r||i==="only-height"&&u!==void 0||i==="only-width"&&l!==void 0||u!==void 0&&l!==void 0;return U(()=>{if(n===null||o)return;const h=ie(n);if(!h)return;const d=new h(g=>{for(const p of g){const{contentRect:w,target:b}=p;n===b&&v(S=>S.height===w.height&&S.width===w.width?S:{height:w.height,width:w.width})}});return d.observe(n,{box:e}),()=>{d?.unobserve(n)}},[e,o,n,u,l]),c.useMemo(()=>({height:u??f.height,width:l??f.width}),[f,u,l])}function D(e){const t=c.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return U(()=>{t.current=e},[e]),c.useCallback((...s)=>t.current?.(...s),[t])}const re=new WeakMap;function ge(e=!1,t=document){let s=re.get(t);if(s===void 0||e){const r=t.createElement("div"),n=r.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";const i=t.createElement("div"),a=i.style;a.width="100px",a.height="100px",r.appendChild(i),t.body.appendChild(r),r.scrollLeft>0?s="positive-descending":(r.scrollLeft=1,r.scrollLeft===0?s="negative":s="positive-ascending"),t.body.removeChild(r),re.set(t,s)}return s}function Z({containerElement:e,direction:t,isRtl:s,scrollOffset:r}){if(t==="horizontal"&&s)switch(ge(!1,e?.ownerDocument??document)){case"negative":return-r;case"positive-descending":{if(e){const{clientWidth:n,scrollWidth:i}=e;return i-n-r}break}}return r}function A(e,t="Assertion error"){if(!e)throw console.error(t),Error(t)}function C(e,t){if(e===t)return!0;if(!!e!=!!t||(A(e!==void 0),A(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(const s in e)if(!Object.hasOwn(t,s)||!Object.is(t[s],e[s]))return!1;return!0}function ce({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);A(r!==void 0,"Unexpected bounds cache miss");const n=(r.scrollOffset+r.size)/e.size;return t*n}}function be({align:e,cachedBounds:t,index:s,itemCount:r,itemSize:n,containerScrollOffset:i,containerSize:a}){if(s<0||s>=r)throw RangeError(`Invalid index specified: ${s}`,{cause:`Index ${s} is not within the range of 0 - ${r-1}`});const u=t.get(s),l=ce({cachedBounds:t,itemCount:r,itemSize:n}),f=Math.max(0,Math.min(l-a,u.scrollOffset)),v=Math.max(0,u.scrollOffset-a+u.size),o=u.size>a?i>=u.scrollOffset&&i<=v:i>=v&&i<=u.scrollOffset;switch(e==="smart"&&(e=o?"auto":"center"),e){case"start":return f;case"end":return v;case"center":return Math.max(0,Math.min(l-a,u.scrollOffset+u.size/2-a/2));case"auto":default:return o?i:i<v?v:f}}function Q({cachedBounds:e,containerScrollOffset:t,containerSize:s,itemCount:r,overscanCount:n}){const i=r-1;if(r===0)return{startIndexVisible:0,stopIndexVisible:-1,startIndexOverscan:0,stopIndexOverscan:-1};let a,u;const{itemSize:l}=e;if(l!==void 0&&l>0)a=Math.max(0,Math.min(i,Math.floor(t/l))),u=Math.max(a,Math.min(i,Math.ceil((t+s)/l)-1));else{let f=0,v=Math.min(i,Math.max(0,e.size-1));for(;f<v;){const o=Math.floor((f+v)/2),h=e.get(o);h.scrollOffset+h.size>t?v=o:f=o+1}for(;f<i;){const o=e.get(f);if(o.scrollOffset+o.size>t)break;f++}for(a=f,u=f;u<i;){const o=e.get(u);if(o.scrollOffset+o.size>=t+s)break;u++}}return{startIndexVisible:a,stopIndexVisible:u,startIndexOverscan:Math.max(0,a-n),stopIndexOverscan:Math.min(i,u+n)}}function xe({itemCount:e,itemProps:t,itemSize:s}){const r=new Map;return{itemSize:typeof s=="number"?s:void 0,get(n){if(A(n<e,`Invalid index ${n}`),typeof s=="number"){A(n>=0,`Invalid index ${n}`);let a=r.get(n);return a===void 0&&(a={size:s,scrollOffset:n*s},r.set(n,a)),a}for(;r.size-1<n;){const a=r.size,u=s(a,t);if(a===0)r.set(a,{size:u,scrollOffset:0});else{const l=r.get(a-1);A(l!==void 0,`Unexpected bounds cache miss for index ${n}`),r.set(a,{scrollOffset:l.scrollOffset+l.size,size:u})}}const i=r.get(n);return A(i!==void 0,`Unexpected bounds cache miss for index ${n}`),i},set(n,i){r.set(n,i)},get size(){return r.size}}}function we({itemCount:e,itemProps:t,itemSize:s}){return c.useMemo(()=>xe({itemCount:e,itemProps:t,itemSize:s}),[e,t,s])}function Ie({containerSize:e,itemSize:t}){let s;switch(typeof t){case"string":{A(t.endsWith("%"),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),A(e!==void 0,"Container size must be defined if a percentage item size is specified"),s=e*parseFloat(t)/100;break}default:{s=t;break}}return s}function K({containerElement:e,containerStyle:t,defaultContainerSize:s=0,direction:r,isRtl:n=!1,itemCount:i,itemProps:a,itemSize:u,onResize:l,overscanCount:f}){const{height:v=s,width:o=s}=pe({defaultHeight:r==="vertical"?s:void 0,defaultWidth:r==="horizontal"?s:void 0,element:e,mode:r==="vertical"?"only-height":"only-width",style:t}),h=c.useRef({height:0,width:0}),d=r==="vertical"?v:o,g=Ie({containerSize:d,itemSize:u});c.useLayoutEffect(()=>{if(typeof l=="function"){const x=h.current;(x.height!==v||x.width!==o)&&(l({height:v,width:o},{...x}),x.height=v,x.width=o)}},[v,l,o]);const p=we({itemCount:i,itemProps:a,itemSize:g}),w=c.useCallback(x=>p.get(x),[p]),[b,S]=c.useState(()=>Q({cachedBounds:p,containerScrollOffset:0,containerSize:d,itemCount:i,overscanCount:f})),{startIndexVisible:R,startIndexOverscan:T,stopIndexVisible:H,stopIndexOverscan:I}={startIndexVisible:Math.min(i-1,b.startIndexVisible),startIndexOverscan:Math.min(i-1,b.startIndexOverscan),stopIndexVisible:Math.min(i-1,b.stopIndexVisible),stopIndexOverscan:Math.min(i-1,b.stopIndexOverscan)},q=c.useCallback(()=>ce({cachedBounds:p,itemCount:i,itemSize:g}),[p,i,g]),m=c.useCallback(x=>{const O=Z({containerElement:e,direction:r,isRtl:n,scrollOffset:x});return Q({cachedBounds:p,containerScrollOffset:O,containerSize:d,itemCount:i,overscanCount:f})},[p,e,d,r,n,i,f]);U(()=>{const x=(r==="vertical"?e?.scrollTop:e?.scrollLeft)??0;S(m(x))},[e,r,m]),U(()=>{if(!e)return;const x=()=>{S(O=>{const{scrollLeft:V,scrollTop:y}=e,M=Z({containerElement:e,direction:r,isRtl:n,scrollOffset:r==="vertical"?y:V}),B=Q({cachedBounds:p,containerScrollOffset:M,containerSize:d,itemCount:i,overscanCount:f});return C(B,O)?O:B})};return e.addEventListener("scroll",x),()=>{e.removeEventListener("scroll",x)}},[p,e,d,r,n,i,f]);const G=D(({align:x="auto",containerScrollOffset:O,index:V})=>{let y=be({align:x,cachedBounds:p,containerScrollOffset:Z({containerElement:e,direction:r,isRtl:n,scrollOffset:O}),containerSize:d,index:V,itemCount:i,itemSize:g});if(e){if(y=Z({containerElement:e,direction:r,isRtl:n,scrollOffset:y}),typeof e.scrollTo!="function"){const M=m(y);C(b,M)||S(M)}return y}});return{getCellBounds:w,getEstimatedSize:q,scrollToIndex:G,startIndexOverscan:T,startIndexVisible:R,stopIndexOverscan:I,stopIndexVisible:H}}function le(e){const[t,s]=c.useState(e);return C(t,e)?t:(s(e),e)}function ae(e,t){const{ariaAttributes:s,style:r,...n}=e,{ariaAttributes:i,style:a,...u}=t;return C(s,i)&&C(r,a)&&C(n,u)}function me({cellComponent:e,cellProps:t,children:s,className:r,columnCount:n,columnKey:i,columnWidth:a,defaultHeight:u=0,defaultWidth:l=0,dir:f,gridRef:v,onCellsRendered:o,onResize:h,overscanCount:d=3,rowCount:g,rowHeight:p,rowKey:w,style:b,tagName:S="div",...R}){const T=le(t),H=c.useMemo(()=>c.memo(e,ae),[e]),[I,q]=c.useState(null),m=ve(I,f),{getCellBounds:G,getEstimatedSize:x,startIndexOverscan:O,startIndexVisible:V,scrollToIndex:y,stopIndexOverscan:M,stopIndexVisible:B}=K({containerElement:I,containerStyle:b,defaultContainerSize:l,direction:"horizontal",isRtl:m,itemCount:n,itemProps:T,itemSize:a,onResize:h,overscanCount:d}),{getCellBounds:k,getEstimatedSize:E,startIndexOverscan:L,startIndexVisible:X,scrollToIndex:J,stopIndexOverscan:_,stopIndexVisible:te}=K({containerElement:I,containerStyle:b,defaultContainerSize:u,direction:"vertical",itemCount:g,itemProps:T,itemSize:p,onResize:h,overscanCount:d});c.useImperativeHandle(v,()=>({get element(){return I},scrollToCell({behavior:W="auto",columnAlign:z="auto",columnIndex:j,rowAlign:F="auto",rowIndex:$}){const N=y({align:z,containerScrollOffset:I?.scrollLeft??0,index:j}),de=J({align:F,containerScrollOffset:I?.scrollTop??0,index:$});typeof I?.scrollTo=="function"&&I.scrollTo({behavior:W,left:N,top:de})},scrollToColumn({align:W="auto",behavior:z="auto",index:j}){const F=y({align:W,containerScrollOffset:I?.scrollLeft??0,index:j});typeof I?.scrollTo=="function"&&I.scrollTo({behavior:z,left:F})},scrollToRow({align:W="auto",behavior:z="auto",index:j}){const F=J({align:W,containerScrollOffset:I?.scrollTop??0,index:j});typeof I?.scrollTo=="function"&&I.scrollTo({behavior:z,top:F})}}),[I,y,J]),c.useEffect(()=>{O>=0&&M>=0&&L>=0&&_>=0&&o&&o({columnStartIndex:V,columnStopIndex:B,rowStartIndex:X,rowStopIndex:te},{columnStartIndex:O,columnStopIndex:M,rowStartIndex:L,rowStopIndex:_})},[o,O,V,M,B,L,X,_,te]);const ue=c.useMemo(()=>{const W=[];if(n>0&&g>0)for(let z=L;z<=_;z++){const j=k(z),F=[];for(let $=O;$<=M;$++){const N=G($);F.push(c.createElement(H,{...T,ariaAttributes:{"aria-colindex":$+1,role:"gridcell"},columnIndex:$,key:i?i({columnIndex:$,data:T,rowIndex:z}):$,rowIndex:z,style:{position:"absolute",left:m?void 0:0,right:m?0:void 0,transform:`translate(${m?-N.scrollOffset:N.scrollOffset}px, ${j.scrollOffset}px)`,height:j.size,width:N.size}}))}W.push(P.jsx("div",{role:"row","aria-rowindex":z+1,children:F},w?w({data:T,rowIndex:z}):z))}return W},[H,T,n,i,O,M,G,k,m,g,w,L,_]),fe=P.jsx("div",{"aria-hidden":!0,style:{height:E(),width:x(),zIndex:-1}});return c.createElement(S,{"aria-colcount":n,"aria-rowcount":g,role:"grid",...R,className:r,dir:f,ref:q,style:{position:"relative",maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...b}},ue,s,fe)}const Oe=c.useState,ze=c.useRef;function Se(e){return e!=null&&typeof e=="object"&&"getAverageRowHeight"in e&&typeof e.getAverageRowHeight=="function"}function ye({element:e,getCellBounds:t,isDynamicRowHeight:s,rowCount:r,rowElements:n,scrollToIndex:i}){const a=c.useRef(null),u=c.useRef(void 0),l=D(()=>{a.current=null,u.current!==void 0&&(u.current.view.cancelAnimationFrame(u.current.id),u.current=void 0)}),f=D(()=>{const o=ee(e);u.current={id:o.requestAnimationFrame(v),view:o}}),v=D(()=>{u.current=void 0;const o=a.current;if(!o)return;if(!e||!s||o.index>=r||performance.now()>=o.deadline){l();return}const h=i({align:o.align,containerScrollOffset:e.scrollTop,index:o.index});if(h!==void 0){const d=Math.max(0,Math.min(h,e.scrollHeight-e.clientHeight));if(Math.abs(d-e.scrollTop)>1)o.stableFrames=0,e.scrollTo({behavior:"instant",top:d});else{const g=n.current;if(!(g.some(b=>b.getAttribute(Y)===`${o.index}`)&&g.every(b=>{const S=Number(b.getAttribute(Y));return Math.abs(t(S).size-b.offsetHeight)<=1})))o.stableFrames=0;else if(++o.stableFrames>=2){l();return}}}f()});return U(()=>{if(!e)return;const o=h=>{switch(h.key){case"ArrowUp":case"ArrowDown":case"PageUp":case"PageDown":case"Home":case"End":case" ":l()}};return e.addEventListener("wheel",l,{passive:!0}),e.addEventListener("touchstart",l,{passive:!0}),e.addEventListener("pointerdown",l),e.addEventListener("keydown",o),()=>{l(),e.removeEventListener("wheel",l),e.removeEventListener("touchstart",l),e.removeEventListener("pointerdown",l),e.removeEventListener("keydown",o)}},[l,e]),c.useCallback(({align:o="auto",behavior:h="auto",index:d})=>{s&&o==="smart"&&(o=i({align:"auto",containerScrollOffset:e?.scrollTop??0,index:d})===(e?.scrollTop??0)?"auto":"center");const g=i({align:o,containerScrollOffset:e?.scrollTop??0,index:d});l(),typeof e?.scrollTo=="function"&&(s&&(a.current={align:o,index:d,deadline:performance.now()+1e3,stableFrames:0},f()),e.scrollTo({behavior:s?"instant":h,top:g}))},[l,e,s,f,i])}const Y="data-react-window-index",ne="data-react-window-sizer";function Me({children:e,className:t,defaultHeight:s=0,listRef:r,onResize:n,onRowsRendered:i,overscanCount:a=3,rowComponent:u,rowCount:l,rowHeight:f,rowKey:v,rowProps:o,tagName:h="div",style:d,...g}){const p=le(o),w=c.useMemo(()=>c.memo(u,ae),[u]),[b,S]=c.useState(null),R=Se(f),T=c.useMemo(()=>R?k=>f.getRowHeight(k)??f.getAverageRowHeight():f,[R,f]),{getCellBounds:H,getEstimatedSize:I,scrollToIndex:q,startIndexOverscan:m,startIndexVisible:G,stopIndexOverscan:x,stopIndexVisible:O}=K({containerElement:b,containerStyle:d,defaultContainerSize:s,direction:"vertical",itemCount:l,itemProps:p,itemSize:T,onResize:n,overscanCount:a}),V=c.useRef([]),y=ye({element:b,getCellBounds:H,isDynamicRowHeight:R,rowCount:l,rowElements:V,scrollToIndex:q});c.useImperativeHandle(r,()=>({get element(){return b},scrollToRow:y}),[b,y]),U(()=>{if(!b)return;const k=Array.from(b.children).slice(0,m<0?0:x-m+1).filter((E,L)=>{if(E.hasAttribute(ne))return!1;const X=`${m+L}`;return E.setAttribute(Y,X),!0});if(V.current=k,R)return f.observeRowElements(k)},[w,b,R,l,f,v,p,m,x]),c.useEffect(()=>{m>=0&&x>=0&&i&&i({startIndex:G,stopIndex:O},{startIndex:m,stopIndex:x})},[i,m,G,x,O]);const M=c.useMemo(()=>{const k=[];if(l>0)for(let E=m;E<=x;E++){const L=H(E);k.push(c.createElement(w,{...p,ariaAttributes:{"aria-posinset":E+1,"aria-setsize":l,role:"listitem"},key:v?v(E,p):E,index:E,style:{position:"absolute",left:0,transform:`translateY(${L.scrollOffset}px)`,height:R?void 0:L.size,width:"100%"}}))}return k},[w,H,R,l,v,p,m,x]),B=P.jsx("div",{"aria-hidden":!0,[ne]:"",style:{height:I(),width:"100%",zIndex:-1}});return c.createElement(h,{role:"list",...g,className:t,ref:S,style:{position:"relative",maxHeight:"100%",flexGrow:1,overflowY:"auto",...d}},M,e,B)}function Ee({defaultRowHeight:e,key:t}){const[s,r]=c.useState({key:t,map:new Map});s.key!==t&&r({key:t,map:new Map});const{map:n}=s,i=c.useCallback(()=>{let o=0;return n.forEach(h=>{o+=h}),o===0?e:o/n.size},[e,n]),a=c.useCallback(o=>{const h=n.get(o);return h!==void 0?h:e},[e,n]),u=c.useCallback((o,h)=>{r(d=>{if(d.map.get(o)===h)return d;const g=new Map(d.map);return g.set(o,h),{...d,map:g}})},[]),l=D(o=>{o.length!==0&&o.forEach(h=>{const{borderBoxSize:d,target:g}=h,p=g.getAttribute(Y);A(p!==null,`Invalid ${Y} attribute value`);const w=parseInt(p),{blockSize:b}=d[0];b&&u(w,b)})}),f=c.useRef(null);c.useEffect(()=>()=>{f.current?.resizeObserver.disconnect(),f.current=null},[]);const v=c.useCallback(o=>{const h=[];return o.forEach(d=>{const g=ee(d);if(f.current?.view!==g){f.current?.resizeObserver.disconnect();const w=ie(d);f.current=w?{resizeObserver:new w(l),view:g}:null}const p=f.current?.resizeObserver;p&&(p.observe(d),h.push([d,p]))}),()=>{h.forEach(([d,g])=>g.unobserve(d))}},[l]);return c.useMemo(()=>({getAverageRowHeight:i,getRowHeight:a,setRowHeight:u,observeRowElements:v}),[i,a,u,v])}const Re=c.useState,Te=c.useRef,oe=new WeakMap;function ke(e=!1,t=document){let s=oe.get(t);if(s===void 0||e){const r=t.createElement("div"),n=r.style;n.width="50px",n.height="50px",n.overflow="scroll",t.body.appendChild(r),s=r.offsetWidth-r.clientWidth,t.body.removeChild(r),oe.set(t,s)}return s}exports.Grid=me;exports.List=Me;exports.getScrollbarSize=ke;exports.useDynamicRowHeight=Ee;exports.useGridCallbackRef=Oe;exports.useGridRef=ze;exports.useListCallbackRef=Re;exports.useListRef=Te;
|
|
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/isDynamicRowHeight.ts","../lib/components/list/useScrollToRow.ts","../lib/components/list/List.tsx","../lib/components/list/useDynamicRowHeight.ts","../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 (dir) {\n setValue(dir === \"rtl\");\n } else if (element) {\n setValue(isRtl(element));\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 | undefined;\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 extends unknown[], Return>(\n fn: (...args: Args) => Return\n): (...args: Args) => Return;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined {\n const ref = useRef<typeof fn>(() => {\n // This error ensures components don't render with previous/stale function\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, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollOffset;\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.hasOwn(b, key) || !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 if (index < 0 || index >= itemCount) {\n throw RangeError(`Invalid index specified: ${index}`, {\n cause: `Index ${index} is not within the range of 0 - ${itemCount - 1}`\n });\n }\n\n // Populate the target bounds before estimating the total from cached sizes.\n const bounds = cachedBounds.get(index);\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\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 // Visibility depends on the row itself, not the estimated scroll extent.\n // For oversized rows, leave the offset alone when the row fills the viewport.\n const isVisible =\n bounds.size > containerSize\n ? containerScrollOffset >= bounds.scrollOffset &&\n containerScrollOffset <= minOffset\n : containerScrollOffset >= minOffset &&\n containerScrollOffset <= bounds.scrollOffset;\n\n if (align === \"smart\") {\n align = isVisible ? \"auto\" : \"center\";\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n return Math.max(\n 0,\n Math.min(\n estimatedTotalSize - containerSize,\n bounds.scrollOffset + bounds.size / 2 - containerSize / 2\n )\n );\n }\n case \"auto\":\n default: {\n if (isVisible) {\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 if (itemCount === 0) {\n return {\n startIndexVisible: 0,\n stopIndexVisible: -1,\n startIndexOverscan: 0,\n stopIndexOverscan: -1\n };\n }\n\n let startIndexVisible: number;\n let stopIndexVisible: number;\n const { itemSize } = cachedBounds;\n\n if (itemSize !== undefined && itemSize > 0) {\n startIndexVisible = Math.max(\n 0,\n Math.min(maxIndex, Math.floor(containerScrollOffset / itemSize))\n );\n stopIndexVisible = Math.max(\n startIndexVisible,\n Math.min(\n maxIndex,\n Math.ceil((containerScrollOffset + containerSize) / itemSize) - 1\n )\n );\n } else {\n // Search the measured prefix first. Grow the search exponentially only\n // when scrolling beyond it, so an initial render doesn't measure the list.\n let low = 0;\n let high = Math.min(maxIndex, Math.max(0, cachedBounds.size - 1));\n let step = 1;\n while (high < maxIndex) {\n const bounds = cachedBounds.get(high);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) break;\n low = high + 1;\n high = Math.min(maxIndex, high + step);\n step *= 2;\n }\n\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const bounds = cachedBounds.get(middle);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n high = middle;\n } else {\n low = middle + 1;\n }\n }\n\n startIndexVisible = low;\n stopIndexVisible = low;\n while (stopIndexVisible < maxIndex) {\n const bounds = cachedBounds.get(stopIndexVisible);\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n )\n break;\n stopIndexVisible++;\n }\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan: Math.max(0, startIndexVisible - overscanCount),\n stopIndexOverscan: Math.min(maxIndex, stopIndexVisible + overscanCount)\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 itemSize: typeof itemSize === \"number\" ? itemSize : undefined,\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n if (typeof itemSize === \"number\") {\n assert(index >= 0, `Invalid index ${index}`);\n let bounds = cache.get(index);\n if (bounds === undefined) {\n bounds = { size: itemSize, scrollOffset: index * itemSize };\n cache.set(index, bounds);\n }\n return bounds;\n }\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n const size = itemSize(currentIndex, itemProps);\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 * parseFloat(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 { 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 [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>(() =>\n getStartStopIndicesUtil({\n cachedBounds,\n // TODO Potentially support a defaultScrollOffset prop?\n containerScrollOffset: 0,\n containerSize,\n itemCount,\n overscanCount\n })\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 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 isRtl,\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: adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: containerScrollOffset\n }),\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 { useState } from \"react\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n const [memoizedObject, setMemoizedObject] = useState(unstableObject);\n\n if (!shallowCompare(memoizedObject, unstableObject)) {\n setMemoizedObject(unstableObject);\n\n return unstableObject;\n }\n\n return memoizedObject;\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","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactElement,\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\n/**\n * Renders data with many rows and columns.\n *\n * ℹ️ Unlike `List` rows, `Grid` cell sizes must be known ahead of time.\n * Either static sizes or something that can be derived (from the data in `CellProps`) without rendering.\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 columnKey,\n columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n rowKey,\n style,\n tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>): ReactElement {\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 containerStyle: style,\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 containerStyle: style,\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={\n columnKey\n ? columnKey({\n columnIndex,\n data: cellProps,\n rowIndex\n })\n : columnIndex\n }\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\n key={\n rowKey\n ? rowKey({\n data: cellProps,\n rowIndex\n })\n : rowIndex\n }\n role=\"row\"\n aria-rowindex={rowIndex + 1}\n >\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnKey,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowKey,\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 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 type { DynamicRowHeight } from \"./types\";\n\nexport function isDynamicRowHeight(value: unknown): value is DynamicRowHeight {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"getAverageRowHeight\" in value &&\n typeof value.getAverageRowHeight === \"function\"\n );\n}\n","import { useCallback, useRef, type RefObject } from \"react\";\nimport type { Bounds } from \"../../core/types\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport type { Align } from \"../../types\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { ListImperativeAPI } from \"./types\";\n\nexport function useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n}: {\n element: HTMLDivElement | null;\n getCellBounds: (index: number) => Bounds;\n isDynamicRowHeight: boolean;\n rowCount: number;\n rowElements: RefObject<Element[]>;\n scrollToIndex: (options: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => number | undefined;\n}): ListImperativeAPI[\"scrollToRow\"] {\n const pendingScroll = useRef<{\n align: Align;\n index: number;\n deadline: number;\n stableFrames: number;\n } | null>(null);\n\n const scrollFrame = useRef<number | undefined>(undefined);\n\n const cancelScroll = useStableCallback(() => {\n pendingScroll.current = null;\n if (scrollFrame.current !== undefined) {\n cancelAnimationFrame(scrollFrame.current);\n scrollFrame.current = undefined;\n }\n });\n\n const correctScroll = useStableCallback(() => {\n scrollFrame.current = undefined;\n const request = pendingScroll.current;\n if (!request) return;\n\n if (\n !element ||\n !isDynamicRowHeight ||\n request.index >= rowCount ||\n performance.now() >= request.deadline\n ) {\n cancelScroll();\n return;\n }\n\n const offset = scrollToIndex({\n align: request.align,\n containerScrollOffset: element.scrollTop,\n index: request.index\n });\n if (offset !== undefined) {\n // Use the committed DOM extent: the browser clamps offsets near the end.\n const top = Math.max(\n 0,\n Math.min(offset, element.scrollHeight - element.clientHeight)\n );\n if (Math.abs(top - element.scrollTop) > 1) {\n request.stableFrames = 0;\n element.scrollTo({ behavior: \"instant\", top });\n } else {\n // An unchanged estimated offset is not enough:\n // React may not have committed the destination rows or their ResizeObserver updates yet.\n const rows = rowElements.current;\n const targetIsRendered = rows.some(\n (row) =>\n row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX) === `${request.index}`\n );\n const measurementsCommitted =\n targetIsRendered &&\n rows.every((row) => {\n const index = Number(row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX));\n // ResizeObserver reports untransformed border-box sizes.\n // offsetHeight uses the same coordinate space; allow for its integer rounding.\n return (\n Math.abs(\n getCellBounds(index).size - (row as HTMLElement).offsetHeight\n ) <= 1\n );\n });\n if (!measurementsCommitted) {\n request.stableFrames = 0;\n } else if (++request.stableFrames >= 2) {\n cancelScroll();\n return;\n }\n }\n }\n scrollFrame.current = requestAnimationFrame(correctScroll);\n });\n\n useIsomorphicLayoutEffect(() => {\n if (!element) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n case \" \": {\n cancelScroll();\n }\n }\n };\n\n element.addEventListener(\"wheel\", cancelScroll, { passive: true });\n element.addEventListener(\"touchstart\", cancelScroll, { passive: true });\n element.addEventListener(\"pointerdown\", cancelScroll);\n element.addEventListener(\"keydown\", onKeyDown);\n\n return () => {\n cancelScroll();\n\n element.removeEventListener(\"wheel\", cancelScroll);\n element.removeEventListener(\"touchstart\", cancelScroll);\n element.removeEventListener(\"pointerdown\", cancelScroll);\n element.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [cancelScroll, element]);\n\n return useCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: Parameters<ListImperativeAPI[\"scrollToRow\"]>[0]) => {\n // Resolve smart alignment once, before measurements move the target.\n if (isDynamicRowHeight && align === \"smart\") {\n const autoOffset = scrollToIndex({\n align: \"auto\",\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n align = autoOffset === (element?.scrollTop ?? 0) ? \"auto\" : \"center\";\n }\n\n const top = scrollToIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n cancelScroll();\n\n if (typeof element?.scrollTo === \"function\") {\n if (isDynamicRowHeight) {\n pendingScroll.current = {\n align,\n index,\n deadline: performance.now() + 1000,\n stableFrames: 0\n };\n scrollFrame.current = requestAnimationFrame(correctScroll);\n }\n element.scrollTo({\n behavior: isDynamicRowHeight ? \"instant\" : behavior,\n top\n });\n }\n },\n [cancelScroll, correctScroll, element, isDynamicRowHeight, scrollToIndex]\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\nimport { useScrollToRow } from \"./useScrollToRow\";\n\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\n\n/**\n * Renders data with many rows.\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: rowHeightProp,\n rowKey,\n rowProps: rowPropsUnstable,\n tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>): ReactElement {\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 isDynamicRowHeight = isDynamicRowHeightUtil(rowHeightProp);\n\n const rowHeight = useMemo(() => {\n if (isDynamicRowHeight) {\n return (index: number) => {\n return (\n rowHeightProp.getRowHeight(index) ??\n rowHeightProp.getAverageRowHeight()\n );\n };\n }\n\n return rowHeightProp;\n }, [isDynamicRowHeight, rowHeightProp]);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n const rowElements = useRef<Element[]>([]);\n const scrollToRow = useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n scrollToRow\n }),\n [element, scrollToRow]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n // Additional children (e.g. overlays) are not rows and must not be measured.\n const rows = Array.from(element.children)\n .slice(\n 0,\n startIndexOverscan < 0 ? 0 : stopIndexOverscan - startIndexOverscan + 1\n )\n .filter((item, index) => {\n if (item.hasAttribute(\"aria-hidden\")) {\n // Ignore sizing element\n return false;\n }\n\n const attribute = `${startIndexOverscan + index}`;\n item.setAttribute(DATA_ATTRIBUTE_LIST_INDEX, attribute);\n\n return true;\n });\n\n rowElements.current = rows;\n\n if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n RowComponent,\n element,\n isDynamicRowHeight,\n rowCount,\n rowHeightProp,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\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={rowKey ? rowKey(index, rowProps) : index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n // In case of dynamic row heights, don't specify a height style\n // otherwise a default/estimated height would mask the actual height\n height: isDynamicRowHeight ? undefined : bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [\n RowComponent,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowKey,\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 { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { assert } from \"../../utils/assert\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { DynamicRowHeight } from \"./types\";\n\nexport function useDynamicRowHeight({\n defaultRowHeight,\n key\n}: {\n defaultRowHeight: number;\n key?: string | number;\n}) {\n const [state, setState] = useState<{\n key: string | number | undefined;\n map: Map<number, number>;\n }>({\n key,\n map: new Map()\n });\n\n if (state.key !== key) {\n setState({\n key,\n map: new Map()\n });\n }\n\n const { map } = state;\n\n const getAverageRowHeight = useCallback(() => {\n let totalHeight = 0;\n\n map.forEach((height) => {\n totalHeight += height;\n });\n\n if (totalHeight === 0) {\n return defaultRowHeight;\n }\n\n return totalHeight / map.size;\n }, [defaultRowHeight, map]);\n\n const getRowHeight = useCallback(\n (index: number) => {\n const measuredHeight = map.get(index);\n if (measuredHeight !== undefined) {\n return measuredHeight;\n }\n\n // Keep estimates stable when rowProps change (see issue #863), but do not\n // store them as measurements or include them in the measured average.\n return defaultRowHeight;\n },\n [defaultRowHeight, map]\n );\n\n const setRowHeight = useCallback((index: number, size: number) => {\n setState((prevState) => {\n if (prevState.map.get(index) === size) {\n return prevState;\n }\n\n const clonedMap = new Map(prevState.map);\n clonedMap.set(index, size);\n\n return {\n ...prevState,\n map: clonedMap\n };\n });\n }, []);\n\n const resizeObserverCallback = useStableCallback(\n (entries: ResizeObserverEntry[]) => {\n if (entries.length === 0) {\n return;\n }\n\n entries.forEach((entry) => {\n const { borderBoxSize, target } = entry;\n\n const attribute = target.getAttribute(DATA_ATTRIBUTE_LIST_INDEX);\n assert(\n attribute !== null,\n `Invalid ${DATA_ATTRIBUTE_LIST_INDEX} attribute value`\n );\n\n const index = parseInt(attribute);\n\n const { blockSize: height } = borderBoxSize[0];\n if (!height) {\n // Ignore heights that have not yet been measured (e.g. <img> elements that have not yet loaded)\n return;\n }\n\n setRowHeight(index, height);\n });\n }\n );\n\n const [resizeObserver] = useState(() => {\n if (typeof ResizeObserver !== \"undefined\") {\n return new ResizeObserver(resizeObserverCallback);\n }\n });\n\n useEffect(() => {\n if (resizeObserver) {\n return () => {\n resizeObserver.disconnect();\n };\n }\n }, [resizeObserver]);\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n if (resizeObserver) {\n elements.forEach((element) => resizeObserver.observe(element));\n return () => {\n elements.forEach((element) => resizeObserver.unobserve(element));\n };\n }\n return () => {};\n },\n [resizeObserver]\n );\n\n return useMemo<DynamicRowHeight>(\n () => ({\n getAverageRowHeight,\n getRowHeight,\n setRowHeight,\n observeRowElements\n }),\n [getAverageRowHeight, getRowHeight, setRowHeight, observeRowElements]\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","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","isVisible","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","low","high","step","middle","createCachedBounds","itemProps","cache","currentIndex","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","height","width","prevSizeRef","prevSize","getCellBounds","indices","setIndices","getStartStopIndicesUtil","startIndexOverscan","stopIndexOverscan","getEstimatedSizeUtil","onScroll","prev","scrollLeft","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","memoizedObject","setMemoizedObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnKey","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rowKey","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","isDynamicRowHeight","useScrollToRow","rowElements","pendingScroll","scrollFrame","cancelScroll","correctScroll","request","offset","rows","row","DATA_ATTRIBUTE_LIST_INDEX","onKeyDown","event","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","scrollToRow","item","attribute","useDynamicRowHeight","defaultRowHeight","map","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","observeRowElements","elements","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"sJAAO,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,CAChBJ,EACFE,EAASF,IAAQ,KAAK,EACbH,GACTK,EAASN,GAAMC,CAAO,CAAC,CAE3B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CChBO,MAAMI,EACX,OAAO,OAAW,IAAcD,EAAAA,gBAAkBE,EAAAA,UCD7C,SAASC,GACdN,EACoB,CACpB,GAAIA,IAAU,OACZ,OAAQ,OAAOA,EAAA,CACb,IAAK,SACH,OAAOA,EAET,IAAK,SAAU,CACb,GAAIA,EAAM,SAAS,IAAI,EACrB,OAAO,WAAWA,CAAK,EAEzB,KACF,CAAA,CAGN,CCdO,SAASO,GAAkB,CAChC,IAAAC,EACA,cAAAC,EAC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C9B,MAAMiL,EAAM,SAAS,cAAc,KAAK,EAClCtM,EAAQsM,EAAI,MAClBtM,EAAM,MAAQ,OACdA,EAAM,OAAS,OACfA,EAAM,SAAW,SAEjB,SAAS,KAAK,YAAYsM,CAAG,EAE7BnI,EAAOmI,EAAI,YAAcA,EAAI,YAE7B,SAAS,KAAK,YAAYA,CAAG,CAC/B,CAEA,OAAOnI,CACT"}
|
|
1
|
+
{"version":3,"file":"react-window.cjs","sources":["../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/getOwnerWindow.ts","../lib/utils/getResizeObserverClass.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/isDynamicRowHeight.ts","../lib/components/list/useScrollToRow.ts","../lib/components/list/List.tsx","../lib/components/list/useDynamicRowHeight.ts","../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 (dir) {\n setValue(dir === \"rtl\");\n } else if (element) {\n setValue(isRtl(element));\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","export function getOwnerWindow(\n element: Element | null | undefined\n): Window & typeof globalThis {\n return element?.ownerDocument.defaultView ?? window;\n}\n","import { getOwnerWindow } from \"./getOwnerWindow\";\n\nexport function getResizeObserverClass(\n element: Element\n): typeof ResizeObserver | undefined {\n return (\n getOwnerWindow(element).ResizeObserver ??\n (typeof ResizeObserver !== \"undefined\" ? ResizeObserver : undefined)\n );\n}\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 { getResizeObserverClass } from \"../utils/getResizeObserverClass\";\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 | undefined;\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 ResizeObserverClass = getResizeObserverClass(element);\n if (!ResizeObserverClass) {\n return;\n }\n\n const resizeObserver = new ResizeObserverClass((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 extends unknown[], Return>(\n fn: (...args: Args) => Return\n): (...args: Args) => Return;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined {\n const ref = useRef<typeof fn>(() => {\n // This error ensures components don't render with previous/stale function\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\n// Cache per document, since each window is probed separately\nconst cache = new WeakMap<Document, RTLOffsetType>();\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(\n recalculate: boolean = false,\n ownerDocument: Document = document\n): RTLOffsetType {\n let cachedRTLResult = cache.get(ownerDocument);\n if (cachedRTLResult === undefined || recalculate) {\n const outerDiv = ownerDocument.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 = ownerDocument.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n ownerDocument.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 ownerDocument.body.removeChild(outerDiv);\n\n cache.set(ownerDocument, 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 (\n getRTLOffsetType(false, containerElement?.ownerDocument ?? document)\n ) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollOffset;\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.hasOwn(b, key) || !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 if (index < 0 || index >= itemCount) {\n throw RangeError(`Invalid index specified: ${index}`, {\n cause: `Index ${index} is not within the range of 0 - ${itemCount - 1}`\n });\n }\n\n // Populate the target bounds before estimating the total from cached sizes.\n const bounds = cachedBounds.get(index);\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\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 // Visibility depends on the row itself, not the estimated scroll extent.\n // For oversized rows, leave the offset alone when the row fills the viewport.\n const isVisible =\n bounds.size > containerSize\n ? containerScrollOffset >= bounds.scrollOffset &&\n containerScrollOffset <= minOffset\n : containerScrollOffset >= minOffset &&\n containerScrollOffset <= bounds.scrollOffset;\n\n if (align === \"smart\") {\n align = isVisible ? \"auto\" : \"center\";\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n return Math.max(\n 0,\n Math.min(\n estimatedTotalSize - containerSize,\n bounds.scrollOffset + bounds.size / 2 - containerSize / 2\n )\n );\n }\n case \"auto\":\n default: {\n if (isVisible) {\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 if (itemCount === 0) {\n return {\n startIndexVisible: 0,\n stopIndexVisible: -1,\n startIndexOverscan: 0,\n stopIndexOverscan: -1\n };\n }\n\n let startIndexVisible: number;\n let stopIndexVisible: number;\n const { itemSize } = cachedBounds;\n\n if (itemSize !== undefined && itemSize > 0) {\n startIndexVisible = Math.max(\n 0,\n Math.min(maxIndex, Math.floor(containerScrollOffset / itemSize))\n );\n stopIndexVisible = Math.max(\n startIndexVisible,\n Math.min(\n maxIndex,\n Math.ceil((containerScrollOffset + containerSize) / itemSize) - 1\n )\n );\n } else {\n // Binary search the measured prefix\n let low = 0;\n let high = Math.min(maxIndex, Math.max(0, cachedBounds.size - 1));\n\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const bounds = cachedBounds.get(middle);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n high = middle;\n } else {\n low = middle + 1;\n }\n }\n\n // Extend sequentially beyond the measured prefix to avoid evaluating item sizes past the viewport\n while (low < maxIndex) {\n const bounds = cachedBounds.get(low);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) break;\n low++;\n }\n\n startIndexVisible = low;\n stopIndexVisible = low;\n while (stopIndexVisible < maxIndex) {\n const bounds = cachedBounds.get(stopIndexVisible);\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n )\n break;\n stopIndexVisible++;\n }\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan: Math.max(0, startIndexVisible - overscanCount),\n stopIndexOverscan: Math.min(maxIndex, stopIndexVisible + overscanCount)\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 itemSize: typeof itemSize === \"number\" ? itemSize : undefined,\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n if (typeof itemSize === \"number\") {\n assert(index >= 0, `Invalid index ${index}`);\n let bounds = cache.get(index);\n if (bounds === undefined) {\n bounds = { size: itemSize, scrollOffset: index * itemSize };\n cache.set(index, bounds);\n }\n return bounds;\n }\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n const size = itemSize(currentIndex, itemProps);\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 * parseFloat(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 { 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 [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>(() =>\n getStartStopIndicesUtil({\n cachedBounds,\n // TODO Potentially support a defaultScrollOffset prop?\n containerScrollOffset: 0,\n containerSize,\n itemCount,\n overscanCount\n })\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 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 isRtl,\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: adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: containerScrollOffset\n }),\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 { useState } from \"react\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n const [memoizedObject, setMemoizedObject] = useState(unstableObject);\n\n if (!shallowCompare(memoizedObject, unstableObject)) {\n setMemoizedObject(unstableObject);\n\n return unstableObject;\n }\n\n return memoizedObject;\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","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactElement,\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\n/**\n * Renders data with many rows and columns.\n *\n * ℹ️ Unlike `List` rows, `Grid` cell sizes must be known ahead of time.\n * Either static sizes or something that can be derived (from the data in `CellProps`) without rendering.\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 columnKey,\n columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n rowKey,\n style,\n tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>): ReactElement {\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 containerStyle: style,\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 containerStyle: style,\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={\n columnKey\n ? columnKey({\n columnIndex,\n data: cellProps,\n rowIndex\n })\n : columnIndex\n }\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\n key={\n rowKey\n ? rowKey({\n data: cellProps,\n rowIndex\n })\n : rowIndex\n }\n role=\"row\"\n aria-rowindex={rowIndex + 1}\n >\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnKey,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowKey,\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 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 type { DynamicRowHeight } from \"./types\";\n\nexport function isDynamicRowHeight(value: unknown): value is DynamicRowHeight {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"getAverageRowHeight\" in value &&\n typeof value.getAverageRowHeight === \"function\"\n );\n}\n","import { useCallback, useRef, type RefObject } from \"react\";\nimport type { Bounds } from \"../../core/types\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { getOwnerWindow } from \"../../utils/getOwnerWindow\";\nimport type { Align } from \"../../types\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { ListImperativeAPI } from \"./types\";\n\nexport function useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n}: {\n element: HTMLDivElement | null;\n getCellBounds: (index: number) => Bounds;\n isDynamicRowHeight: boolean;\n rowCount: number;\n rowElements: RefObject<Element[]>;\n scrollToIndex: (options: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => number | undefined;\n}): ListImperativeAPI[\"scrollToRow\"] {\n const pendingScroll = useRef<{\n align: Align;\n index: number;\n deadline: number;\n stableFrames: number;\n } | null>(null);\n\n // Track the window that scheduled the frame so it can be cancelled there.\n const scrollFrame = useRef<{ id: number; view: Window } | undefined>(\n undefined\n );\n\n const cancelScroll = useStableCallback(() => {\n pendingScroll.current = null;\n if (scrollFrame.current !== undefined) {\n scrollFrame.current.view.cancelAnimationFrame(scrollFrame.current.id);\n scrollFrame.current = undefined;\n }\n });\n\n // Use the list's own window (e.g. a popup rendered into via a portal),\n // since another window's frames may be throttled while it's in the background.\n const scheduleCorrectScroll = useStableCallback(() => {\n const view = getOwnerWindow(element);\n scrollFrame.current = {\n id: view.requestAnimationFrame(correctScroll),\n view\n };\n });\n\n const correctScroll = useStableCallback(() => {\n scrollFrame.current = undefined;\n const request = pendingScroll.current;\n if (!request) return;\n\n if (\n !element ||\n !isDynamicRowHeight ||\n request.index >= rowCount ||\n performance.now() >= request.deadline\n ) {\n cancelScroll();\n return;\n }\n\n const offset = scrollToIndex({\n align: request.align,\n containerScrollOffset: element.scrollTop,\n index: request.index\n });\n if (offset !== undefined) {\n // Use the committed DOM extent: the browser clamps offsets near the end.\n const top = Math.max(\n 0,\n Math.min(offset, element.scrollHeight - element.clientHeight)\n );\n if (Math.abs(top - element.scrollTop) > 1) {\n request.stableFrames = 0;\n element.scrollTo({ behavior: \"instant\", top });\n } else {\n // An unchanged estimated offset is not enough:\n // React may not have committed the destination rows or their ResizeObserver updates yet.\n const rows = rowElements.current;\n const targetIsRendered = rows.some(\n (row) =>\n row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX) === `${request.index}`\n );\n const measurementsCommitted =\n targetIsRendered &&\n rows.every((row) => {\n const index = Number(row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX));\n // ResizeObserver reports untransformed border-box sizes.\n // offsetHeight uses the same coordinate space; allow for its integer rounding.\n return (\n Math.abs(\n getCellBounds(index).size - (row as HTMLElement).offsetHeight\n ) <= 1\n );\n });\n if (!measurementsCommitted) {\n request.stableFrames = 0;\n } else if (++request.stableFrames >= 2) {\n cancelScroll();\n return;\n }\n }\n }\n scheduleCorrectScroll();\n });\n\n useIsomorphicLayoutEffect(() => {\n if (!element) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n case \" \": {\n cancelScroll();\n }\n }\n };\n\n element.addEventListener(\"wheel\", cancelScroll, { passive: true });\n element.addEventListener(\"touchstart\", cancelScroll, { passive: true });\n element.addEventListener(\"pointerdown\", cancelScroll);\n element.addEventListener(\"keydown\", onKeyDown);\n\n return () => {\n cancelScroll();\n\n element.removeEventListener(\"wheel\", cancelScroll);\n element.removeEventListener(\"touchstart\", cancelScroll);\n element.removeEventListener(\"pointerdown\", cancelScroll);\n element.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [cancelScroll, element]);\n\n return useCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: Parameters<ListImperativeAPI[\"scrollToRow\"]>[0]) => {\n // Resolve smart alignment once, before measurements move the target.\n if (isDynamicRowHeight && align === \"smart\") {\n const autoOffset = scrollToIndex({\n align: \"auto\",\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n align = autoOffset === (element?.scrollTop ?? 0) ? \"auto\" : \"center\";\n }\n\n const top = scrollToIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n cancelScroll();\n\n if (typeof element?.scrollTo === \"function\") {\n if (isDynamicRowHeight) {\n pendingScroll.current = {\n align,\n index,\n deadline: performance.now() + 1000,\n stableFrames: 0\n };\n scheduleCorrectScroll();\n }\n element.scrollTo({\n behavior: isDynamicRowHeight ? \"instant\" : behavior,\n top\n });\n }\n },\n [\n cancelScroll,\n element,\n isDynamicRowHeight,\n scheduleCorrectScroll,\n scrollToIndex\n ]\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\nimport { useScrollToRow } from \"./useScrollToRow\";\n\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\nexport const DATA_ATTRIBUTE_SIZER = \"data-react-window-sizer\";\n\n/**\n * Renders data with many rows.\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: rowHeightProp,\n rowKey,\n rowProps: rowPropsUnstable,\n tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>): ReactElement {\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 isDynamicRowHeight = isDynamicRowHeightUtil(rowHeightProp);\n\n const rowHeight = useMemo(() => {\n if (isDynamicRowHeight) {\n return (index: number) => {\n return (\n rowHeightProp.getRowHeight(index) ??\n rowHeightProp.getAverageRowHeight()\n );\n };\n }\n\n return rowHeightProp;\n }, [isDynamicRowHeight, rowHeightProp]);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n const rowElements = useRef<Element[]>([]);\n const scrollToRow = useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n scrollToRow\n }),\n [element, scrollToRow]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n // Additional children (e.g. overlays) are not rows and must not be measured.\n const rows = Array.from(element.children)\n .slice(\n 0,\n startIndexOverscan < 0 ? 0 : stopIndexOverscan - startIndexOverscan + 1\n )\n .filter((item, index) => {\n if (item.hasAttribute(DATA_ATTRIBUTE_SIZER)) {\n // Ignore sizing element\n return false;\n }\n\n const attribute = `${startIndexOverscan + index}`;\n item.setAttribute(DATA_ATTRIBUTE_LIST_INDEX, attribute);\n\n return true;\n });\n\n rowElements.current = rows;\n\n if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n RowComponent,\n element,\n isDynamicRowHeight,\n rowCount,\n rowHeightProp,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\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={rowKey ? rowKey(index, rowProps) : index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n // In case of dynamic row heights, don't specify a height style\n // otherwise a default/estimated height would mask the actual height\n height: isDynamicRowHeight ? undefined : bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [\n RowComponent,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n {...{ [DATA_ATTRIBUTE_SIZER]: \"\" }}\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 { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { assert } from \"../../utils/assert\";\nimport { getOwnerWindow } from \"../../utils/getOwnerWindow\";\nimport { getResizeObserverClass } from \"../../utils/getResizeObserverClass\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { DynamicRowHeight } from \"./types\";\n\nexport function useDynamicRowHeight({\n defaultRowHeight,\n key\n}: {\n defaultRowHeight: number;\n key?: string | number;\n}) {\n const [state, setState] = useState<{\n key: string | number | undefined;\n map: Map<number, number>;\n }>({\n key,\n map: new Map()\n });\n\n if (state.key !== key) {\n setState({\n key,\n map: new Map()\n });\n }\n\n const { map } = state;\n\n const getAverageRowHeight = useCallback(() => {\n let totalHeight = 0;\n\n map.forEach((height) => {\n totalHeight += height;\n });\n\n if (totalHeight === 0) {\n return defaultRowHeight;\n }\n\n return totalHeight / map.size;\n }, [defaultRowHeight, map]);\n\n const getRowHeight = useCallback(\n (index: number) => {\n const measuredHeight = map.get(index);\n if (measuredHeight !== undefined) {\n return measuredHeight;\n }\n\n // Keep estimates stable when rowProps change (see issue #863), but do not\n // store them as measurements or include them in the measured average.\n return defaultRowHeight;\n },\n [defaultRowHeight, map]\n );\n\n const setRowHeight = useCallback((index: number, size: number) => {\n setState((prevState) => {\n if (prevState.map.get(index) === size) {\n return prevState;\n }\n\n const clonedMap = new Map(prevState.map);\n clonedMap.set(index, size);\n\n return {\n ...prevState,\n map: clonedMap\n };\n });\n }, []);\n\n const resizeObserverCallback = useStableCallback(\n (entries: ResizeObserverEntry[]) => {\n if (entries.length === 0) {\n return;\n }\n\n entries.forEach((entry) => {\n const { borderBoxSize, target } = entry;\n\n const attribute = target.getAttribute(DATA_ATTRIBUTE_LIST_INDEX);\n assert(\n attribute !== null,\n `Invalid ${DATA_ATTRIBUTE_LIST_INDEX} attribute value`\n );\n\n const index = parseInt(attribute);\n\n const { blockSize: height } = borderBoxSize[0];\n if (!height) {\n // Ignore heights that have not yet been measured (e.g. <img> elements that have not yet loaded)\n return;\n }\n\n setRowHeight(index, height);\n });\n }\n );\n\n // Rows may be rendered into another window (e.g. a popup rendered into via a portal),\n // and observers only report on elements in documents they belong to\n const resizeObserverRef = useRef<{\n resizeObserver: ResizeObserver;\n view: Window;\n } | null>(null);\n\n useEffect(\n () => () => {\n resizeObserverRef.current?.resizeObserver.disconnect();\n resizeObserverRef.current = null;\n },\n []\n );\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n const observed: [Element, ResizeObserver][] = [];\n\n elements.forEach((element) => {\n const view = getOwnerWindow(element);\n\n // Rows from one list share a window, so this only happens if the list moves to another window\n if (resizeObserverRef.current?.view !== view) {\n resizeObserverRef.current?.resizeObserver.disconnect();\n\n const ResizeObserverClass = getResizeObserverClass(element);\n resizeObserverRef.current = ResizeObserverClass\n ? {\n resizeObserver: new ResizeObserverClass(resizeObserverCallback),\n view\n }\n : null;\n }\n\n const resizeObserver = resizeObserverRef.current?.resizeObserver;\n if (resizeObserver) {\n resizeObserver.observe(element);\n observed.push([element, resizeObserver]);\n }\n });\n\n return () => {\n observed.forEach(([element, resizeObserver]) =>\n resizeObserver.unobserve(element)\n );\n };\n },\n [resizeObserverCallback]\n );\n\n return useMemo<DynamicRowHeight>(\n () => ({\n getAverageRowHeight,\n getRowHeight,\n setRowHeight,\n observeRowElements\n }),\n [getAverageRowHeight, getRowHeight, setRowHeight, observeRowElements]\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","// Cache per document, since windows may differ (e.g. custom scrollbar styles in a popup)\nconst cache = new WeakMap<Document, number>();\n\nexport function getScrollbarSize(\n recalculate: boolean = false,\n ownerDocument: Document = document\n): number {\n let size = cache.get(ownerDocument);\n if (size === undefined || recalculate) {\n const div = ownerDocument.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n ownerDocument.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n ownerDocument.body.removeChild(div);\n\n cache.set(ownerDocument, size);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(\n value: number,\n ownerDocument: Document = document\n) {\n cache.set(ownerDocument, value);\n}\n"],"names":["isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","useLayoutEffect","useIsomorphicLayoutEffect","useEffect","getOwnerWindow","getResizeObserverClass","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","ResizeObserverClass","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cache","getRTLOffsetType","recalculate","ownerDocument","cachedRTLResult","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","isVisible","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","low","high","middle","createCachedBounds","itemProps","currentIndex","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","height","width","prevSizeRef","prevSize","getCellBounds","indices","setIndices","getStartStopIndicesUtil","startIndexOverscan","stopIndexOverscan","getEstimatedSizeUtil","onScroll","prev","scrollLeft","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","memoizedObject","setMemoizedObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnKey","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rowKey","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","isDynamicRowHeight","useScrollToRow","rowElements","pendingScroll","scrollFrame","cancelScroll","scheduleCorrectScroll","view","correctScroll","request","offset","rows","row","DATA_ATTRIBUTE_LIST_INDEX","onKeyDown","event","DATA_ATTRIBUTE_SIZER","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","scrollToRow","item","attribute","useDynamicRowHeight","defaultRowHeight","map","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","resizeObserverRef","observeRowElements","elements","observed","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"qJAAO,SAASA,GAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,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AAkB,CAAA,CAExE,CC5JO,MAAMG,GACXtN,EAAAA,SCHWuN,GAAazL,EAAAA,OCLpBG,OAAY,QAEX,SAASuL,GACdrL,EAAuB,GACvBC,EAA0B,SAClB,CACR,IAAI6C,EAAOhD,GAAM,IAAIG,CAAa,EAClC,GAAI6C,IAAS,QAAa9C,EAAa,CACrC,MAAMsL,EAAMrL,EAAc,cAAc,KAAK,EACvCvB,EAAQ4M,EAAI,MAClB5M,EAAM,MAAQ,OACdA,EAAM,OAAS,OACfA,EAAM,SAAW,SAEjBuB,EAAc,KAAK,YAAYqL,CAAG,EAElCxI,EAAOwI,EAAI,YAAcA,EAAI,YAE7BrL,EAAc,KAAK,YAAYqL,CAAG,EAElCxL,GAAM,IAAIG,EAAe6C,CAAI,CAC/B,CAEA,OAAOA,CACT"}
|
package/dist/react-window.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare type ForbiddenKeys = "ariaAttributes" | "columnIndex" | "rowIndex" | "st
|
|
|
33
33
|
|
|
34
34
|
declare type ForbiddenKeys_2 = "ariaAttributes" | "index" | "style";
|
|
35
35
|
|
|
36
|
-
export declare function getScrollbarSize(recalculate?: boolean): number;
|
|
36
|
+
export declare function getScrollbarSize(recalculate?: boolean, ownerDocument?: Document): number;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Renders data with many rows and columns.
|