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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react");var G={exports:{}},D={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ee;function fe(){if(ee)return D;ee=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,r,s){var c=null;if(s!==void 0&&(c=""+s),r.key!==void 0&&(c=""+r.key),"key"in r){s={};for(var u in r)u!=="key"&&(s[u]=r[u])}else s=r;return r=s.ref,{$$typeof:i,type:o,key:c,ref:r!==void 0?r:null,props:s}}return D.Fragment=t,D.jsx=n,D.jsxs=n,D}var U={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var te;function he(){return te||(te=1,process.env.NODE_ENV!=="production"&&function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===C?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case v:return"Profiler";case y:return"StrictMode";case k:return"Suspense";case h:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case w:return"Portal";case M:return(e.displayName||"Context")+".Provider";case A:return(e._context.displayName||"Context")+".Consumer";case W:var l=e.render;return e=e.displayName,e||(e=l.displayName||l.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case E:return l=e.displayName||null,l!==null?l:i(e.type)||"Memo";case N:l=e._payload,e=e._init;try{return i(e(l))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var l=!1}catch{l=!0}if(l){l=console;var f=l.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),t(e)}}function o(e){if(e===R)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===N)return"<...>";try{var l=i(e);return l?"<"+l+">":"<...>"}catch{return"<...>"}}function r(){var e=P.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function c(e){if(V.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function u(e,l){function f(){_||(_=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}function x(){var e=i(this.type);return j[e]||(j[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function O(e,l,f,d,$,z,H,J){return f=z.ref,e={$$typeof:S,type:e,key:l,props:z,_owner:$},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:x}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function I(e,l,f,d,$,z,H,J){var m=l.children;if(m!==void 0)if(d)if(p(m)){for(d=0;d<m.length;d++)b(m[d]);Object.freeze&&Object.freeze(m)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else b(m);if(V.call(l,"key")){m=i(e);var F=Object.keys(l).filter(function(ae){return ae!=="key"});d=0<F.length?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}",K[m+d]||(F=0<F.length?"{"+F.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
- let props = %s;
19
- <%s {...props} />
20
- React keys must be passed directly to JSX without using spread:
21
- let props = %s;
22
- <%s key={someKey} {...props} />`,d,m,F,m),K[m+d]=!0)}if(m=null,f!==void 0&&(n(f),m=""+f),c(l)&&(n(l.key),m=""+l.key),"key"in l){f={};for(var X in l)X!=="key"&&(f[X]=l[X])}else f=l;return m&&u(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),O(e,m,z,$,r(),f,H,J)}function b(e){typeof e=="object"&&e!==null&&e.$$typeof===S&&e._store&&(e._store.validated=1)}var T=a,S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),M=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),C=Symbol.for("react.client.reference"),P=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,p=Array.isArray,g=console.createTask?console.createTask:function(){return null};T={"react-stack-bottom-frame":function(e){return e()}};var _,j={},L=T["react-stack-bottom-frame"].bind(T,s)(),Q=g(o(s)),K={};U.Fragment=R,U.jsx=function(e,l,f,d,$){var z=1e4>P.recentlyCreatedOwnerStacks++;return I(e,l,f,!1,d,$,z?Error("react-stack-top-frame"):L,z?g(o(e)):Q)},U.jsxs=function(e,l,f,d,$){var z=1e4>P.recentlyCreatedOwnerStacks++;return I(e,l,f,!0,d,$,z?Error("react-stack-top-frame"):L,z?g(o(e)):Q)}}()),U}var re;function de(){return re||(re=1,process.env.NODE_ENV==="production"?G.exports=fe():G.exports=he()),G.exports}var q=de();function se(i){if(i!==void 0)switch(typeof i){case"number":return i;case"string":{if(i.endsWith("px"))return parseFloat(i);break}}}const me=typeof window<"u"?a.useLayoutEffect:a.useEffect;function ie({box:i,defaultHeight:t,defaultWidth:n,disabled:o,element:r,mode:s,style:c}){const{styleHeight:u,styleWidth:x}=a.useMemo(()=>({styleHeight:se(c?.height),styleWidth:se(c?.width)}),[c?.height,c?.width]),[O,I]=a.useState({height:t,width:n}),b=o||s==="only-height"&&u!==void 0||s==="only-width"&&x!==void 0||u!==void 0&&x!==void 0;return me(()=>{if(r===null||b)return;const T=new ResizeObserver(S=>{for(const w of S){const{contentRect:R,target:y}=w;r===y&&I(v=>v.height===R.height&&v.width===R.width?v:{height:R.height,width:R.width})}});return T.observe(r,{box:i}),()=>{T?.unobserve(r)}},[i,b,r,u,x]),a.useMemo(()=>({height:u??O.height,width:x??O.width}),[O,u,x])}function le(i){return a.useMemo(()=>i,Object.values(i))}function B(i,t="Assertion error"){if(!i)throw console.error(t),Error(t)}class be{#e;#l;#s;#c;#o;#r;#a;#t=0;#n=0;#i=0;#u=-1;constructor({count:t,defaultSize:n,direction:o,element:r,itemSize:s,overscanCount:c}){B(r),this.#e=new Map,this.#l=new Set,this.#s=t,this.#c=o,this.#o=r,this.#r=s,this.#a=c,this.#n=n??0,this.#o.addEventListener("scroll",this.#h)}getEstimatedHeight(){if(typeof this.#r=="number")return this.#s*this.#r;if(this.#e.size>0){const t=this.#e.get(this.#e.size-1);B(t!==void 0,"Unexpected bounds cache miss");const n=(t.scrollOffset+t.size)/this.#e.size;return this.#s*n}else return 0}getIndices(){return this.#i<0?[0,-1]:[this.#i,this.#u]}getItemBounds(t){if(typeof this.#r=="number")return{scrollOffset:t*this.#r,size:this.#r};for(;this.#e.size-1<t;){const o=this.#e.size,r=typeof this.#r=="number"?this.#r:this.#r(o);if(o===0)this.#e.set(o,{size:r,scrollOffset:0});else{const s=this.#e.get(o-1);B(s!==void 0,`Unexpected bounds cache miss for index ${t}`),this.#e.set(o,{scrollOffset:s.scrollOffset+s.size,size:r})}}const n=this.#e.get(t);return B(n!==void 0,`Unexpected bounds cache miss for index ${t}`),n}resize(t){this.#n=t,this.#f()}subscribe=t=>(this.#l.add(t),()=>{this.#l.delete(t)});version=()=>`${this.#i}-${this.#u}`;scrollToIndex({align:t="auto",behavior:n,index:o}){const r=this.#d(o,t);this.#c==="horizontal"?this.#o?.scrollTo({left:r,behavior:n||void 0}):this.#o?.scrollTo({behavior:n||void 0,top:r})}scrollForTest(t){this.#t=t,this.#f()}#h=()=>{const{clientHeight:t,scrollHeight:n,scrollLeft:o,scrollTop:r,scrollWidth:s}=this.#o,c=this.#c==="vertical"?r:o,u=this.#c==="vertical"?n:s;this.#t!==c&&(this.#t=Math.max(0,Math.min(c,u-t)),this.#f())};#d(t,n){const o=this.getItemBounds(this.#s-1).scrollOffset,r=o+this.getItemBounds(this.#s-1).scrollOffset-this.#n,s=Math.max(0,this.getItemBounds(t+1).scrollOffset-this.#n),c=Math.min(o,this.getItemBounds(t).scrollOffset);switch(n==="smart"&&(this.#t>=s&&this.#t<=c?n="auto":n="center"),n){case"start":return Math.min(r,c);case"end":return s;case"center":{const u=Math.round(s+(c-s)/2);return u<Math.ceil(this.#n/2)?0:u>r?r:u}case"auto":default:return this.#t>=s&&this.#t<=c?this.#t:this.#t<s?s:c}}#m(){this.#l.forEach(t=>t())}#f(){const t=this.#s-1;let n=0,o=-1,r=0;for(;r<t;){const s=this.getItemBounds(r);if(s.scrollOffset+s.size>this.#t)break;r++}for(n=r,n=Math.max(0,n-this.#a);r<t;){const s=this.getItemBounds(r);if(s.scrollOffset+s.size>=this.#t+this.#n)break;r++}o=Math.min(t,r),o=Math.min(this.#s-1,o+this.#a),(this.#i!==n||this.#u!==o)&&(this.#i=n,this.#u=o,this.#m())}}function Z({count:i,defaultSize:t,direction:n,element:o,itemSize:r,overscanCount:s,size:c}){const u=a.useMemo(()=>o?new be({count:i,defaultSize:t,direction:n,element:o,itemSize:r,overscanCount:s}):null,[i,t,n,o,r,s]);return a.useLayoutEffect(()=>{c!==void 0&&u?.resize(c)},[c,u]),a.useSyncExternalStore(u?.subscribe??ce,u?.version??ne,u?.version??ne),u}function ce(){return ce}function ne(){return""}function oe(i,t){if(i===t)return!0;if(!!i!=!!t||(B(i!==void 0),B(t!==void 0),Object.keys(i).length!==Object.keys(t).length))return!1;for(const n in i)if(!Object.is(t[n],i[n]))return!1;return!0}function ue(i,t){const{style:n,...o}=i,{style:r,...s}=t;return oe(n,r)&&oe(o,s)}function ve({cellComponent:i,cellProps:t,className:n,columnCount:o,columnWidth:r,defaultHeight:s,defaultWidth:c,gridRef:u,onCellsRendered:x,overscanCount:O=3,rowCount:I,rowHeight:b,style:T,...S}){const w=le(t),R=a.useMemo(()=>a.memo(i,ue),[i]),[y,v]=a.useState(null),{height:A=0,width:M=0}=ie({defaultHeight:s,defaultWidth:c,element:y,style:T}),W=a.useMemo(()=>typeof r=="number"?r:p=>r(p,w),[r,w]),k=a.useMemo(()=>typeof b=="number"?b:p=>b(p,w),[b,w]),h=Z({count:o,defaultSize:c,direction:"horizontal",element:y,itemSize:W,overscanCount:O,size:M}),E=Z({count:I,defaultSize:s,direction:"vertical",element:y,itemSize:k,overscanCount:O,size:A}),[N,Y]=h?.getIndices()??[-1,0],[C,P]=E?.getIndices()??[-1,0];a.useImperativeHandle(u,()=>({get element(){return y},scrollToCell({behavior:p="auto",columnAlign:g="auto",columnIndex:_,rowAlign:j="auto",rowIndex:L}){E?.scrollToIndex({align:j,behavior:p,index:L}),h?.scrollToIndex({behavior:p,align:g,index:_})},scrollToColumn({align:p="auto",behavior:g="auto",index:_}){h?.scrollToIndex({align:p,behavior:g,index:_})},scrollToRow({align:p="auto",behavior:g="auto",index:_}){E?.scrollToIndex({align:p,behavior:g,index:_})}}),[h,y,E]),a.useEffect(()=>{N>=0&&Y>=0&&C>=0&&P>=0&&x&&x({columnStartIndex:N,columnStopIndex:Y,rowStartIndex:C,rowStopIndex:P})},[x,N,Y,C,P]);const V=a.useMemo(()=>{const p=[];if(h&&o>0&&E&&I>0)for(let g=C;g<=P;g++){const _=E.getItemBounds(g);for(let j=N;j<=Y;j++){const L=h.getItemBounds(j);p.push(a.createElement(R,{...w,columnIndex:j,key:`${g}-${j}`,rowIndex:g,style:{position:"absolute",left:0,transform:`translate(${L.scrollOffset}px, ${_.scrollOffset}px)`,height:_.size,width:L.size}}))}}return p},[R,w,o,N,Y,h,I,C,P,E]);return q.jsx("div",{role:"grid",...S,className:n,ref:v,style:{...T,maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto"},children:q.jsx("div",{className:n,style:{position:"relative",height:E?.getEstimatedHeight(),width:h?.getEstimatedHeight()},children:V})})}const Ee=a.useRef;function pe({className:i,defaultHeight:t=0,listRef:n,onRowsRendered:o,overscanCount:r=3,rowComponent:s,rowCount:c,rowHeight:u,rowProps:x,style:O,...I}){const b=le(x),T=a.useMemo(()=>a.memo(s,ue),[s]),[S,w]=a.useState(null),{height:R=0}=ie({defaultHeight:t,element:S,mode:"only-height",style:O}),y=a.useMemo(()=>typeof u=="number"?u:k=>u(k,b),[u,b]),v=Z({count:c,defaultSize:t,direction:"vertical",element:S,itemSize:y,overscanCount:r,size:R}),[A,M]=v?.getIndices()??[-1,0];a.useImperativeHandle(n,()=>({get element(){return S},scrollToRow({align:k="auto",behavior:h="auto",index:E}){v?.scrollToIndex({align:k,behavior:h,index:E})}}),[S,v]),a.useEffect(()=>{A>=0&&M>=0&&o&&o({startIndex:A,stopIndex:M})},[o,A,M]);const W=a.useMemo(()=>{const k=[];if(v&&c>0)for(let h=A;h<=M;h++){const E=v.getItemBounds(h);k.push(a.createElement(T,{...b,key:h,index:h,style:{position:"absolute",left:0,transform:`translateY(${E.scrollOffset}px)`,height:E.size,width:"100%"}}))}return k},[T,c,b,A,M,v]);return q.jsx("div",{role:"list",...I,className:i,ref:w,style:{...O,maxHeight:"100%",flexGrow:1,overflowY:"auto"},children:q.jsx("div",{className:i,style:{height:v?.getEstimatedHeight(),position:"relative",width:"100%"},children:W})})}const ge=a.useRef;exports.Grid=ve;exports.List=pe;exports.useGridRef=Ee;exports.useListRef=ge;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react/jsx-runtime"),i=require("react");function R(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}const P=typeof window<"u"?i.useLayoutEffect:i.useEffect;function V({box:e,defaultHeight:r,defaultWidth:n,disabled:s,element:t,mode:u,style:l}){const{styleHeight:f,styleWidth:o}=i.useMemo(()=>({styleHeight:R(l?.height),styleWidth:R(l?.width)}),[l?.height,l?.width]),[a,g]=i.useState({height:r,width:n}),O=s||u==="only-height"&&f!==void 0||u==="only-width"&&o!==void 0||f!==void 0&&o!==void 0;return P(()=>{if(t===null||O)return;const S=new ResizeObserver(w=>{for(const d of w){const{contentRect:I,target:x}=d;t===x&&g(y=>y.height===I.height&&y.width===I.width?y:{height:I.height,width:I.width})}});return S.observe(t,{box:e}),()=>{S?.unobserve(t)}},[e,O,t,f,o]),i.useMemo(()=>({height:f??a.height,width:o??a.width}),[a,f,o])}function k(e,r="Assertion error"){if(!e)throw console.error(r),Error(r)}function q({cachedBounds:e,itemCount:r,itemSize:n}){if(typeof n=="number")return r*n;if(e.size>0){const s=e.get(e.size-1);k(s!==void 0,"Unexpected bounds cache miss");const t=(s.scrollOffset+s.size)/e.size;return r*t}else return 0}function U({align:e,cachedBounds:r,index:n,itemCount:s,containerScrollOffset:t,containerSize:u}){const l=r.get(s-1).scrollOffset,f=l+l-u,o=Math.max(0,r.get(n+1).scrollOffset-u),a=Math.min(l,r.get(n).scrollOffset);switch(e==="smart"&&(t>=o&&t<=a?e="auto":e="center"),e){case"start":return Math.min(f,a);case"end":return o;case"center":{const g=Math.round(o+(a-o)/2);return g<Math.ceil(u/2)?0:g>f?f:g}case"auto":default:return t>=o&&t<=a?t:t<o?o:a}}function F({cachedBounds:e,containerScrollOffset:r,containerSize:n,itemCount:s,overscanCount:t}){const u=s-1;let l=0,f=-1,o=0;for(;o<u;){const a=e.get(o);if(a.scrollOffset+a.size>r)break;o++}for(l=o,l=Math.max(0,l-t);o<u;){const a=e.get(o);if(a.scrollOffset+a.size>=r+n)break;o++}return f=Math.min(u,o),f=Math.min(s-1,f+t),l<0?[0,-1]:[l,f]}function Y({itemCount:e,itemProps:r,itemSize:n}){const s=new Map;return{get(t){for(k(t<e,`Invalid index ${t}`);s.size-1<t;){const l=s.size,f=typeof n=="number"?n:n(l,r);if(l===0)s.set(l,{size:f,scrollOffset:0});else{const o=s.get(l-1);k(o!==void 0,`Unexpected bounds cache miss for index ${t}`),s.set(l,{scrollOffset:o.scrollOffset+o.size,size:f})}}const u=s.get(t);return k(u!==void 0,`Unexpected bounds cache miss for index ${t}`),u},set(t,u){s.set(t,u)},get size(){return s.size}}}function A({itemCount:e,itemProps:r,itemSize:n}){return i.useMemo(()=>Y({itemCount:e,itemProps:r,itemSize:n}),[e,r,n])}function L({containerElement:e,containerStyle:r,defaultContainerSize:n=0,direction:s,itemCount:t,itemProps:u,itemSize:l,overscanCount:f}){const[[o,a],g]=i.useState([0,-1]),{height:O=n,width:S=n}=V({defaultHeight:s==="vertical"?n:void 0,defaultWidth:s==="horizontal"?n:void 0,element:e,mode:s==="vertical"?"only-height":"only-width",style:r}),w=s==="vertical"?O:S,d=A({itemCount:t,itemProps:u,itemSize:l}),I=i.useCallback(c=>d.get(c),[d]),x=i.useCallback(()=>q({cachedBounds:d,itemCount:t,itemSize:l}),[d,t,l]),y=i.useCallback(c=>F({cachedBounds:d,containerScrollOffset:c,containerSize:w,itemCount:t,overscanCount:f}),[d,w,t,f]);P(()=>{g(y(0))},[y]);const p=i.useCallback(({align:c="auto",behavior:m="auto",containerScrollOffset:z,index:v})=>{const h=U({align:c,cachedBounds:d,containerScrollOffset:z,containerSize:w,index:v,itemCount:t});s==="horizontal"?e?.scrollTo({left:h,behavior:m||void 0}):e?.scrollTo({behavior:m||void 0,top:h})},[d,e,w,s,t]);return{getCellBounds:I,getEstimatedHeight:x,onScroll:()=>{const c=y((s==="vertical"?e?.scrollTop:e?.scrollLeft)??0);(c[0]!==o||c[1]!==a)&&g(c)},scrollToIndex:p,startIndex:o,stopIndex:a}}function W(e){return i.useMemo(()=>e,Object.values(e))}function G(e,r){if(e===r)return!0;if(!!e!=!!r||(k(e!==void 0),k(r!==void 0),Object.keys(e).length!==Object.keys(r).length))return!1;for(const n in e)if(!Object.is(r[n],e[n]))return!1;return!0}function B(e,r){const{style:n,...s}=e,{style:t,...u}=r;return G(n,t)&&G(s,u)}function D({cellComponent:e,cellProps:r,className:n,columnCount:s,columnWidth:t,defaultHeight:u=0,defaultWidth:l=0,gridRef:f,onCellsRendered:o,overscanCount:a=3,rowCount:g,rowHeight:O,style:S,...w}){const d=W(r),I=i.useMemo(()=>i.memo(e,B),[e]),[x,y]=i.useState(null),p=L({containerElement:x,defaultContainerSize:l,direction:"horizontal",itemCount:s,itemProps:d,itemSize:t,overscanCount:a}),c=L({containerElement:x,defaultContainerSize:u,direction:"vertical",itemCount:g,itemProps:d,itemSize:O,overscanCount:a}),{startIndex:m,stopIndex:z}=p,{startIndex:v,stopIndex:h}=c;i.useImperativeHandle(f,()=>({get element(){return x},scrollToCell({behavior:M="auto",columnAlign:b="auto",columnIndex:T,rowAlign:E="auto",rowIndex:j}){c?.scrollToIndex({align:E,behavior:M,containerScrollOffset:x?.scrollTop??0,index:j}),p?.scrollToIndex({align:b,behavior:M,containerScrollOffset:x?.scrollLeft??0,index:T})},scrollToColumn({align:M="auto",behavior:b="auto",index:T}){p?.scrollToIndex({align:M,behavior:b,containerScrollOffset:x?.scrollLeft??0,index:T})},scrollToRow({align:M="auto",behavior:b="auto",index:T}){c?.scrollToIndex({align:M,behavior:b,containerScrollOffset:x?.scrollTop??0,index:T})}}),[p,x,c]),i.useEffect(()=>{m>=0&&z>=0&&v>=0&&h>=0&&o&&o({columnStartIndex:m,columnStopIndex:z,rowStartIndex:v,rowStopIndex:h})},[o,m,z,v,h]);const H=i.useMemo(()=>{const M=[];if(p&&s>0&&c&&g>0)for(let b=v;b<=h;b++){const T=c.getCellBounds(b);for(let E=m;E<=z;E++){const j=p.getCellBounds(E);M.push(i.createElement(I,{...d,columnIndex:E,key:`${b}-${E}`,rowIndex:b,style:{position:"absolute",left:0,transform:`translate(${j.scrollOffset}px, ${T.scrollOffset}px)`,height:T.size,width:j.size}}))}}return M},[I,d,s,m,z,p,g,v,h,c]);return $.jsx("div",{role:"grid",...w,className:n,onScroll:()=>{p.onScroll(),c.onScroll()},ref:y,style:{...S,maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto"},children:$.jsx("div",{className:n,style:{position:"relative",height:c?.getEstimatedHeight(),width:p?.getEstimatedHeight()},children:H})})}const J=i.useRef;function K({className:e,defaultHeight:r=0,listRef:n,onRowsRendered:s,overscanCount:t=3,rowComponent:u,rowCount:l,rowHeight:f,rowProps:o,style:a,...g}){const O=W(o),S=i.useMemo(()=>i.memo(u,B),[u]),[w,d]=i.useState(null),{getCellBounds:I,getEstimatedHeight:x,onScroll:y,scrollToIndex:p,startIndex:c,stopIndex:m}=L({containerElement:w,defaultContainerSize:r,direction:"vertical",itemCount:l,itemProps:O,itemSize:f,overscanCount:t});i.useImperativeHandle(n,()=>({get element(){return w},scrollToRow({align:v="auto",behavior:h="auto",index:H}){p({align:v,behavior:h,containerScrollOffset:w?.scrollTop??0,index:H})}}),[w,p]),i.useEffect(()=>{c>=0&&m>=0&&s&&s({startIndex:c,stopIndex:m})},[s,c,m]);const z=i.useMemo(()=>{const v=[];if(l>0)for(let h=c;h<=m;h++){const H=I(h);v.push(i.createElement(S,{...O,key:h,index:h,style:{position:"absolute",left:0,transform:`translateY(${H.scrollOffset}px)`,height:H.size,width:"100%"}}))}return v},[S,I,l,O,c,m]);return $.jsx("div",{role:"list",...g,className:e,onScroll:y,ref:d,style:{...a,maxHeight:"100%",flexGrow:1,overflowY:"auto"},children:$.jsx("div",{className:e,style:{height:x(),position:"relative",width:"100%"},children:z})})}const Q=i.useRef;exports.Grid=D;exports.List=K;exports.useGridRef=J;exports.useListRef=Q;
@@ -20,7 +20,7 @@ declare type ForbiddenKeys = "columnIndex" | "rowIndex" | "style";
20
20
 
21
21
  declare type ForbiddenKeys_2 = "index" | "style";
22
22
 
23
- export declare function Grid<CellProps extends object>({ cellComponent: CellComponentProp, cellProps: cellPropsUnstable, className, columnCount, columnWidth: columnWidthProp, defaultHeight, defaultWidth, gridRef, onCellsRendered, overscanCount, rowCount, rowHeight: rowHeightProp, style, ...rest }: GridProps<CellProps>): JSX.Element;
23
+ export declare function Grid<CellProps extends object>({ cellComponent: CellComponentProp, cellProps: cellPropsUnstable, className, columnCount, columnWidth, defaultHeight, defaultWidth, gridRef, onCellsRendered, overscanCount, rowCount, rowHeight, style, ...rest }: GridProps<CellProps>): JSX.Element;
24
24
 
25
25
  declare type GridComponent<CellProps extends object> = GridProps<CellProps>["cellComponent"];
26
26
 
@@ -28,19 +28,19 @@ export declare type GridComponentProps<CellProps extends object = object> = Comp
28
28
 
29
29
  export declare type GridImperativeAPI = {
30
30
  get element(): HTMLDivElement | null;
31
- scrollToCell({ behavior, columnAlign, columnIndex, rowAlign, rowIndex, }: {
31
+ scrollToCell({ behavior, columnAlign, columnIndex, rowAlign, rowIndex }: {
32
32
  behavior?: "auto" | "instant" | "smooth";
33
33
  columnAlign?: "auto" | "center" | "end" | "smart" | "start";
34
34
  columnIndex: number;
35
35
  rowAlign?: "auto" | "center" | "end" | "smart" | "start";
36
36
  rowIndex: number;
37
37
  }): void;
38
- scrollToColumn({ align, behavior, index, }: {
38
+ scrollToColumn({ align, behavior, index }: {
39
39
  align?: "auto" | "center" | "end" | "smart" | "start";
40
40
  behavior?: "auto" | "instant" | "smooth";
41
41
  index: number;
42
42
  }): void;
43
- scrollToRow({ align, behavior, index, }: {
43
+ scrollToRow({ align, behavior, index }: {
44
44
  align?: "auto" | "center" | "end" | "smart" | "start";
45
45
  behavior?: "auto" | "instant" | "smooth";
46
46
  index: number;
@@ -126,11 +126,11 @@ export declare type GridProps<CellProps extends object> = {
126
126
  style?: CSSProperties;
127
127
  };
128
128
 
129
- export declare function List<RowProps extends object>({ className, defaultHeight, listRef, onRowsRendered, overscanCount, rowComponent: RowComponentProp, rowCount, rowHeight: rowHeightProp, rowProps: rowPropsUnstable, style, ...rest }: ListProps<RowProps>): JSX.Element;
129
+ export declare function List<RowProps extends object>({ className, defaultHeight, listRef, onRowsRendered, overscanCount, rowComponent: RowComponentProp, rowCount, rowHeight, rowProps: rowPropsUnstable, style, ...rest }: ListProps<RowProps>): JSX.Element;
130
130
 
131
131
  export declare type ListImperativeAPI = {
132
132
  get element(): HTMLDivElement | null;
133
- scrollToRow({ align, behavior, index, }: {
133
+ scrollToRow({ align, behavior, index }: {
134
134
  align?: "auto" | "center" | "end" | "smart" | "start";
135
135
  behavior?: "auto" | "instant" | "smooth";
136
136
  index: number;