react-virtuoso 4.0.5 → 4.0.6
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/index.cjs +1 -1
- package/dist/index.d.ts +54 -63
- package/dist/index.mjs +92 -107
- package/dist/react-urx/index.d.ts +5 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),o=require("react-dom");function n(e,t){return o=>e(t(o))}function r(e,t){return t(e)}function i(e,t){return o=>e(t,o)}function l(e,t){return()=>e(t)}function s(e,t){return t(e),e}function c(...e){return e}function a(e){e()}function u(e){return()=>e}function d(){}function f(e,t){return e(1,t)}function h(e,t){e(0,t)}function m(e){e(2)}function g(e){return e(4)}function p(e,t){return f(e,i(t,0))}function x(e,t){const o=e(1,(e=>{o(),t(e)}));return o}function v(){const e=[];return(t,o)=>{switch(t){case 2:return void e.splice(0,e.length);case 1:return e.push(o),()=>{const t=e.indexOf(o);t>-1&&e.splice(t,1)};case 0:return void e.slice().forEach((e=>{e(o)}));default:throw new Error(`unrecognized action ${t}`)}}}function I(e){let t=e;const o=v();return(e,n)=>{switch(e){case 1:n(t);break;case 0:t=n;break;case 4:return t}return o(e,n)}}function T(e){return s(v(),(t=>p(e,t)))}function w(e,t){return s(I(t),(t=>p(e,t)))}function C(e,...t){const o=function(...e){return t=>e.reduceRight(r,t)}(...t);return(t,n)=>{switch(t){case 1:return f(e,o(n));case 2:return void m(e)}}}function S(e,t){return e===t}function H(e=S){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function y(e){return t=>o=>{e(o)&&t(o)}}function E(e){return t=>n(t,e)}function b(e){return t=>()=>t(e)}function R(e,t){return o=>n=>o(t=e(t,n))}function z(e){return t=>o=>{e>0?e--:t(o)}}function B(e){let t,o;return n=>r=>{t=r,o||(o=setTimeout((()=>{o=void 0,n(t)}),e))}}function k(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout((()=>{n(t)}),e)}}function P(...e){const t=new Array(e.length);let o=0,n=null;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);f(e,(e=>{const s=o;o|=l,t[i]=e,s!==r&&o===r&&n&&(n(),n=null)}))})),e=>i=>{const l=()=>e([i].concat(t));o===r?l():n=l}}function L(...e){return function(t,o){switch(t){case 1:return function(...e){return()=>{e.map(a)}}(...e.map((e=>f(e,o))));case 2:return;default:throw new Error(`unrecognized action ${t}`)}}}function O(e,t=S){return C(e,H(t))}function M(...e){const t=v(),o=new Array(e.length);let n=0;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);f(e,(e=>{o[i]=e,n|=l,n===r&&h(t,o)}))})),function(e,i){switch(e){case 1:return n===r&&i(o),f(t,i);case 2:return m(t);default:throw new Error(`unrecognized action ${e}`)}}}function W(e,t=[],{singleton:o}={singleton:!0}){return{id:V(),constructor:e,dependencies:t,singleton:o}}const V=()=>Symbol();const j="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function F(e,o,n){const r=Object.keys(o.required||{}),c=Object.keys(o.optional||{}),a=Object.keys(o.methods||{}),p=Object.keys(o.events||{}),x=t.createContext({});function v(e,t){e.propsReady&&h(e.propsReady,!1);for(const n of r){h(e[o.required[n]],t[n])}for(const n of c)if(n in t){h(e[o.optional[n]],t[n])}e.propsReady&&h(e.propsReady,!0)}function I(e){return p.reduce(((t,n)=>(t[n]=function(e){let t,o;const n=()=>t&&t();return function(r,i){switch(r){case 1:if(i){if(o===i)return;return n(),o=i,t=f(e,i),t}return n(),d;case 2:return n(),void(o=null);default:throw new Error(`unrecognized action ${r}`)}}}(e[o.events[n]]),t)),{})}const T=t.forwardRef(((i,d)=>{const{children:g,...T}=i,[w]=t.useState((()=>s(function(e){const t=new Map,o=({id:e,constructor:n,dependencies:r,singleton:i})=>{if(i&&t.has(e))return t.get(e);const l=n(r.map((e=>o(e))));return i&&t.set(e,l),l};return o(e)}(e),(e=>v(e,T))))),[C]=t.useState(l(I,w));return j((()=>{for(const e of p)e in T&&f(C[e],T[e]);return()=>{Object.values(C).map(m)}}),[T,C,w]),j((()=>{v(w,T)})),t.useImperativeHandle(d,u(function(e){return a.reduce(((t,n)=>(t[n]=t=>{h(e[o.methods[n]],t)},t)),{})}(w))),t.createElement(x.Provider,{value:w},n?t.createElement(n,function(e,t){const o={},n={};let r=0;const i=e.length;for(;r<i;)n[e[r]]=1,r+=1;for(const l in t)n.hasOwnProperty(l)||(o[l]=t[l]);return o}([...r,...c,...p],T),g):g)}));return{Component:T,usePublisher:e=>t.useCallback(i(h,t.useContext(x)[e]),[e]),useEmitterValue:e=>{const o=t.useContext(x)[e],[n,r]=t.useState(l(g,o));return j((()=>f(o,(e=>{e!==n&&r(u(e))}))),[o,n]),n},useEmitter:(e,o)=>{const n=t.useContext(x)[e];j((()=>f(n,o)),[o,n])}}}const A="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;var D=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(D||{});const G={0:"debug",1:"log",2:"warn",3:"error"},N=W((()=>{const e=I(3);return{log:I(((t,o,n=1)=>{n>=(("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL??g(e))&&console[G[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)})),logLevel:e}}),[],{singleton:!0});function _(e,o=!0){const n=t.useRef(null);let r=e=>{};if("undefined"!=typeof ResizeObserver){const t=new ResizeObserver((t=>{const o=t[0].target;null!==o.offsetParent&&e(o)}));r=e=>{e&&o?(t.observe(e),n.current=e):(n.current&&t.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function U(e,t=!0){return _(e,t).callbackRef}function $(e,t,o,n,r,i,l){return _((o=>{const s=function(e,t,o,n){const r=e.length;if(0===r)return null;const i=[];for(let l=0;l<r;l++){const r=e.item(l);if(!r||void 0===r.dataset.index)continue;const s=parseInt(r.dataset.index),c=parseFloat(r.dataset.knownSize),a=t(r,o);if(0===a&&n("Zero-sized element, this should not happen",{child:r},D.ERROR),a===c)continue;const u=i[i.length-1];0===i.length||u.size!==a||u.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:a}):i[i.length-1].endIndex++}return i}(o.children,t,"offsetHeight",r);let c=o.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const a="window"===c.lastElementChild.dataset.viewportType,u=l?l.scrollTop:a?window.pageYOffset||document.documentElement.scrollTop:c.scrollTop,d=l?l.scrollHeight:a?document.documentElement.scrollHeight:c.scrollHeight,f=l?l.offsetHeight:a?window.innerHeight:c.offsetHeight;n({scrollTop:Math.max(u,0),scrollHeight:d,viewportHeight:f}),null==i||i(function(e,t,o){"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN);if("normal"===t)return 0;return parseInt(t??"0",10)}("row-gap",getComputedStyle(o).rowGap,r)),null!==s&&e(s)}),o)}function K(e,t){return Math.round(e.getBoundingClientRect()[t])}function q(e,t){return Math.abs(e-t)<1.01}function Y(e,n,r,i=d,l){const s=t.useRef(null),c=t.useRef(null),a=t.useRef(null),u=t.useCallback((t=>{const r=t.target,i=r===window||r===document,l=i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,s=i?document.documentElement.scrollHeight:r.scrollHeight,u=i?window.innerHeight:r.offsetHeight,d=()=>{e({scrollTop:Math.max(l,0),scrollHeight:s,viewportHeight:u})};t.suppressFlushSync?d():o.flushSync(d),null!==c.current&&(l===c.current||l<=0||l===s-u)&&(c.current=null,n(!0),a.current&&(clearTimeout(a.current),a.current=null))}),[e,n]);return t.useEffect((()=>{const e=l||s.current;return i(l||s.current),u({target:e,suppressFlushSync:!0}),e.addEventListener("scroll",u,{passive:!0}),()=>{i(null),e.removeEventListener("scroll",u)}}),[s,u,r,i,l]),{scrollerRef:s,scrollByCallback:function(e){s.current.scrollBy(e)},scrollToCallback:function(t){const o=s.current;if(!o||"offsetHeight"in o&&0===o.offsetHeight)return;const r="smooth"===t.behavior;let i,l,u;o===window?(l=Math.max(K(document.documentElement,"height"),document.documentElement.scrollHeight),i=window.innerHeight,u=document.documentElement.scrollTop):(l=o.scrollHeight,i=K(o,"height"),u=o.scrollTop);const d=l-i;if(t.top=Math.ceil(Math.max(Math.min(d,t.top),0)),q(i,l)||t.top===u)return e({scrollTop:u,scrollHeight:l,viewportHeight:i}),void(r&&n(!0));r?(c.current=t.top,a.current&&clearTimeout(a.current),a.current=setTimeout((()=>{a.current=null,c.current=null,n(!0)}),1e3)):c.current=null,o.scrollTo(t)}}}const Z=W((()=>{const e=v(),t=v(),o=I(0),n=v(),r=I(0),i=v(),l=v(),s=I(0),c=I(0),a=I(0),u=I(0),d=v(),f=v(),h=I(!1);return p(C(e,E((({scrollTop:e})=>e))),t),p(C(e,E((({scrollHeight:e})=>e))),l),p(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:i,headerHeight:s,fixedHeaderHeight:c,fixedFooterHeight:a,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:n,scrollTo:d,scrollBy:f,statefulScrollTop:r,deviation:o,scrollingInProgress:h}}),[],{singleton:!0}),J={lvl:0};function Q(e,t,o,n=J,r=J){return{k:e,v:t,lvl:o,l:n,r:r}}function X(e){return e===J}function ee(){return J}function te(e,t){if(X(e))return J;const{k:o,l:n,r:r}=e;if(t===o){if(X(n))return r;if(X(r))return n;{const[t,o]=le(n);return de(ce(e,{k:t,v:o,l:se(n)}))}}return de(ce(e,t<o?{l:te(n,t)}:{r:te(r,t)}))}function oe(e,t,o="k"){if(X(e))return[-1/0,void 0];if(e[o]===t)return[e.k,e.v];if(e[o]<t){const n=oe(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return oe(e.l,t,o)}function ne(e,t,o){return X(e)?Q(t,o,1):t===e.k?ce(e,{k:t,v:o}):t<e.k?ue(ce(e,{l:ne(e.l,t,o)})):ue(ce(e,{r:ne(e.r,t,o)}))}function re(e,t,o){if(X(e))return[];const{k:n,v:r,l:i,r:l}=e;let s=[];return n>t&&(s=s.concat(re(i,t,o))),n>=t&&n<=o&&s.push({k:n,v:r}),n<=o&&(s=s.concat(re(l,t,o))),s}function ie(e){return X(e)?[]:[...ie(e.l),{k:e.k,v:e.v},...ie(e.r)]}function le(e){return X(e.r)?[e.k,e.v]:le(e.r)}function se(e){return X(e.r)?e.l:de(ce(e,{r:se(e.r)}))}function ce(e,t){return Q(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function ae(e){return X(e)||e.lvl>e.r.lvl}function ue(e){return me(ge(e))}function de(e){const{l:t,r:o,lvl:n}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(ae(t))return ge(ce(e,{lvl:n-1}));if(X(t)||X(t.r))throw new Error("Unexpected empty nodes");return ce(t.r,{l:ce(t,{r:t.r.l}),r:ce(e,{l:t.r.r,lvl:n-1}),lvl:n})}if(ae(e))return me(ce(e,{lvl:n-1}));if(X(o)||X(o.l))throw new Error("Unexpected empty nodes");{const t=o.l,r=ae(t)?o.lvl-1:o.lvl;return ce(t,{l:ce(e,{r:t.l,lvl:n-1}),r:me(ce(o,{l:t.r,lvl:r})),lvl:t.lvl+1})}}function fe(e,t,o){if(X(e))return[];const n=oe(e,t)[0];return he(re(e,n,o),(({k:e,v:t})=>({index:e,value:t})))}function he(e,t){const o=e.length;if(0===o)return[];let{index:n,value:r}=t(e[0]);const i=[];for(let l=1;l<o;l++){const{index:o,value:s}=t(e[l]);i.push({start:n,end:o-1,value:r}),n=o,r=s}return i.push({start:n,end:1/0,value:r}),i}function me(e){const{r:t,lvl:o}=e;return X(t)||X(t.r)||t.lvl!==o||t.r.lvl!==o?e:ce(t,{l:ce(e,{r:t.l}),lvl:o+1})}function ge(e){const{l:t}=e;return X(t)||t.lvl!==e.lvl?e:ce(t,{r:ce(e,{l:t.r})})}function pe(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),l=o(e[i],t);if(0===l)return i;if(-1===l){if(r-n<2)return i-1;r=i-1}else{if(r===n)return i;n=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function xe(e,t,o){return e[pe(e,t,o)]}const ve=W((()=>({recalcInProgress:I(!1)})),[],{singleton:!0});function Ie(e){const{size:t,startIndex:o,endIndex:n}=e;return e=>e.start===o&&(e.end===n||e.end===1/0)&&e.value===t}function Te({index:e},t){return t===e?0:t<e?-1:1}function we({offset:e},t){return t===e?0:t<e?-1:1}function Ce(e){return{index:e.index,value:e}}function Se(e,t,o,n=0){return n>0&&(t=Math.max(t,xe(e,n,Te).offset)),he(function(e,t,o,n){const r=pe(e,t,n),i=pe(e,o,n,r);return e.slice(r,i+1)}(e,t,o,we),Ce)}function He(e,t,o,n){let r=e,i=0,l=0,s=0,c=0;if(0!==t){c=pe(r,t-1,Te);s=r[c].offset;const e=oe(o,t-1);i=e[0],l=e[1],r.length&&r[c].size===oe(o,t)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:u}of fe(o,t,1/0)){const e=a-i,t=e*l+s+e*n;r.push({offset:t,size:u,index:a}),i=a,s=t,l=u}return{offsetTree:r,lastIndex:i,lastOffset:s,lastSize:l}}function ye(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,D.DEBUG);const i=e.sizeTree;let l=i,s=0;if(o.length>0&&X(i)&&2===t.length){const e=t[0].size,n=t[1].size;l=o.reduce(((t,o)=>ne(ne(t,o,e),o+1,n)),l)}else[l,s]=function(e,t){let o=X(e)?0:1/0;for(const n of t){const{size:t,startIndex:r,endIndex:i}=n;if(o=Math.min(o,r),X(e)){e=ne(e,0,t);continue}const l=fe(e,r-1,i+1);if(l.some(Ie(n)))continue;let s=!1,c=!1;for(const{start:o,end:n,value:a}of l)s?(i>=o||t===a)&&(e=te(e,o)):(c=a!==t,s=!0),n>i&&i>=o&&a!==t&&(e=ne(e,i+1,a));c&&(e=ne(e,r,t))}return[e,o]}(l,t);if(l===i)return e;const{offsetTree:c,lastIndex:a,lastSize:u,lastOffset:d}=He(e.offsetTree,s,l,r);return{sizeTree:l,offsetTree:c,lastIndex:a,lastOffset:d,lastSize:u,groupOffsetTree:o.reduce(((e,t)=>ne(e,t,Ee(t,c,r))),ee()),groupIndices:o}}function Ee(e,t,o){if(0===t.length)return 0;const{offset:n,index:r,size:i}=xe(t,e,Te),l=e-r,s=i*l+(l-1)*o+n;return s>0?s+o:s}function be(e,t,o){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;{let n=Re("LAST"===e.index?o:e.index,t);return n=Math.max(0,n,Math.min(o,n)),n}}function Re(e,t){if(!ze(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function ze(e){return!X(e.groupOffsetTree)}const Be={offsetHeight:"height",offsetWidth:"width"},ke=W((([{log:e},{recalcInProgress:t}])=>{const o=v(),n=v(),r=w(n,0),i=v(),l=v(),s=I(0),c=I([]),a=I(void 0),u=I(void 0),d=I(((e,t)=>K(e,Be[t]))),m=I(void 0),x=I(0),S={offsetTree:[],sizeTree:ee(),groupOffsetTree:ee(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},b=w(C(o,P(c,e,x),R(ye,S),H()),S);p(C(c,y((e=>e.length>0)),P(b,x),E((([e,t,o])=>{const n=e.reduce(((e,n,r)=>ne(e,n,Ee(n,t.offsetTree,o)||r)),ee());return{...t,groupIndices:e,groupOffsetTree:n}}))),b),p(C(n,P(b),y((([e,{lastIndex:t}])=>e<t)),E((([e,{lastIndex:t,lastSize:o}])=>[{startIndex:e,endIndex:t,size:o}]))),o),p(a,u);const z=w(C(a,E((e=>void 0===e))),!0);p(C(u,y((e=>void 0!==e&&X(g(b).sizeTree))),E((e=>[{startIndex:0,endIndex:0,size:e}]))),o);const B=T(C(o,P(b),R((({sizes:e},[t,o])=>({changed:o!==e,sizes:o})),{changed:!1,sizes:S}),E((e=>e.changed))));f(C(s,R(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),E((e=>e.diff))),(e=>{e>0?(h(t,!0),h(i,e)):e<0&&h(l,e)})),f(C(s,P(e)),(([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},D.ERROR)}));const k=T(i);p(C(i,P(b),E((([e,t])=>{if(t.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return ie(t.sizeTree).reduce(((t,{k:o,v:n})=>({ranges:[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}],prevIndex:o+e,prevSize:n})),{ranges:[],prevIndex:0,prevSize:t.lastSize}).ranges}))),o);const L=T(C(l,P(b,x),E((([e,{offsetTree:t},o])=>Ee(-e,t,o)))));return p(C(l,P(b,x),E((([e,t,o])=>{if(t.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");const n=ie(t.sizeTree).reduce(((t,{k:o,v:n})=>ne(t,Math.max(0,o+e),n)),ee());return{...t,sizeTree:n,...He(t.offsetTree,0,n,o)}}))),b),{data:m,totalCount:n,sizeRanges:o,groupIndices:c,defaultItemSize:u,fixedItemSize:a,unshiftWith:i,shiftWith:l,shiftWithOffset:L,beforeUnshiftWith:k,firstItemIndex:s,gap:x,sizes:b,listRefresh:B,statefulTotalCount:r,trackItemSizes:z,itemSize:d}}),c(N,ve),{singleton:!0}),Pe="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Le(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&Pe||(t.behavior="auto"),t.offset||(t.offset=0),t}const Oe=W((([{sizes:e,totalCount:t,listRefresh:o,gap:n},{scrollingInProgress:r,viewportHeight:i,scrollTo:l,smoothScrollTargetReached:s,headerHeight:c,footerHeight:a,fixedHeaderHeight:u,fixedFooterHeight:d},{log:m}])=>{const g=v(),T=I(0);let w=null,S=null,H=null;function y(){w&&(w(),w=null),H&&(H(),H=null),S&&(clearTimeout(S),S=null),h(r,!1)}return p(C(g,P(e,i,t,T,c,a,m),P(n,u,d),E((([[e,t,n,i,l,c,a,u],d,m,p])=>{const v=Le(e),{align:I,behavior:T,offset:E}=v,b=i-1,R=be(v,t,b);let z=Ee(R,t.offsetTree,d)+c;"end"===I?(z+=m+oe(t.sizeTree,R)[1]-n+p,R===b&&(z+=a)):"center"===I?z+=(m+oe(t.sizeTree,R)[1]-n+p)/2:z-=l,E&&(z+=E);const B=t=>{y(),t?(u("retrying to scroll to",{location:e},D.DEBUG),h(g,e)):u("list did not change, scroll successful",{},D.DEBUG)};if(y(),"smooth"===T){let e=!1;H=f(o,(t=>{e=e||t})),w=x(s,(()=>{B(e)}))}else w=x(C(o,(k=150,e=>{const t=setTimeout((()=>{e(!1)}),k);return o=>{o&&(e(!0),clearTimeout(t))}})),B);var k;return S=setTimeout((()=>{y()}),1200),h(r,!0),u("scrolling from index to",{index:R,top:z,behavior:T},D.DEBUG),{top:z,behavior:T}}))),l),{scrollToIndex:g,topListHeight:T}}),c(ke,Z,N),{singleton:!0});const Me="up",We="down",Ve={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},je=W((([{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:n,footerHeight:r,scrollBy:i}])=>{const l=I(!1),s=I(!0),c=v(),a=v(),u=I(4),d=I(0),f=w(C(L(C(O(t),z(1),b(!0)),C(O(t),z(1),b(!1),k(100))),H()),!1),h=w(C(L(C(i,b(!0)),C(i,b(!1),k(200))),H()),!1);p(C(M(O(t),O(d)),E((([e,t])=>e<=t)),H()),s),p(C(s,B(50)),a);const m=T(C(M(e,O(o),O(n),O(r),O(u)),R(((e,[{scrollTop:t,scrollHeight:o},n,r,i,l])=>{const s={viewportHeight:n,scrollTop:t,scrollHeight:o};if(t+n-o>-l){let o,n;return t>e.state.scrollTop?(o="SCROLLED_DOWN",n=e.state.scrollTop-t):(o="SIZE_DECREASED",n=e.state.scrollTop-t||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:o,scrollTopDelta:n}}let c;return c=s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":n<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":t<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:c,state:s}}),Ve),H(((e,t)=>e&&e.atBottom===t.atBottom)))),x=w(C(e,R(((e,{scrollTop:t,scrollHeight:o,viewportHeight:n})=>{if(q(e.scrollHeight,o))return{scrollTop:t,scrollHeight:o,jump:0,changed:!1};{const r=o-(t+n)<1;return e.scrollTop!==t&&r?{scrollHeight:o,scrollTop:t,jump:e.scrollTop-t,changed:!0}:{scrollHeight:o,scrollTop:t,jump:0,changed:!0}}}),{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),y((e=>e.changed)),E((e=>e.jump))),0);p(C(m,E((e=>e.atBottom))),l),p(C(l,B(50)),c);const S=I(We);p(C(e,E((({scrollTop:e})=>e)),H(),R(((e,t)=>g(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Me:We,prevScrollTop:t}),{direction:We,prevScrollTop:0}),E((e=>e.direction))),S),p(C(e,B(50),b("none")),S);const W=I(0);return p(C(f,y((e=>!e)),b(0)),W),p(C(t,B(100),P(f),y((([e,t])=>!!t)),R((([e,t],[o])=>[t,o]),[0,0]),E((([e,t])=>t-e))),W),{isScrolling:f,isAtTop:s,isAtBottom:l,atBottomState:m,atTopStateChange:a,atBottomStateChange:c,scrollDirection:S,atBottomThreshold:u,atTopThreshold:d,scrollVelocity:W,lastJumpDueToItemResize:x}}),c(Z)),Fe=W((([{log:e}])=>{const t=I(!1),o=T(C(t,y((e=>e)),H()));return f(t,(t=>{t&&g(e)("props updated",{},D.DEBUG)})),{propsReady:t,didMount:o}}),c(N),{singleton:!0});const Ae=W((([{sizes:e,listRefresh:t,defaultItemSize:o},{scrollTop:n},{scrollToIndex:r},{didMount:i}])=>{const l=I(!0),s=I(0);return p(C(i,P(s),y((([e,t])=>!!t)),b(!1)),l),f(C(M(t,i),P(l,e,o),y((([[,e],t,{sizeTree:o},n])=>e&&(!X(o)||void 0!==n)&&!t)),P(s)),(([,e])=>{setTimeout((()=>{x(n,(()=>{h(l,!0)})),h(r,e)}))})),{scrolledToInitialItem:l,initialTopMostItemIndex:s}}),c(ke,Z,Oe,Fe),{singleton:!0});function De(e){return!!e&&("smooth"===e?"smooth":"auto")}const Ge=W((([{totalCount:e,listRefresh:t},{isAtBottom:o,atBottomState:n},{scrollToIndex:r},{scrolledToInitialItem:i},{propsReady:l,didMount:s},{log:c},{scrollingInProgress:a}])=>{const u=I(!1),d=v();let m=null;function p(e){h(r,{index:"LAST",align:"end",behavior:e})}function T(e){const t=x(n,(t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||m||(g(c)("scrolling to bottom due to increased size",{},D.DEBUG),p("auto"))}));setTimeout(t,100)}return f(C(M(C(O(e),z(1)),s),P(O(u),o,i,a),E((([[e,t],o,n,r,i])=>{let l=t&&r,s="auto";return l&&(s=((e,t)=>"function"==typeof e?De(e(t)):t&&De(e))(o,n||i),l=l&&!!s),{totalCount:e,shouldFollow:l,followOutputBehavior:s}})),y((({shouldFollow:e})=>e))),(({totalCount:e,followOutputBehavior:o})=>{m&&(m(),m=null),m=x(t,(()=>{g(c)("following output to ",{totalCount:e},D.DEBUG),p(o),m=null}))})),f(C(M(O(u),e,l),y((([e,,t])=>e&&t)),R((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),y((({refreshed:e})=>e)),P(u,e)),(([,e])=>{T(!1!==e)})),f(d,(()=>{T(!1!==g(u))})),f(M(O(u),n),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&p("auto")})),{followOutput:u,autoscrollToBottom:d}}),c(ke,je,Oe,Ae,Fe,N,Z));function Ne(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{totalCount:0,groupIndices:[]})}const _e=W((([{totalCount:e,groupIndices:t,sizes:o},{scrollTop:n,headerHeight:r}])=>{const i=v(),l=v(),s=T(C(i,E(Ne)));return p(C(s,E((e=>e.totalCount))),e),p(C(s,E((e=>e.groupIndices))),t),p(C(M(n,o,r),y((([e,t])=>ze(t))),E((([e,t,o])=>oe(t.groupOffsetTree,Math.max(e-o,0),"v")[0])),H(),E((e=>[e]))),l),{groupCounts:i,topItemsIndexes:l}}),c(ke,Z));function Ue(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function $e(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}const Ke="top",qe="bottom",Ye="none";function Ze(e,t,o){return"number"==typeof e?o===Me&&t===Ke||o===We&&t===qe?e:0:o===Me?t===Ke?e.main:e.reverse:t===qe?e.main:e.reverse}function Je(e,t){return"number"==typeof e?e:e[t]||0}const Qe=W((([{scrollTop:e,viewportHeight:t,deviation:o,headerHeight:n,fixedHeaderHeight:r}])=>{const i=v(),l=I(0),s=I(0),c=I(0);return{listBoundary:i,overscan:c,topListHeight:l,increaseViewportBy:s,visibleRange:w(C(M(O(e),O(t),O(n),O(i,Ue),O(c),O(l),O(r),O(o),O(s)),E((([e,t,o,[n,r],i,l,s,c,a])=>{const u=e-c,d=l+s,f=Math.max(o-u,0);let h=Ye;const m=Je(a,Ke),g=Je(a,qe);return n-=c,r+=o+s,(n+=o+s)>e+d-m&&(h=Me),(r-=c)<e-f+t+g&&(h=We),h!==Ye?[Math.max(u-o-Ze(i,Ke,h)-m,0),u-f-s+t+Ze(i,qe,h)+g]:null})),y((e=>null!=e)),H(Ue)),[0,0])}}),c(Z),{singleton:!0});const Xe={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function et(e,t,o){if(0===e.length)return[];if(!ze(t))return e.map((e=>({...e,index:e.index+o,originalIndex:e.index})));const n=e[0].index,r=e[e.length-1].index,i=[],l=fe(t.groupOffsetTree,n,r);let s,c=0;for(const a of e){let e;(!s||s.end<a.index)&&(s=l.shift(),c=t.groupIndices.indexOf(s.start)),e=a.index===s.start?{type:"group",index:c}:{index:a.index-(c+1)+o,groupIndex:c},i.push({...e,size:a.size,offset:a.offset,originalIndex:a.index,data:a.data})}return i}function tt(e,t,o,n,r,i){const{lastSize:l,lastOffset:s,lastIndex:c}=r;let a=0,u=0;if(e.length>0){a=e[0].offset;const t=e[e.length-1];u=t.offset+t.size}const d=o-c,f=a,h=s+d*l+(d-1)*n-u;return{items:et(e,r,i),topItems:et(t,r,i),topListHeight:t.reduce(((e,t)=>t.size+e),0),offsetTop:a,offsetBottom:h,top:f,bottom:u,totalCount:o,firstItemIndex:i}}const ot=W((([{sizes:e,totalCount:t,data:o,firstItemIndex:n,gap:r},i,{visibleRange:l,listBoundary:c,topListHeight:a},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},h,{didMount:m},{recalcInProgress:g}])=>{const x=I([]),S=v();p(i.topItemsIndexes,x);const b=w(C(M(m,g,O(l,Ue),O(t),O(e),O(d),u,O(x),O(n),O(r),o),y((([e,t])=>e&&!t)),E((([,,[e,t],o,n,r,i,l,c,a,u])=>{const d=n,{sizeTree:f,offsetTree:h}=d;if(0===o||0===e&&0===t)return{...Xe,totalCount:o};if(X(f))return tt(function(e,t,o){if(ze(t)){const n=Re(e,t);return[{index:oe(t.groupOffsetTree,n)[0],size:0,offset:0},{index:n,size:0,offset:0,data:o&&o[0]}]}return[{index:e,size:0,offset:0,data:o&&o[0]}]}(function(e,t){const o=t-1;return"number"==typeof e?e:"LAST"===e.index?o:e.index}(r,o),d,u),[],o,a,d,c);const m=[];if(l.length>0){const e=l[0],t=l[l.length-1];let o=0;for(const n of fe(f,e,t)){const r=n.value,i=Math.max(n.start,e),l=Math.min(n.end,t);for(let e=i;e<=l;e++)m.push({index:e,size:r,offset:o,data:u&&u[e]}),o+=r}}if(!i)return tt([],m,o,a,d,c);const g=l.length>0?l[l.length-1]+1:0,p=Se(h,e,t,g);if(0===p.length)return null;const x=o-1;return tt(s([],(o=>{for(const n of p){const r=n.value;let i=r.offset,l=n.start;const s=r.size;if(r.offset<e){l+=Math.floor((e-r.offset+a)/(s+a));const t=l-n.start;i+=t*s+t*a}l<g&&(i+=(g-l)*s,l=g);const c=Math.min(n.end,x);for(let e=l;e<=c&&!(i>=t);e++)o.push({index:e,size:s,offset:i,data:u&&u[e]}),i+=s+a}})),m,o,a,d,c)})),y((e=>null!==e)),H()),Xe);p(C(o,y((e=>void 0!==e)),E((e=>null==e?void 0:e.length))),t),p(C(b,E((e=>e.topListHeight))),f),p(f,a),p(C(b,E((e=>[e.top,e.bottom]))),c),p(C(b,E((e=>e.items))),S);return{listState:b,topItemsIndexes:x,endReached:T(C(b,y((({items:e})=>e.length>0)),P(t,o),y((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),E((([,e,t])=>[e-1,t])),H(Ue),E((([e])=>e)))),startReached:T(C(b,B(200),y((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),E((({items:e})=>e[0].index)),H())),rangeChanged:T(C(b,y((({items:e})=>e.length>0)),E((({items:e})=>{let t=0,o=e.length-1;for(;"group"===e[t].type&&t<o;)t++;for(;"group"===e[o].type&&o>t;)o--;return{startIndex:e[t].index,endIndex:e[o].index}})),H($e))),itemsRendered:S,...h}}),c(ke,_e,Qe,Ae,Oe,je,Fe,ve),{singleton:!0}),nt=W((([{sizes:e,firstItemIndex:t,data:o,gap:n},{listState:r},{didMount:i}])=>{const l=I(0);return p(C(i,P(l),y((([,e])=>0!==e)),P(e,t,n,o),E((([[,e],t,o,n,r=[]])=>{let i=0;if(t.groupIndices.length>0)for(const s of t.groupIndices){if(s-i>=e)break;i++}const l=e+i;return tt(Array.from({length:l}).map(((e,t)=>({index:t,size:0,offset:0,data:r[t]}))),[],l,n,t,o)}))),r),{initialItemCount:l}}),c(ke,ot,Fe),{singleton:!0}),rt=W((([{scrollVelocity:e}])=>{const t=I(!1),o=v(),n=I(!1);return p(C(e,P(n,t,o),y((([e,t])=>!!t)),E((([e,t,o,n])=>{const{exit:r,enter:i}=t;if(o){if(r(e,n))return!1}else if(i(e,n))return!0;return o})),H()),t),f(C(M(t,e,o),P(n)),(([[e,t,o],n])=>e&&n&&n.change&&n.change(t,o))),{isSeeking:t,scrollSeekConfiguration:n,scrollVelocity:e,scrollSeekRangeChanged:o}}),c(je),{singleton:!0}),it=W((([{topItemsIndexes:e}])=>{const t=I(0);return p(C(t,y((e=>e>0)),E((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),c(ot)),lt=W((([{footerHeight:e,headerHeight:t,fixedHeaderHeight:o,fixedFooterHeight:n},{listState:r}])=>{const i=v(),l=w(C(M(e,n,t,o,r),E((([e,t,o,n,r])=>e+t+o+n+r.offsetBottom+r.bottom))),0);return p(O(l),i),{totalListHeight:l,totalListHeightChanged:i}}),c(Z,ot),{singleton:!0});function st(e){let t,o=!1;return()=>(o||(o=!0,t=e()),t)}const ct=st((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),at=W((([{scrollBy:e,scrollTop:t,deviation:o,scrollingInProgress:n},{isScrolling:r,isAtBottom:i,scrollDirection:l,lastJumpDueToItemResize:s},{listState:c},{beforeUnshiftWith:a,shiftWithOffset:u,sizes:d,gap:m},{log:g},{recalcInProgress:x}])=>{const v=T(C(c,P(s),R((([,e,t,o],[{items:n,totalCount:r,bottom:i,offsetBottom:l},s])=>{const c=i+l;let a=0;if(t===r&&e.length>0&&n.length>0){0===n[0].originalIndex&&0===e[0].originalIndex||(a=c-o,0!==a&&(a+=s))}return[a,n,r,c]}),[0,[],0,0]),y((([e])=>0!==e)),P(t,l,n,i,g),y((([,e,t,o])=>!o&&0!==e&&t===Me)),E((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},D.DEBUG),e)))));function I(t){t>0?(h(e,{top:-t,behavior:"auto"}),h(o,0)):(h(o,0),h(e,{top:-t,behavior:"auto"}))}return f(C(v,P(o,r)),(([e,t,n])=>{n&&ct()?h(o,t-e):I(-e)})),f(C(M(w(r,!1),o,x),y((([e,t,o])=>!e&&!o&&0!==t)),E((([e,t])=>t)),B(1)),I),p(C(u,E((e=>({top:-e})))),e),f(C(a,P(d,m),E((([e,{lastSize:t},o])=>e*t+e*o))),(t=>{h(o,t),requestAnimationFrame((()=>{h(e,{top:t}),requestAnimationFrame((()=>{h(o,0),h(x,!1)}))}))})),{deviation:o}}),c(Z,je,ot,ke,N,ve)),ut=W((([{totalListHeight:e},{didMount:t},{scrollTo:o}])=>{const n=I(0);return f(C(t,P(n),y((([,e])=>0!==e)),E((([,e])=>({top:e})))),(t=>{x(C(e,y((e=>0!==e))),(()=>{setTimeout((()=>{h(o,t)}))}))})),{initialScrollTop:n}}),c(lt,Fe,Z),{singleton:!0}),dt=W((([{viewportHeight:e},{totalListHeight:t}])=>{const o=I(!1);return{alignToBottom:o,paddingTopAddition:w(C(M(o,e,t),y((([e])=>e)),E((([,e,t])=>Math.max(0,e-t))),H()),0)}}),c(Z,lt),{singleton:!0}),ft=W((([{scrollTo:e,scrollContainerState:t}])=>{const o=v(),n=v(),r=v(),i=I(!1),l=I(void 0);return p(C(M(o,n),E((([{viewportHeight:e,scrollTop:t,scrollHeight:o},{offsetTop:n}])=>({scrollTop:Math.max(0,t-n),scrollHeight:o,viewportHeight:e})))),t),p(C(e,P(n),E((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),r),{useWindowScroll:i,customScrollParent:l,windowScrollContainerState:o,windowViewportRect:n,windowScrollTo:r}}),c(Z)),ht=W((([{sizes:e,totalCount:t,gap:o},{scrollTop:n,viewportHeight:r,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:s,scrollingInProgress:c},{scrollToIndex:a}])=>{const u=v();return p(C(u,P(e,r,t,i,l,s,n),P(o),E((([[e,t,o,n,r,i,l,s],a])=>{const{done:u,behavior:d,align:f,...h}=e;let m=null;const g=be(e,t,n-1),p=Ee(g,t.offsetTree,a)+r+i;if(p<s+i)m={...h,behavior:d,align:f??"start"};else{p+oe(t.sizeTree,g)[1]>s+o-l&&(m={...h,behavior:d,align:f??"end"})}return m?u&&x(C(c,z(1),y((e=>!1===e))),u):u&&u(),m})),y((e=>null!==e))),a),{scrollIntoView:u}}),c(ke,Z,Oe,ot,N),{singleton:!0}),mt=W((([e,t,o,n,r,i,l,s,c])=>({...e,...t,...o,...n,...r,...i,...l,...s,...c})),c(Qe,nt,Fe,rt,lt,ut,dt,ft,ht)),gt=W((([{totalCount:e,sizeRanges:t,fixedItemSize:o,defaultItemSize:n,trackItemSizes:r,itemSize:i,data:l,firstItemIndex:s,groupIndices:c,statefulTotalCount:a,gap:u},{initialTopMostItemIndex:d,scrolledToInitialItem:f},h,m,{listState:g,topItemsIndexes:x,...v},{scrollToIndex:I},T,{topItemCount:w},{groupCounts:S},H,y])=>(p(v.rangeChanged,H.scrollSeekRangeChanged),p(C(H.windowViewportRect,E((e=>e.visibleHeight))),h.viewportHeight),{totalCount:e,data:l,firstItemIndex:s,sizeRanges:t,initialTopMostItemIndex:d,scrolledToInitialItem:f,topItemsIndexes:x,topItemCount:w,groupCounts:S,fixedItemHeight:o,defaultItemHeight:n,gap:u,...m,statefulTotalCount:a,listState:g,scrollToIndex:I,trackItemSizes:r,itemSize:i,groupIndices:c,...v,...H,...h,...y})),c(ke,Ae,Z,Ge,ot,Oe,at,it,_e,mt,N)),pt="-webkit-sticky",xt="sticky",vt=st((()=>{if("undefined"==typeof document)return xt;const e=document.createElement("div");return e.style.position=pt,e.style.position===pt?pt:xt}));function It(e,o){const n=t.useRef(null),r=t.useCallback((t=>{if(null===t||!t.offsetParent)return;const r=t.getBoundingClientRect(),i=r.width;let l,s;if(o){const e=o.getBoundingClientRect(),t=r.top-e.top;l=e.height-Math.max(0,t),s=t+o.scrollTop}else l=window.innerHeight-Math.max(0,r.top),s=r.top+window.pageYOffset;n.current={offsetTop:s,visibleHeight:l,visibleWidth:i},e(n.current)}),[e,o]),{callbackRef:i,ref:l}=_(r),s=t.useCallback((()=>{r(l.current)}),[r,l]);return t.useEffect((()=>{if(o){o.addEventListener("scroll",s);const e=new ResizeObserver(s);return e.observe(o),()=>{o.removeEventListener("scroll",s),e.unobserve(o)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}}),[s,o]),i}const Tt=t.createContext(void 0),wt=t.createContext(void 0);function Ct(e){return e}const St=W((([e,t])=>({...e,...t})),c(gt,W((()=>{const e=I((e=>`Item ${e}`)),t=I(null),o=I((e=>`Group ${e}`)),n=I({}),r=I(Ct),i=I("div"),l=I(d),s=(e,t=null)=>w(C(n,E((t=>t[e])),H()),t);return{context:t,itemContent:e,groupContent:o,components:n,computeItemKey:r,headerFooterTag:i,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}})))),Ht=({height:t})=>e.jsx("div",{style:{height:t}}),yt={position:vt(),zIndex:1,overflowAnchor:"none"},Et={overflowAnchor:"none"},bt=t.memo((function({showTopList:e=!1}){const o=Gt("listState"),n=Dt("sizeRanges"),r=Gt("useWindowScroll"),i=Gt("customScrollParent"),l=Dt("windowScrollContainerState"),s=Dt("scrollContainerState"),c=i||r?l:s,a=Gt("itemContent"),u=Gt("context"),f=Gt("groupContent"),h=Gt("trackItemSizes"),m=Gt("itemSize"),g=Gt("log"),p=Dt("gap"),{callbackRef:x}=$(n,m,h,e?d:c,g,p,i),[v,I]=t.useState(0);Nt("deviation",(e=>{v!==e&&I(e)}));const T=Gt("EmptyPlaceholder"),w=Gt("ScrollSeekPlaceholder")||Ht,C=Gt("ListComponent"),S=Gt("ItemComponent"),H=Gt("GroupComponent"),y=Gt("computeItemKey"),E=Gt("isSeeking"),b=Gt("groupIndices").length>0,R=Gt("paddingTopAddition"),z=e?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+R,paddingBottom:o.offsetBottom,marginTop:v};return!e&&0===o.totalCount&&T?t.createElement(T,kt(T,u)):t.createElement(C,{...kt(C,u),ref:x,style:z,"data-test-id":e?"virtuoso-top-item-list":"virtuoso-item-list"},(e?o.topItems:o.items).map((e=>{const n=e.originalIndex,r=y(n+o.firstItemIndex,e.data,u);return E?t.createElement(w,{...kt(w,u),key:r,index:e.index,height:e.size,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?t.createElement(H,{...kt(H,u),key:r,"data-index":n,"data-known-size":e.size,"data-item-index":e.index,style:yt},f(e.index)):t.createElement(S,{...kt(S,u),key:r,"data-index":n,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,item:e.data,style:Et},b?a(e.index,e.groupIndex,e.data,u):a(e.index,e.data,u))})))})),Rt={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},zt={width:"100%",height:"100%",position:"absolute",top:0},Bt={width:"100%",position:vt(),top:0,zIndex:1};function kt(e,t){if("string"!=typeof e)return{context:t}}const Pt=t.memo((function(){const e=Gt("HeaderComponent"),o=Dt("headerHeight"),n=Gt("headerFooterTag"),r=U((e=>o(K(e,"height")))),i=Gt("context");return e?t.createElement(n,{ref:r},t.createElement(e,kt(e,i))):null})),Lt=t.memo((function(){const e=Gt("FooterComponent"),o=Dt("footerHeight"),n=Gt("headerFooterTag"),r=U((e=>o(K(e,"height")))),i=Gt("context");return e?t.createElement(n,{ref:r},t.createElement(e,kt(e,i))):null}));function Ot({usePublisher:e,useEmitter:o,useEmitterValue:n}){return t.memo((function({style:r,children:i,...l}){const s=e("scrollContainerState"),c=n("ScrollerComponent"),a=e("smoothScrollTargetReached"),u=n("scrollerRef"),d=n("context"),{scrollerRef:f,scrollByCallback:h,scrollToCallback:m}=Y(s,a,c,u);return o("scrollTo",m),o("scrollBy",h),t.createElement(c,{ref:f,style:{...Rt,...r},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...kt(c,d)},i)}))}function Mt({usePublisher:e,useEmitter:o,useEmitterValue:n}){return t.memo((function({style:r,children:i,...l}){const s=e("windowScrollContainerState"),c=n("ScrollerComponent"),a=e("smoothScrollTargetReached"),u=n("totalListHeight"),f=n("deviation"),h=n("customScrollParent"),m=n("context"),{scrollerRef:g,scrollByCallback:p,scrollToCallback:x}=Y(s,a,c,d,h);return A((()=>(g.current=h||window,()=>{g.current=null})),[g,h]),o("windowScrollTo",x),o("scrollBy",p),t.createElement(c,{style:{position:"relative",...r,...0!==u?{height:u+f}:{}},"data-virtuoso-scroller":!0,...l,...kt(c,m)},i)}))}const Wt=({children:o})=>{const r=t.useContext(Tt),i=Dt("viewportHeight"),l=Dt("fixedItemHeight"),s=U(n(i,(e=>K(e,"height"))));return t.useEffect((()=>{r&&(i(r.viewportHeight),l(r.itemHeight))}),[r,i,l]),e.jsx("div",{style:zt,ref:s,"data-viewport-type":"element",children:o})},Vt=({children:o})=>{const n=t.useContext(Tt),r=Dt("windowViewportRect"),i=Dt("fixedItemHeight"),l=Gt("customScrollParent"),s=It(r,l);return t.useEffect((()=>{n&&(i(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))}),[n,r,i]),e.jsx("div",{ref:s,style:zt,"data-viewport-type":"window",children:o})},jt=({children:e})=>{const o=Gt("TopItemListComponent"),n=Gt("headerHeight"),r={...Bt,marginTop:`${n}px`},i=Gt("context");return t.createElement(o||"div",{style:r,context:i},e)},Ft=t.memo((function(t){const o=Gt("useWindowScroll"),n=Gt("topItemsIndexes").length>0,r=Gt("customScrollParent"),i=r||o?Ut:_t,l=r||o?Vt:Wt;return e.jsxs(i,{...t,children:[n&&e.jsx(jt,{children:e.jsx(bt,{showTopList:!0})}),e.jsxs(l,{children:[e.jsx(Pt,{}),e.jsx(bt,{}),e.jsx(Lt,{})]})]})})),{Component:At,usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}=F(St,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ft),_t=Ot({usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}),Ut=Mt({usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}),$t=At,Kt=At,qt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Yt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Zt,ceil:Jt,floor:Qt,min:Xt,max:eo}=Math;function to(e,t,o){return Array.from({length:t-e+1}).map(((t,n)=>({index:n+e,data:null==o?void 0:o[n+e]})))}function oo(e,t){return e&&e.column===t.column&&e.row===t.row}const no=W((([{overscan:e,visibleRange:t,listBoundary:o},{scrollTop:n,viewportHeight:r,scrollBy:i,scrollTo:l,smoothScrollTargetReached:s,scrollContainerState:c,footerHeight:a,headerHeight:u},d,f,{propsReady:h,didMount:m},{windowViewportRect:g,windowScrollTo:x,useWindowScroll:S,customScrollParent:R,windowScrollContainerState:z},B])=>{const k=I(0),L=I(0),W=I(qt),V=I({height:0,width:0}),j=I({height:0,width:0}),F=v(),A=v(),D=I(0),G=I(void 0),N=I({row:0,column:0});p(C(M(m,L,G),y((([,e])=>0!==e)),E((([,e,t])=>({items:to(0,e-1,t),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0})))),W),p(C(M(O(k),t,O(N,oo),O(j,((e,t)=>e&&e.width===t.width&&e.height===t.height)),G),P(V),E((([[e,[t,o],n,r,i],l])=>{const{row:s,column:c}=n,{height:a,width:u}=r,{width:d}=l;if(0===e||0===d)return qt;if(0===u)return function(e){return{...Yt,items:e}}(to(0,0,i));const f=lo(d,u,c);let h=f*Qt((t+s)/(a+s)),m=f*Jt((o+s)/(a+s))-1;m=Xt(e-1,eo(m,f-1)),h=Xt(m,eo(0,h));const g=to(h,m,i),{top:p,bottom:x}=ro(l,n,r,g),v=Jt(e/f);return{items:g,offsetTop:p,offsetBottom:v*a+(v-1)*s-x,top:p,bottom:x,itemHeight:a,itemWidth:u}}))),W),p(C(G,y((e=>void 0!==e)),E((e=>e.length))),k),p(C(V,E((({height:e})=>e))),r),p(C(M(V,j,W,N),E((([e,t,{items:o},n])=>{const{top:r,bottom:i}=ro(e,n,t,o);return[r,i]})),H(Ue)),o);const _=T(C(O(W),y((({items:e})=>e.length>0)),P(k),y((([{items:e},t])=>e[e.length-1].index===t-1)),E((([,e])=>e-1)),H())),U=T(C(O(W),y((({items:e})=>e.length>0&&0===e[0].index)),b(0),H())),$=T(C(O(W),y((({items:e})=>e.length>0)),E((({items:e})=>({startIndex:e[0].index,endIndex:e[e.length-1].index}))),H($e)));p($,f.scrollSeekRangeChanged),p(C(F,P(V,j,k,N),E((([e,t,o,n,r])=>{const i=Le(e),{align:l,behavior:s,offset:c}=i;let a=i.index;"LAST"===a&&(a=n-1),a=eo(0,a,Xt(n-1,a));let u=io(t,r,o,a);return"end"===l?u=Zt(u-t.height+o.height):"center"===l&&(u=Zt(u-t.height/2+o.height/2)),c&&(u+=c),{top:u,behavior:s}}))),l);const K=w(C(W,E((e=>e.offsetBottom+e.bottom))),0);return p(C(g,E((e=>({width:e.visibleWidth,height:e.visibleHeight})))),V),{data:G,totalCount:k,viewportDimensions:V,itemDimensions:j,scrollTop:n,scrollHeight:A,overscan:e,scrollBy:i,scrollTo:l,scrollToIndex:F,smoothScrollTargetReached:s,windowViewportRect:g,windowScrollTo:x,useWindowScroll:S,customScrollParent:R,windowScrollContainerState:z,deviation:D,scrollContainerState:c,footerHeight:a,headerHeight:u,initialItemCount:L,gap:N,...f,gridState:W,totalListHeight:K,...d,startReached:U,endReached:_,rangeChanged:$,propsReady:h,...B}}),c(Qe,Z,je,rt,Fe,ft,N));function ro(e,t,o,n){const{height:r}=o;if(void 0===r||0===n.length)return{top:0,bottom:0};return{top:io(e,t,o,n[0].index),bottom:io(e,t,o,n[n.length-1].index)+r}}function io(e,t,o,n){const r=lo(e.width,o.width,t.column),i=Qt(n/r),l=i*o.height+eo(0,i-1)*t.row;return l>0?l+t.row:l}function lo(e,t,o){return eo(1,Qt((e+o)/(t+o)))}const so=W((([e,t])=>({...e,...t})),c(no,W((()=>{const e=I((e=>`Item ${e}`)),t=I({}),o=I(null),n=I("virtuoso-grid-item"),r=I("virtuoso-grid-list"),i=I(Ct),l=I("div"),s=I(d),c=(e,o=null)=>w(C(t,E((t=>t[e])),H()),o);return{context:o,itemContent:e,components:t,computeItemKey:i,itemClassName:n,listClassName:r,headerFooterTag:l,scrollerRef:s,FooterComponent:c("Footer"),HeaderComponent:c("Header"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),ScrollerComponent:c("Scroller","div"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}})))),co=t.memo((function(){const e=xo("gridState"),o=xo("listClassName"),n=xo("itemClassName"),r=xo("itemContent"),i=xo("computeItemKey"),l=xo("isSeeking"),s=po("scrollHeight"),c=xo("ItemComponent"),a=xo("ListComponent"),u=xo("ScrollSeekPlaceholder"),d=xo("context"),f=po("itemDimensions"),h=po("gap"),m=xo("log"),g=U((e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const o=e.firstChild;o&&f(o.getBoundingClientRect()),h({row:wo("row-gap",getComputedStyle(e).rowGap,m),column:wo("column-gap",getComputedStyle(e).columnGap,m)})}));return t.createElement(a,{ref:g,className:o,...kt(a,d),style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom},"data-test-id":"virtuoso-item-list"},e.items.map((o=>{const s=i(o.index,o.data,d);return l?t.createElement(u,{key:s,...kt(u,d),index:o.index,height:e.itemHeight,width:e.itemWidth}):t.createElement(c,{...kt(c,d),className:n,"data-index":o.index,key:s},r(o.index,o.data,d))})))})),ao=t.memo((function(){const e=xo("HeaderComponent"),o=po("headerHeight"),n=xo("headerFooterTag"),r=U((e=>o(K(e,"height")))),i=xo("context");return e?t.createElement(n,{ref:r},t.createElement(e,kt(e,i))):null})),uo=t.memo((function(){const e=xo("FooterComponent"),o=po("footerHeight"),n=xo("headerFooterTag"),r=U((e=>o(K(e,"height")))),i=xo("context");return e?t.createElement(n,{ref:r},t.createElement(e,kt(e,i))):null})),fo=({children:o})=>{const n=t.useContext(wt),r=po("itemDimensions"),i=po("viewportDimensions"),l=U((e=>{i(e.getBoundingClientRect())}));return t.useEffect((()=>{n&&(i({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))}),[n,i,r]),e.jsx("div",{style:zt,ref:l,children:o})},ho=({children:o})=>{const n=t.useContext(wt),r=po("windowViewportRect"),i=po("itemDimensions"),l=xo("customScrollParent"),s=It(r,l);return t.useEffect((()=>{n&&(i({height:n.itemHeight,width:n.itemWidth}),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))}),[n,r,i]),e.jsx("div",{ref:s,style:zt,children:o})},mo=t.memo((function({...t}){const o=xo("useWindowScroll"),n=xo("customScrollParent"),r=n||o?To:Io,i=n||o?ho:fo;return e.jsx(r,{...t,children:e.jsxs(i,{children:[e.jsx(ao,{}),e.jsx(co,{}),e.jsx(uo,{})]})})})),{Component:go,usePublisher:po,useEmitterValue:xo,useEmitter:vo}=F(so,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},mo),Io=Ot({usePublisher:po,useEmitterValue:xo,useEmitter:vo}),To=Mt({usePublisher:po,useEmitterValue:xo,useEmitter:vo});function wo(e,t,o){return"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN),"normal"===t?0:parseInt(t??"0",10)}const Co=go,So=W((([e,t])=>({...e,...t})),c(gt,W((()=>{const t=I((t=>e.jsxs("td",{children:["Item $",t]}))),o=I(null),n=I(null),r=I(null),i=I({}),l=I(Ct),s=I(d),c=(e,t=null)=>w(C(i,E((t=>t[e])),H()),t);return{context:o,itemContent:t,fixedHeaderContent:n,fixedFooterContent:r,components:i,computeItemKey:l,scrollerRef:s,TableComponent:c("Table","table"),TableHeadComponent:c("TableHead","thead"),TableFooterComponent:c("TableFoot","tfoot"),TableBodyComponent:c("TableBody","tbody"),TableRowComponent:c("TableRow","tr"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),FillerRow:c("FillerRow")}})))),Ho=({height:t})=>e.jsx("tr",{children:e.jsx("td",{style:{height:t}})}),yo=({height:t})=>e.jsx("tr",{children:e.jsx("td",{style:{height:t,padding:0,border:0}})}),Eo=t.memo((function(){const o=Po("listState"),n=ko("sizeRanges"),r=Po("useWindowScroll"),i=Po("customScrollParent"),l=ko("windowScrollContainerState"),s=ko("scrollContainerState"),c=i||r?l:s,a=Po("itemContent"),u=Po("trackItemSizes"),d=Po("itemSize"),f=Po("log"),{callbackRef:h,ref:m}=$(n,d,u,c,f,void 0,i),[g,p]=t.useState(0);Lo("deviation",(e=>{g!==e&&(m.current.style.marginTop=`${e}px`,p(e))}));const x=Po("EmptyPlaceholder"),v=Po("ScrollSeekPlaceholder")||Ho,I=Po("FillerRow")||yo,T=Po("TableBodyComponent"),w=Po("TableRowComponent"),C=Po("computeItemKey"),S=Po("isSeeking"),H=Po("paddingTopAddition"),y=Po("firstItemIndex"),E=Po("statefulTotalCount"),b=Po("context");if(0===E&&x)return t.createElement(x,kt(x,b));const R=o.offsetTop+H+g,z=o.offsetBottom,B=R>0?e.jsx(I,{height:R,context:b},"padding-top"):null,k=z>0?e.jsx(I,{height:z,context:b},"padding-bottom"):null,P=o.items.map((e=>{const o=e.originalIndex,n=C(o+y,e.data,b);return S?t.createElement(v,{...kt(v,b),key:n,index:e.index,height:e.size,type:e.type||"item"}):t.createElement(w,{...kt(w,b),key:n,"data-index":o,"data-known-size":e.size,"data-item-index":e.index,item:e.data,style:{overflowAnchor:"none"}},a(e.index,e.data,b))}));return t.createElement(T,{ref:h,"data-test-id":"virtuoso-item-list",...kt(T,b)},[B,...P,k])})),bo=({children:o})=>{const r=t.useContext(Tt),i=ko("viewportHeight"),l=ko("fixedItemHeight"),s=U(n(i,(e=>K(e,"height"))));return t.useEffect((()=>{r&&(i(r.viewportHeight),l(r.itemHeight))}),[r,i,l]),e.jsx("div",{style:zt,ref:s,"data-viewport-type":"element",children:o})},Ro=({children:o})=>{const n=t.useContext(Tt),r=ko("windowViewportRect"),i=ko("fixedItemHeight"),l=Po("customScrollParent"),s=It(r,l);return t.useEffect((()=>{n&&(i(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))}),[n,r,i]),e.jsx("div",{ref:s,style:zt,"data-viewport-type":"window",children:o})},zo=t.memo((function(o){const r=Po("useWindowScroll"),i=Po("customScrollParent"),l=ko("fixedHeaderHeight"),s=ko("fixedFooterHeight"),c=Po("fixedHeaderContent"),a=Po("fixedFooterContent"),u=Po("context"),d=U(n(l,(e=>K(e,"height")))),f=U(n(s,(e=>K(e,"height")))),h=i||r?Mo:Oo,m=i||r?Ro:bo,g=Po("TableComponent"),p=Po("TableHeadComponent"),x=Po("TableFooterComponent"),v=c?t.createElement(p,{key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:d,...kt(p,u)},c()):null,I=a?t.createElement(x,{key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:f,...kt(x,u)},a()):null;return e.jsx(h,{...o,children:e.jsx(m,{children:t.createElement(g,{style:{borderSpacing:0},...kt(g,u)},[v,e.jsx(Eo,{},"TableBody"),I])})})})),{Component:Bo,usePublisher:ko,useEmitterValue:Po,useEmitter:Lo}=F(So,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},zo),Oo=Ot({usePublisher:ko,useEmitterValue:Po,useEmitter:Lo}),Mo=Mt({usePublisher:ko,useEmitterValue:Po,useEmitter:Lo}),Wo=Bo;exports.GroupedVirtuoso=Kt,exports.LogLevel=D,exports.TableVirtuoso=Wo,exports.Virtuoso=$t,exports.VirtuosoGrid=Co,exports.VirtuosoGridMockContext=wt,exports.VirtuosoMockContext=Tt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("react-dom");function o(e,t){return o=>e(t(o))}function n(e,t){return t(e)}function r(e,t){return o=>e(t,o)}function i(e,t){return()=>e(t)}function l(e,t){return t(e),e}function s(...e){return e}function c(e){e()}function a(e){return()=>e}function u(){}function d(e,t){return e(1,t)}function f(e,t){e(0,t)}function m(e){e(2)}function h(e){return e(4)}function g(e,t){return d(e,r(t,0))}function p(e,t){const o=e(1,(e=>{o(),t(e)}));return o}function v(){const e=[];return(t,o)=>{switch(t){case 2:return void e.splice(0,e.length);case 1:return e.push(o),()=>{const t=e.indexOf(o);t>-1&&e.splice(t,1)};case 0:return void e.slice().forEach((e=>{e(o)}));default:throw new Error(`unrecognized action ${t}`)}}}function x(e){let t=e;const o=v();return(e,n)=>{switch(e){case 1:n(t);break;case 0:t=n;break;case 4:return t}return o(e,n)}}function I(e){return l(v(),(t=>g(e,t)))}function T(e,t){return l(x(t),(t=>g(e,t)))}function w(e,...t){const o=function(...e){return t=>e.reduceRight(n,t)}(...t);return(t,n)=>{switch(t){case 1:return d(e,o(n));case 2:return void m(e)}}}function C(e,t){return e===t}function S(e=C){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function E(e){return t=>o=>{e(o)&&t(o)}}function H(e){return t=>o(t,e)}function y(e){return t=>()=>t(e)}function b(e,t){return o=>n=>o(t=e(t,n))}function R(e){return t=>o=>{e>0?e--:t(o)}}function z(e){let t,o;return n=>r=>{t=r,o||(o=setTimeout((()=>{o=void 0,n(t)}),e))}}function B(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout((()=>{n(t)}),e)}}function k(...e){const t=new Array(e.length);let o=0,n=null;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);d(e,(e=>{const s=o;o|=l,t[i]=e,s!==r&&o===r&&n&&(n(),n=null)}))})),e=>i=>{const l=()=>e([i].concat(t));o===r?l():n=l}}function P(...e){return function(t,o){switch(t){case 1:return function(...e){return()=>{e.map(c)}}(...e.map((e=>d(e,o))));case 2:return;default:throw new Error(`unrecognized action ${t}`)}}}function L(e,t=C){return w(e,S(t))}function O(...e){const t=v(),o=new Array(e.length);let n=0;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);d(e,(e=>{o[i]=e,n|=l,n===r&&f(t,o)}))})),function(e,i){switch(e){case 1:return n===r&&i(o),d(t,i);case 2:return m(t);default:throw new Error(`unrecognized action ${e}`)}}}function M(e,t=[],{singleton:o}={singleton:!0}){return{id:W(),constructor:e,dependencies:t,singleton:o}}const W=()=>Symbol();const V="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function F(t,o,n){const s=Object.keys(o.required||{}),c=Object.keys(o.optional||{}),g=Object.keys(o.methods||{}),p=Object.keys(o.events||{}),v=e.createContext({});function x(e,t){e.propsReady&&f(e.propsReady,!1);for(const n of s){f(e[o.required[n]],t[n])}for(const n of c)if(n in t){f(e[o.optional[n]],t[n])}e.propsReady&&f(e.propsReady,!0)}function I(e){return p.reduce(((t,n)=>(t[n]=function(e){let t,o;const n=()=>t&&t();return function(r,i){switch(r){case 1:if(i){if(o===i)return;return n(),o=i,t=d(e,i),t}return n(),u;case 2:return n(),void(o=null);default:throw new Error(`unrecognized action ${r}`)}}}(e[o.events[n]]),t)),{})}const T=e.forwardRef(((r,u)=>{const{children:h,...T}=r,[w]=e.useState((()=>l(function(e){const t=new Map,o=({id:e,constructor:n,dependencies:r,singleton:i})=>{if(i&&t.has(e))return t.get(e);const l=n(r.map((e=>o(e))));return i&&t.set(e,l),l};return o(e)}(t),(e=>x(e,T))))),[C]=e.useState(i(I,w));return V((()=>{for(const e of p)e in T&&d(C[e],T[e]);return()=>{Object.values(C).map(m)}}),[T,C,w]),V((()=>{x(w,T)})),e.useImperativeHandle(u,a(function(e){return g.reduce(((t,n)=>(t[n]=t=>{f(e[o.methods[n]],t)},t)),{})}(w))),e.createElement(v.Provider,{value:w},n?e.createElement(n,function(e,t){const o={},n={};let r=0;const i=e.length;for(;r<i;)n[e[r]]=1,r+=1;for(const l in t)n.hasOwnProperty(l)||(o[l]=t[l]);return o}([...s,...c,...p],T),h):h)}));return{Component:T,usePublisher:t=>e.useCallback(r(f,e.useContext(v)[t]),[t]),useEmitterValue:t=>{const o=e.useContext(v)[t],[n,r]=e.useState(i(h,o));return V((()=>d(o,(e=>{e!==n&&r(a(e))}))),[o,n]),n},useEmitter:(t,o)=>{const n=e.useContext(v)[t];V((()=>d(n,o)),[o,n])}}}const A="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;var D=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(D||{});const G={0:"debug",1:"log",2:"warn",3:"error"},N=M((()=>{const e=x(3);return{log:x(((t,o,n=1)=>{n>=(("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL??h(e))&&console[G[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)})),logLevel:e}}),[],{singleton:!0});function _(t,o=!0){const n=e.useRef(null);let r=e=>{};if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver((e=>{const o=e[0].target;null!==o.offsetParent&&t(o)}));r=t=>{t&&o?(e.observe(t),n.current=t):(n.current&&e.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function U(e,t=!0){return _(e,t).callbackRef}function $(e,t,o,n,r,i,l){return _((o=>{const s=function(e,t,o,n){const r=e.length;if(0===r)return null;const i=[];for(let l=0;l<r;l++){const r=e.item(l);if(!r||void 0===r.dataset.index)continue;const s=parseInt(r.dataset.index),c=parseFloat(r.dataset.knownSize),a=t(r,o);if(0===a&&n("Zero-sized element, this should not happen",{child:r},D.ERROR),a===c)continue;const u=i[i.length-1];0===i.length||u.size!==a||u.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:a}):i[i.length-1].endIndex++}return i}(o.children,t,"offsetHeight",r);let c=o.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const a="window"===c.lastElementChild.dataset.viewportType,u=l?l.scrollTop:a?window.pageYOffset||document.documentElement.scrollTop:c.scrollTop,d=l?l.scrollHeight:a?document.documentElement.scrollHeight:c.scrollHeight,f=l?l.offsetHeight:a?window.innerHeight:c.offsetHeight;n({scrollTop:Math.max(u,0),scrollHeight:d,viewportHeight:f}),null==i||i(function(e,t,o){"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN);if("normal"===t)return 0;return parseInt(t??"0",10)}("row-gap",getComputedStyle(o).rowGap,r)),null!==s&&e(s)}),o)}function j(e,t){return Math.round(e.getBoundingClientRect()[t])}function K(e,t){return Math.abs(e-t)<1.01}function q(o,n,r,i=u,l){const s=e.useRef(null),c=e.useRef(null),a=e.useRef(null),d=e.useCallback((e=>{const r=e.target,i=r===window||r===document,l=i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,s=i?document.documentElement.scrollHeight:r.scrollHeight,u=i?window.innerHeight:r.offsetHeight,d=()=>{o({scrollTop:Math.max(l,0),scrollHeight:s,viewportHeight:u})};e.suppressFlushSync?d():t.flushSync(d),null!==c.current&&(l===c.current||l<=0||l===s-u)&&(c.current=null,n(!0),a.current&&(clearTimeout(a.current),a.current=null))}),[o,n]);return e.useEffect((()=>{const e=l||s.current;return i(l||s.current),d({target:e,suppressFlushSync:!0}),e.addEventListener("scroll",d,{passive:!0}),()=>{i(null),e.removeEventListener("scroll",d)}}),[s,d,r,i,l]),{scrollerRef:s,scrollByCallback:function(e){s.current.scrollBy(e)},scrollToCallback:function(e){const t=s.current;if(!t||"offsetHeight"in t&&0===t.offsetHeight)return;const r="smooth"===e.behavior;let i,l,u;t===window?(l=Math.max(j(document.documentElement,"height"),document.documentElement.scrollHeight),i=window.innerHeight,u=document.documentElement.scrollTop):(l=t.scrollHeight,i=j(t,"height"),u=t.scrollTop);const d=l-i;if(e.top=Math.ceil(Math.max(Math.min(d,e.top),0)),K(i,l)||e.top===u)return o({scrollTop:u,scrollHeight:l,viewportHeight:i}),void(r&&n(!0));r?(c.current=e.top,a.current&&clearTimeout(a.current),a.current=setTimeout((()=>{a.current=null,c.current=null,n(!0)}),1e3)):c.current=null,t.scrollTo(e)}}}const Y=M((()=>{const e=v(),t=v(),o=x(0),n=v(),r=x(0),i=v(),l=v(),s=x(0),c=x(0),a=x(0),u=x(0),d=v(),f=v(),m=x(!1);return g(w(e,H((({scrollTop:e})=>e))),t),g(w(e,H((({scrollHeight:e})=>e))),l),g(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:i,headerHeight:s,fixedHeaderHeight:c,fixedFooterHeight:a,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:n,scrollTo:d,scrollBy:f,statefulScrollTop:r,deviation:o,scrollingInProgress:m}}),[],{singleton:!0}),Z={lvl:0};function J(e,t,o,n=Z,r=Z){return{k:e,v:t,lvl:o,l:n,r:r}}function Q(e){return e===Z}function X(){return Z}function ee(e,t){if(Q(e))return Z;const{k:o,l:n,r:r}=e;if(t===o){if(Q(n))return r;if(Q(r))return n;{const[t,o]=ie(n);return ue(se(e,{k:t,v:o,l:le(n)}))}}return ue(se(e,t<o?{l:ee(n,t)}:{r:ee(r,t)}))}function te(e,t,o="k"){if(Q(e))return[-1/0,void 0];if(e[o]===t)return[e.k,e.v];if(e[o]<t){const n=te(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return te(e.l,t,o)}function oe(e,t,o){return Q(e)?J(t,o,1):t===e.k?se(e,{k:t,v:o}):t<e.k?ae(se(e,{l:oe(e.l,t,o)})):ae(se(e,{r:oe(e.r,t,o)}))}function ne(e,t,o){if(Q(e))return[];const{k:n,v:r,l:i,r:l}=e;let s=[];return n>t&&(s=s.concat(ne(i,t,o))),n>=t&&n<=o&&s.push({k:n,v:r}),n<=o&&(s=s.concat(ne(l,t,o))),s}function re(e){return Q(e)?[]:[...re(e.l),{k:e.k,v:e.v},...re(e.r)]}function ie(e){return Q(e.r)?[e.k,e.v]:ie(e.r)}function le(e){return Q(e.r)?e.l:ue(se(e,{r:le(e.r)}))}function se(e,t){return J(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function ce(e){return Q(e)||e.lvl>e.r.lvl}function ae(e){return me(he(e))}function ue(e){const{l:t,r:o,lvl:n}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(ce(t))return he(se(e,{lvl:n-1}));if(Q(t)||Q(t.r))throw new Error("Unexpected empty nodes");return se(t.r,{l:se(t,{r:t.r.l}),r:se(e,{l:t.r.r,lvl:n-1}),lvl:n})}if(ce(e))return me(se(e,{lvl:n-1}));if(Q(o)||Q(o.l))throw new Error("Unexpected empty nodes");{const t=o.l,r=ce(t)?o.lvl-1:o.lvl;return se(t,{l:se(e,{r:t.l,lvl:n-1}),r:me(se(o,{l:t.r,lvl:r})),lvl:t.lvl+1})}}function de(e,t,o){if(Q(e))return[];const n=te(e,t)[0];return fe(ne(e,n,o),(({k:e,v:t})=>({index:e,value:t})))}function fe(e,t){const o=e.length;if(0===o)return[];let{index:n,value:r}=t(e[0]);const i=[];for(let l=1;l<o;l++){const{index:o,value:s}=t(e[l]);i.push({start:n,end:o-1,value:r}),n=o,r=s}return i.push({start:n,end:1/0,value:r}),i}function me(e){const{r:t,lvl:o}=e;return Q(t)||Q(t.r)||t.lvl!==o||t.r.lvl!==o?e:se(t,{l:se(e,{r:t.l}),lvl:o+1})}function he(e){const{l:t}=e;return Q(t)||t.lvl!==e.lvl?e:se(t,{r:se(e,{l:t.r})})}function ge(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),l=o(e[i],t);if(0===l)return i;if(-1===l){if(r-n<2)return i-1;r=i-1}else{if(r===n)return i;n=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function pe(e,t,o){return e[ge(e,t,o)]}const ve=M((()=>({recalcInProgress:x(!1)})),[],{singleton:!0});function xe(e){const{size:t,startIndex:o,endIndex:n}=e;return e=>e.start===o&&(e.end===n||e.end===1/0)&&e.value===t}function Ie({index:e},t){return t===e?0:t<e?-1:1}function Te({offset:e},t){return t===e?0:t<e?-1:1}function we(e){return{index:e.index,value:e}}function Ce(e,t,o,n=0){return n>0&&(t=Math.max(t,pe(e,n,Ie).offset)),fe(function(e,t,o,n){const r=ge(e,t,n),i=ge(e,o,n,r);return e.slice(r,i+1)}(e,t,o,Te),we)}function Se(e,t,o,n){let r=e,i=0,l=0,s=0,c=0;if(0!==t){c=ge(r,t-1,Ie);s=r[c].offset;const e=te(o,t-1);i=e[0],l=e[1],r.length&&r[c].size===te(o,t)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:u}of de(o,t,1/0)){const e=a-i,t=e*l+s+e*n;r.push({offset:t,size:u,index:a}),i=a,s=t,l=u}return{offsetTree:r,lastIndex:i,lastOffset:s,lastSize:l}}function Ee(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,D.DEBUG);const i=e.sizeTree;let l=i,s=0;if(o.length>0&&Q(i)&&2===t.length){const e=t[0].size,n=t[1].size;l=o.reduce(((t,o)=>oe(oe(t,o,e),o+1,n)),l)}else[l,s]=function(e,t){let o=Q(e)?0:1/0;for(const n of t){const{size:t,startIndex:r,endIndex:i}=n;if(o=Math.min(o,r),Q(e)){e=oe(e,0,t);continue}const l=de(e,r-1,i+1);if(l.some(xe(n)))continue;let s=!1,c=!1;for(const{start:o,end:n,value:a}of l)s?(i>=o||t===a)&&(e=ee(e,o)):(c=a!==t,s=!0),n>i&&i>=o&&a!==t&&(e=oe(e,i+1,a));c&&(e=oe(e,r,t))}return[e,o]}(l,t);if(l===i)return e;const{offsetTree:c,lastIndex:a,lastSize:u,lastOffset:d}=Se(e.offsetTree,s,l,r);return{sizeTree:l,offsetTree:c,lastIndex:a,lastOffset:d,lastSize:u,groupOffsetTree:o.reduce(((e,t)=>oe(e,t,He(t,c,r))),X()),groupIndices:o}}function He(e,t,o){if(0===t.length)return 0;const{offset:n,index:r,size:i}=pe(t,e,Ie),l=e-r,s=i*l+(l-1)*o+n;return s>0?s+o:s}function ye(e,t,o){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;{let n=be("LAST"===e.index?o:e.index,t);return n=Math.max(0,n,Math.min(o,n)),n}}function be(e,t){if(!Re(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Re(e){return!Q(e.groupOffsetTree)}const ze={offsetHeight:"height",offsetWidth:"width"},Be=M((([{log:e},{recalcInProgress:t}])=>{const o=v(),n=v(),r=T(n,0),i=v(),l=v(),s=x(0),c=x([]),a=x(void 0),u=x(void 0),m=x(((e,t)=>j(e,ze[t]))),p=x(void 0),C=x(0),y={offsetTree:[],sizeTree:X(),groupOffsetTree:X(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},R=T(w(o,k(c,e,C),b(Ee,y),S()),y);g(w(c,E((e=>e.length>0)),k(R,C),H((([e,t,o])=>{const n=e.reduce(((e,n,r)=>oe(e,n,He(n,t.offsetTree,o)||r)),X());return{...t,groupIndices:e,groupOffsetTree:n}}))),R),g(w(n,k(R),E((([e,{lastIndex:t}])=>e<t)),H((([e,{lastIndex:t,lastSize:o}])=>[{startIndex:e,endIndex:t,size:o}]))),o),g(a,u);const z=T(w(a,H((e=>void 0===e))),!0);g(w(u,E((e=>void 0!==e&&Q(h(R).sizeTree))),H((e=>[{startIndex:0,endIndex:0,size:e}]))),o);const B=I(w(o,k(R),b((({sizes:e},[t,o])=>({changed:o!==e,sizes:o})),{changed:!1,sizes:y}),H((e=>e.changed))));d(w(s,b(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),H((e=>e.diff))),(e=>{e>0?(f(t,!0),f(i,e)):e<0&&f(l,e)})),d(w(s,k(e)),(([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},D.ERROR)}));const P=I(i);g(w(i,k(R),H((([e,t])=>{if(t.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return re(t.sizeTree).reduce(((t,{k:o,v:n})=>({ranges:[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}],prevIndex:o+e,prevSize:n})),{ranges:[],prevIndex:0,prevSize:t.lastSize}).ranges}))),o);const L=I(w(l,k(R,C),H((([e,{offsetTree:t},o])=>He(-e,t,o)))));return g(w(l,k(R,C),H((([e,t,o])=>{if(t.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");const n=re(t.sizeTree).reduce(((t,{k:o,v:n})=>oe(t,Math.max(0,o+e),n)),X());return{...t,sizeTree:n,...Se(t.offsetTree,0,n,o)}}))),R),{data:p,totalCount:n,sizeRanges:o,groupIndices:c,defaultItemSize:u,fixedItemSize:a,unshiftWith:i,shiftWith:l,shiftWithOffset:L,beforeUnshiftWith:P,firstItemIndex:s,gap:C,sizes:R,listRefresh:B,statefulTotalCount:r,trackItemSizes:z,itemSize:m}}),s(N,ve),{singleton:!0}),ke="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Pe(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&ke||(t.behavior="auto"),t.offset||(t.offset=0),t}const Le=M((([{sizes:e,totalCount:t,listRefresh:o,gap:n},{scrollingInProgress:r,viewportHeight:i,scrollTo:l,smoothScrollTargetReached:s,headerHeight:c,footerHeight:a,fixedHeaderHeight:u,fixedFooterHeight:m},{log:h}])=>{const I=v(),T=x(0);let C=null,S=null,E=null;function y(){C&&(C(),C=null),E&&(E(),E=null),S&&(clearTimeout(S),S=null),f(r,!1)}return g(w(I,k(e,i,t,T,c,a,h),k(n,u,m),H((([[e,t,n,i,l,c,a,u],m,h,g])=>{const v=Pe(e),{align:x,behavior:T,offset:H}=v,b=i-1,R=ye(v,t,b);let z=He(R,t.offsetTree,m)+c;"end"===x?(z+=h+te(t.sizeTree,R)[1]-n+g,R===b&&(z+=a)):"center"===x?z+=(h+te(t.sizeTree,R)[1]-n+g)/2:z-=l,H&&(z+=H);const B=t=>{y(),t?(u("retrying to scroll to",{location:e},D.DEBUG),f(I,e)):u("list did not change, scroll successful",{},D.DEBUG)};if(y(),"smooth"===T){let e=!1;E=d(o,(t=>{e=e||t})),C=p(s,(()=>{B(e)}))}else C=p(w(o,(k=150,e=>{const t=setTimeout((()=>{e(!1)}),k);return o=>{o&&(e(!0),clearTimeout(t))}})),B);var k;return S=setTimeout((()=>{y()}),1200),f(r,!0),u("scrolling from index to",{index:R,top:z,behavior:T},D.DEBUG),{top:z,behavior:T}}))),l),{scrollToIndex:I,topListHeight:T}}),s(Be,Y,N),{singleton:!0});const Oe="up",Me="down",We={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Ve=M((([{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:n,footerHeight:r,scrollBy:i}])=>{const l=x(!1),s=x(!0),c=v(),a=v(),u=x(4),d=x(0),f=T(w(P(w(L(t),R(1),y(!0)),w(L(t),R(1),y(!1),B(100))),S()),!1),m=T(w(P(w(i,y(!0)),w(i,y(!1),B(200))),S()),!1);g(w(O(L(t),L(d)),H((([e,t])=>e<=t)),S()),s),g(w(s,z(50)),a);const p=I(w(O(e,L(o),L(n),L(r),L(u)),b(((e,[{scrollTop:t,scrollHeight:o},n,r,i,l])=>{const s={viewportHeight:n,scrollTop:t,scrollHeight:o};if(t+n-o>-l){let o,n;return t>e.state.scrollTop?(o="SCROLLED_DOWN",n=e.state.scrollTop-t):(o="SIZE_DECREASED",n=e.state.scrollTop-t||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:o,scrollTopDelta:n}}let c;return c=s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":n<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":t<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:c,state:s}}),We),S(((e,t)=>e&&e.atBottom===t.atBottom)))),C=T(w(e,b(((e,{scrollTop:t,scrollHeight:o,viewportHeight:n})=>{if(K(e.scrollHeight,o))return{scrollTop:t,scrollHeight:o,jump:0,changed:!1};{const r=o-(t+n)<1;return e.scrollTop!==t&&r?{scrollHeight:o,scrollTop:t,jump:e.scrollTop-t,changed:!0}:{scrollHeight:o,scrollTop:t,jump:0,changed:!0}}}),{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),E((e=>e.changed)),H((e=>e.jump))),0);g(w(p,H((e=>e.atBottom))),l),g(w(l,z(50)),c);const M=x(Me);g(w(e,H((({scrollTop:e})=>e)),S(),b(((e,t)=>h(m)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Oe:Me,prevScrollTop:t}),{direction:Me,prevScrollTop:0}),H((e=>e.direction))),M),g(w(e,z(50),y("none")),M);const W=x(0);return g(w(f,E((e=>!e)),y(0)),W),g(w(t,z(100),k(f),E((([e,t])=>!!t)),b((([e,t],[o])=>[t,o]),[0,0]),H((([e,t])=>t-e))),W),{isScrolling:f,isAtTop:s,isAtBottom:l,atBottomState:p,atTopStateChange:a,atBottomStateChange:c,scrollDirection:M,atBottomThreshold:u,atTopThreshold:d,scrollVelocity:W,lastJumpDueToItemResize:C}}),s(Y)),Fe=M((([{log:e}])=>{const t=x(!1),o=I(w(t,E((e=>e)),S()));return d(t,(t=>{t&&h(e)("props updated",{},D.DEBUG)})),{propsReady:t,didMount:o}}),s(N),{singleton:!0});const Ae=M((([{sizes:e,listRefresh:t,defaultItemSize:o},{scrollTop:n},{scrollToIndex:r},{didMount:i}])=>{const l=x(!0),s=x(0);return g(w(i,k(s),E((([e,t])=>!!t)),y(!1)),l),d(w(O(t,i),k(l,e,o),E((([[,e],t,{sizeTree:o},n])=>e&&(!Q(o)||void 0!==n)&&!t)),k(s)),(([,e])=>{setTimeout((()=>{p(n,(()=>{f(l,!0)})),f(r,e)}))})),{scrolledToInitialItem:l,initialTopMostItemIndex:s}}),s(Be,Y,Le,Fe),{singleton:!0});function De(e){return!!e&&("smooth"===e?"smooth":"auto")}const Ge=M((([{totalCount:e,listRefresh:t},{isAtBottom:o,atBottomState:n},{scrollToIndex:r},{scrolledToInitialItem:i},{propsReady:l,didMount:s},{log:c},{scrollingInProgress:a}])=>{const u=x(!1),m=v();let g=null;function I(e){f(r,{index:"LAST",align:"end",behavior:e})}function T(e){const t=p(n,(t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||g||(h(c)("scrolling to bottom due to increased size",{},D.DEBUG),I("auto"))}));setTimeout(t,100)}return d(w(O(w(L(e),R(1)),s),k(L(u),o,i,a),H((([[e,t],o,n,r,i])=>{let l=t&&r,s="auto";return l&&(s=((e,t)=>"function"==typeof e?De(e(t)):t&&De(e))(o,n||i),l=l&&!!s),{totalCount:e,shouldFollow:l,followOutputBehavior:s}})),E((({shouldFollow:e})=>e))),(({totalCount:e,followOutputBehavior:o})=>{g&&(g(),g=null),g=p(t,(()=>{h(c)("following output to ",{totalCount:e},D.DEBUG),I(o),g=null}))})),d(w(O(L(u),e,l),E((([e,,t])=>e&&t)),b((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),E((({refreshed:e})=>e)),k(u,e)),(([,e])=>{T(!1!==e)})),d(m,(()=>{T(!1!==h(u))})),d(O(L(u),n),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&I("auto")})),{followOutput:u,autoscrollToBottom:m}}),s(Be,Ve,Le,Ae,Fe,N,Y));function Ne(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{totalCount:0,groupIndices:[]})}const _e=M((([{totalCount:e,groupIndices:t,sizes:o},{scrollTop:n,headerHeight:r}])=>{const i=v(),l=v(),s=I(w(i,H(Ne)));return g(w(s,H((e=>e.totalCount))),e),g(w(s,H((e=>e.groupIndices))),t),g(w(O(n,o,r),E((([e,t])=>Re(t))),H((([e,t,o])=>te(t.groupOffsetTree,Math.max(e-o,0),"v")[0])),S(),H((e=>[e]))),l),{groupCounts:i,topItemsIndexes:l}}),s(Be,Y));function Ue(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function $e(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}const je="top",Ke="bottom",qe="none";function Ye(e,t,o){return"number"==typeof e?o===Oe&&t===je||o===Me&&t===Ke?e:0:o===Oe?t===je?e.main:e.reverse:t===Ke?e.main:e.reverse}function Ze(e,t){return"number"==typeof e?e:e[t]||0}const Je=M((([{scrollTop:e,viewportHeight:t,deviation:o,headerHeight:n,fixedHeaderHeight:r}])=>{const i=v(),l=x(0),s=x(0),c=x(0);return{listBoundary:i,overscan:c,topListHeight:l,increaseViewportBy:s,visibleRange:T(w(O(L(e),L(t),L(n),L(i,Ue),L(c),L(l),L(r),L(o),L(s)),H((([e,t,o,[n,r],i,l,s,c,a])=>{const u=e-c,d=l+s,f=Math.max(o-u,0);let m=qe;const h=Ze(a,je),g=Ze(a,Ke);return n-=c,r+=o+s,(n+=o+s)>e+d-h&&(m=Oe),(r-=c)<e-f+t+g&&(m=Me),m!==qe?[Math.max(u-o-Ye(i,je,m)-h,0),u-f-s+t+Ye(i,Ke,m)+g]:null})),E((e=>null!=e)),S(Ue)),[0,0])}}),s(Y),{singleton:!0});const Qe={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Xe(e,t,o){if(0===e.length)return[];if(!Re(t))return e.map((e=>({...e,index:e.index+o,originalIndex:e.index})));const n=e[0].index,r=e[e.length-1].index,i=[],l=de(t.groupOffsetTree,n,r);let s,c=0;for(const a of e){let e;(!s||s.end<a.index)&&(s=l.shift(),c=t.groupIndices.indexOf(s.start)),e=a.index===s.start?{type:"group",index:c}:{index:a.index-(c+1)+o,groupIndex:c},i.push({...e,size:a.size,offset:a.offset,originalIndex:a.index,data:a.data})}return i}function et(e,t,o,n,r,i){const{lastSize:l,lastOffset:s,lastIndex:c}=r;let a=0,u=0;if(e.length>0){a=e[0].offset;const t=e[e.length-1];u=t.offset+t.size}const d=o-c,f=a,m=s+d*l+(d-1)*n-u;return{items:Xe(e,r,i),topItems:Xe(t,r,i),topListHeight:t.reduce(((e,t)=>t.size+e),0),offsetTop:a,offsetBottom:m,top:f,bottom:u,totalCount:o,firstItemIndex:i}}const tt=M((([{sizes:e,totalCount:t,data:o,firstItemIndex:n,gap:r},i,{visibleRange:s,listBoundary:c,topListHeight:a},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},m,{didMount:h},{recalcInProgress:p}])=>{const C=x([]),y=v();g(i.topItemsIndexes,C);const b=T(w(O(h,p,L(s,Ue),L(t),L(e),L(d),u,L(C),L(n),L(r),o),E((([e,t])=>e&&!t)),H((([,,[e,t],o,n,r,i,s,c,a,u])=>{const d=n,{sizeTree:f,offsetTree:m}=d;if(0===o||0===e&&0===t)return{...Qe,totalCount:o};if(Q(f))return et(function(e,t,o){if(Re(t)){const n=be(e,t);return[{index:te(t.groupOffsetTree,n)[0],size:0,offset:0},{index:n,size:0,offset:0,data:o&&o[0]}]}return[{index:e,size:0,offset:0,data:o&&o[0]}]}(function(e,t){const o=t-1;return"number"==typeof e?e:"LAST"===e.index?o:e.index}(r,o),d,u),[],o,a,d,c);const h=[];if(s.length>0){const e=s[0],t=s[s.length-1];let o=0;for(const n of de(f,e,t)){const r=n.value,i=Math.max(n.start,e),l=Math.min(n.end,t);for(let e=i;e<=l;e++)h.push({index:e,size:r,offset:o,data:u&&u[e]}),o+=r}}if(!i)return et([],h,o,a,d,c);const g=s.length>0?s[s.length-1]+1:0,p=Ce(m,e,t,g);if(0===p.length)return null;const v=o-1;return et(l([],(o=>{for(const n of p){const r=n.value;let i=r.offset,l=n.start;const s=r.size;if(r.offset<e){l+=Math.floor((e-r.offset+a)/(s+a));const t=l-n.start;i+=t*s+t*a}l<g&&(i+=(g-l)*s,l=g);const c=Math.min(n.end,v);for(let e=l;e<=c&&!(i>=t);e++)o.push({index:e,size:s,offset:i,data:u&&u[e]}),i+=s+a}})),h,o,a,d,c)})),E((e=>null!==e)),S()),Qe);g(w(o,E((e=>void 0!==e)),H((e=>null==e?void 0:e.length))),t),g(w(b,H((e=>e.topListHeight))),f),g(f,a),g(w(b,H((e=>[e.top,e.bottom]))),c),g(w(b,H((e=>e.items))),y);return{listState:b,topItemsIndexes:C,endReached:I(w(b,E((({items:e})=>e.length>0)),k(t,o),E((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),H((([,e,t])=>[e-1,t])),S(Ue),H((([e])=>e)))),startReached:I(w(b,z(200),E((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),H((({items:e})=>e[0].index)),S())),rangeChanged:I(w(b,E((({items:e})=>e.length>0)),H((({items:e})=>{let t=0,o=e.length-1;for(;"group"===e[t].type&&t<o;)t++;for(;"group"===e[o].type&&o>t;)o--;return{startIndex:e[t].index,endIndex:e[o].index}})),S($e))),itemsRendered:y,...m}}),s(Be,_e,Je,Ae,Le,Ve,Fe,ve),{singleton:!0}),ot=M((([{sizes:e,firstItemIndex:t,data:o,gap:n},{listState:r},{didMount:i}])=>{const l=x(0);return g(w(i,k(l),E((([,e])=>0!==e)),k(e,t,n,o),H((([[,e],t,o,n,r=[]])=>{let i=0;if(t.groupIndices.length>0)for(const s of t.groupIndices){if(s-i>=e)break;i++}const l=e+i;return et(Array.from({length:l}).map(((e,t)=>({index:t,size:0,offset:0,data:r[t]}))),[],l,n,t,o)}))),r),{initialItemCount:l}}),s(Be,tt,Fe),{singleton:!0}),nt=M((([{scrollVelocity:e}])=>{const t=x(!1),o=v(),n=x(!1);return g(w(e,k(n,t,o),E((([e,t])=>!!t)),H((([e,t,o,n])=>{const{exit:r,enter:i}=t;if(o){if(r(e,n))return!1}else if(i(e,n))return!0;return o})),S()),t),d(w(O(t,e,o),k(n)),(([[e,t,o],n])=>e&&n&&n.change&&n.change(t,o))),{isSeeking:t,scrollSeekConfiguration:n,scrollVelocity:e,scrollSeekRangeChanged:o}}),s(Ve),{singleton:!0}),rt=M((([{topItemsIndexes:e}])=>{const t=x(0);return g(w(t,E((e=>e>0)),H((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),s(tt)),it=M((([{footerHeight:e,headerHeight:t,fixedHeaderHeight:o,fixedFooterHeight:n},{listState:r}])=>{const i=v(),l=T(w(O(e,n,t,o,r),H((([e,t,o,n,r])=>e+t+o+n+r.offsetBottom+r.bottom))),0);return g(L(l),i),{totalListHeight:l,totalListHeightChanged:i}}),s(Y,tt),{singleton:!0});function lt(e){let t,o=!1;return()=>(o||(o=!0,t=e()),t)}const st=lt((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),ct=M((([{scrollBy:e,scrollTop:t,deviation:o,scrollingInProgress:n},{isScrolling:r,isAtBottom:i,scrollDirection:l,lastJumpDueToItemResize:s},{listState:c},{beforeUnshiftWith:a,shiftWithOffset:u,sizes:m,gap:h},{log:p},{recalcInProgress:v}])=>{const x=I(w(c,k(s),b((([,e,t,o],[{items:n,totalCount:r,bottom:i,offsetBottom:l},s])=>{const c=i+l;let a=0;if(t===r&&e.length>0&&n.length>0){0===n[0].originalIndex&&0===e[0].originalIndex||(a=c-o,0!==a&&(a+=s))}return[a,n,r,c]}),[0,[],0,0]),E((([e])=>0!==e)),k(t,l,n,i,p),E((([,e,t,o])=>!o&&0!==e&&t===Oe)),H((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},D.DEBUG),e)))));function C(t){t>0?(f(e,{top:-t,behavior:"auto"}),f(o,0)):(f(o,0),f(e,{top:-t,behavior:"auto"}))}return d(w(x,k(o,r)),(([e,t,n])=>{n&&st()?f(o,t-e):C(-e)})),d(w(O(T(r,!1),o,v),E((([e,t,o])=>!e&&!o&&0!==t)),H((([e,t])=>t)),z(1)),C),g(w(u,H((e=>({top:-e})))),e),d(w(a,k(m,h),H((([e,{lastSize:t},o])=>e*t+e*o))),(t=>{f(o,t),requestAnimationFrame((()=>{f(e,{top:t}),requestAnimationFrame((()=>{f(o,0),f(v,!1)}))}))})),{deviation:o}}),s(Y,Ve,tt,Be,N,ve)),at=M((([{totalListHeight:e},{didMount:t},{scrollTo:o}])=>{const n=x(0);return d(w(t,k(n),E((([,e])=>0!==e)),H((([,e])=>({top:e})))),(t=>{p(w(e,E((e=>0!==e))),(()=>{setTimeout((()=>{f(o,t)}))}))})),{initialScrollTop:n}}),s(it,Fe,Y),{singleton:!0}),ut=M((([{viewportHeight:e},{totalListHeight:t}])=>{const o=x(!1);return{alignToBottom:o,paddingTopAddition:T(w(O(o,e,t),E((([e])=>e)),H((([,e,t])=>Math.max(0,e-t))),S()),0)}}),s(Y,it),{singleton:!0}),dt=M((([{scrollTo:e,scrollContainerState:t}])=>{const o=v(),n=v(),r=v(),i=x(!1),l=x(void 0);return g(w(O(o,n),H((([{viewportHeight:e,scrollTop:t,scrollHeight:o},{offsetTop:n}])=>({scrollTop:Math.max(0,t-n),scrollHeight:o,viewportHeight:e})))),t),g(w(e,k(n),H((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),r),{useWindowScroll:i,customScrollParent:l,windowScrollContainerState:o,windowViewportRect:n,windowScrollTo:r}}),s(Y)),ft=M((([{sizes:e,totalCount:t,gap:o},{scrollTop:n,viewportHeight:r,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:s,scrollingInProgress:c},{scrollToIndex:a}])=>{const u=v();return g(w(u,k(e,r,t,i,l,s,n),k(o),H((([[e,t,o,n,r,i,l,s],a])=>{const{done:u,behavior:d,align:f,...m}=e;let h=null;const g=ye(e,t,n-1),v=He(g,t.offsetTree,a)+r+i;if(v<s+i)h={...m,behavior:d,align:f??"start"};else{v+te(t.sizeTree,g)[1]>s+o-l&&(h={...m,behavior:d,align:f??"end"})}return h?u&&p(w(c,R(1),E((e=>!1===e))),u):u&&u(),h})),E((e=>null!==e))),a),{scrollIntoView:u}}),s(Be,Y,Le,tt,N),{singleton:!0}),mt=M((([e,t,o,n,r,i,l,s,c])=>({...e,...t,...o,...n,...r,...i,...l,...s,...c})),s(Je,ot,Fe,nt,it,at,ut,dt,ft)),ht=M((([{totalCount:e,sizeRanges:t,fixedItemSize:o,defaultItemSize:n,trackItemSizes:r,itemSize:i,data:l,firstItemIndex:s,groupIndices:c,statefulTotalCount:a,gap:u},{initialTopMostItemIndex:d,scrolledToInitialItem:f},m,h,{listState:p,topItemsIndexes:v,...x},{scrollToIndex:I},T,{topItemCount:C},{groupCounts:S},E,y])=>(g(x.rangeChanged,E.scrollSeekRangeChanged),g(w(E.windowViewportRect,H((e=>e.visibleHeight))),m.viewportHeight),{totalCount:e,data:l,firstItemIndex:s,sizeRanges:t,initialTopMostItemIndex:d,scrolledToInitialItem:f,topItemsIndexes:v,topItemCount:C,groupCounts:S,fixedItemHeight:o,defaultItemHeight:n,gap:u,...h,statefulTotalCount:a,listState:p,scrollToIndex:I,trackItemSizes:r,itemSize:i,groupIndices:c,...x,...E,...m,...y})),s(Be,Ae,Y,Ge,tt,Le,ct,rt,_e,mt,N)),gt="-webkit-sticky",pt="sticky",vt=lt((()=>{if("undefined"==typeof document)return pt;const e=document.createElement("div");return e.style.position=gt,e.style.position===gt?gt:pt}));function xt(t,o){const n=e.useRef(null),r=e.useCallback((e=>{if(null===e||!e.offsetParent)return;const r=e.getBoundingClientRect(),i=r.width;let l,s;if(o){const e=o.getBoundingClientRect(),t=r.top-e.top;l=e.height-Math.max(0,t),s=t+o.scrollTop}else l=window.innerHeight-Math.max(0,r.top),s=r.top+window.pageYOffset;n.current={offsetTop:s,visibleHeight:l,visibleWidth:i},t(n.current)}),[t,o]),{callbackRef:i,ref:l}=_(r),s=e.useCallback((()=>{r(l.current)}),[r,l]);return e.useEffect((()=>{if(o){o.addEventListener("scroll",s);const e=new ResizeObserver(s);return e.observe(o),()=>{o.removeEventListener("scroll",s),e.unobserve(o)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}}),[s,o]),i}const It=e.createContext(void 0),Tt=e.createContext(void 0);function wt(e){return e}const Ct=M((([e,t])=>({...e,...t})),s(ht,M((()=>{const e=x((e=>`Item ${e}`)),t=x(null),o=x((e=>`Group ${e}`)),n=x({}),r=x(wt),i=x("div"),l=x(u),s=(e,t=null)=>T(w(n,H((t=>t[e])),S()),t);return{context:t,itemContent:e,groupContent:o,components:n,computeItemKey:r,headerFooterTag:i,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}})))),St=({height:t})=>e.createElement("div",{style:{height:t}}),Et={position:vt(),zIndex:1,overflowAnchor:"none"},Ht={overflowAnchor:"none"},yt=e.memo((function({showTopList:t=!1}){const o=Gt("listState"),n=Dt("sizeRanges"),r=Gt("useWindowScroll"),i=Gt("customScrollParent"),l=Dt("windowScrollContainerState"),s=Dt("scrollContainerState"),c=i||r?l:s,a=Gt("itemContent"),d=Gt("context"),f=Gt("groupContent"),m=Gt("trackItemSizes"),h=Gt("itemSize"),g=Gt("log"),p=Dt("gap"),{callbackRef:v}=$(n,h,m,t?u:c,g,p,i),[x,I]=e.useState(0);Nt("deviation",(e=>{x!==e&&I(e)}));const T=Gt("EmptyPlaceholder"),w=Gt("ScrollSeekPlaceholder")||St,C=Gt("ListComponent"),S=Gt("ItemComponent"),E=Gt("GroupComponent"),H=Gt("computeItemKey"),y=Gt("isSeeking"),b=Gt("groupIndices").length>0,R=Gt("paddingTopAddition"),z=t?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+R,paddingBottom:o.offsetBottom,marginTop:x};return!t&&0===o.totalCount&&T?e.createElement(T,Bt(T,d)):e.createElement(C,{...Bt(C,d),ref:v,style:z,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?o.topItems:o.items).map((t=>{const n=t.originalIndex,r=H(n+o.firstItemIndex,t.data,d);return y?e.createElement(w,{...Bt(w,d),key:r,index:t.index,height:t.size,type:t.type||"item",..."group"===t.type?{}:{groupIndex:t.groupIndex}}):"group"===t.type?e.createElement(E,{...Bt(E,d),key:r,"data-index":n,"data-known-size":t.size,"data-item-index":t.index,style:Et},f(t.index)):e.createElement(S,{...Bt(S,d),key:r,"data-index":n,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,item:t.data,style:Ht},b?a(t.index,t.groupIndex,t.data,d):a(t.index,t.data,d))})))})),bt={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Rt={width:"100%",height:"100%",position:"absolute",top:0},zt={width:"100%",position:vt(),top:0,zIndex:1};function Bt(e,t){if("string"!=typeof e)return{context:t}}const kt=e.memo((function(){const t=Gt("HeaderComponent"),o=Dt("headerHeight"),n=Gt("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=Gt("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null})),Pt=e.memo((function(){const t=Gt("FooterComponent"),o=Dt("footerHeight"),n=Gt("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=Gt("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null}));function Lt({usePublisher:t,useEmitter:o,useEmitterValue:n}){return e.memo((function({style:r,children:i,...l}){const s=t("scrollContainerState"),c=n("ScrollerComponent"),a=t("smoothScrollTargetReached"),u=n("scrollerRef"),d=n("context"),{scrollerRef:f,scrollByCallback:m,scrollToCallback:h}=q(s,a,c,u);return o("scrollTo",h),o("scrollBy",m),e.createElement(c,{ref:f,style:{...bt,...r},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Bt(c,d)},i)}))}function Ot({usePublisher:t,useEmitter:o,useEmitterValue:n}){return e.memo((function({style:r,children:i,...l}){const s=t("windowScrollContainerState"),c=n("ScrollerComponent"),a=t("smoothScrollTargetReached"),d=n("totalListHeight"),f=n("deviation"),m=n("customScrollParent"),h=n("context"),{scrollerRef:g,scrollByCallback:p,scrollToCallback:v}=q(s,a,c,u,m);return A((()=>(g.current=m||window,()=>{g.current=null})),[g,m]),o("windowScrollTo",v),o("scrollBy",p),e.createElement(c,{style:{position:"relative",...r,...0!==d?{height:d+f}:{}},"data-virtuoso-scroller":!0,...l,...Bt(c,h)},i)}))}const Mt=({children:t})=>{const n=e.useContext(It),r=Dt("viewportHeight"),i=Dt("fixedItemHeight"),l=U(o(r,(e=>j(e,"height"))));return e.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.createElement("div",{style:Rt,ref:l,"data-viewport-type":"element"},t)},Wt=({children:t})=>{const o=e.useContext(It),n=Dt("windowViewportRect"),r=Dt("fixedItemHeight"),i=Gt("customScrollParent"),l=xt(n,i);return e.useEffect((()=>{o&&(r(o.itemHeight),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))}),[o,n,r]),e.createElement("div",{ref:l,style:Rt,"data-viewport-type":"window"},t)},Vt=({children:t})=>{const o=Gt("TopItemListComponent"),n=Gt("headerHeight"),r={...zt,marginTop:`${n}px`},i=Gt("context");return e.createElement(o||"div",{style:r,context:i},t)},Ft=e.memo((function(t){const o=Gt("useWindowScroll"),n=Gt("topItemsIndexes").length>0,r=Gt("customScrollParent"),i=r||o?Ut:_t,l=r||o?Wt:Mt;return e.createElement(i,{...t},n&&e.createElement(Vt,null,e.createElement(yt,{showTopList:!0})),e.createElement(l,null,e.createElement(kt,null),e.createElement(yt,null),e.createElement(Pt,null)))})),{Component:At,usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}=F(Ct,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ft),_t=Lt({usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}),Ut=Ot({usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}),$t=At,jt=At,Kt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},qt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Yt,ceil:Zt,floor:Jt,min:Qt,max:Xt}=Math;function eo(e,t,o){return Array.from({length:t-e+1}).map(((t,n)=>({index:n+e,data:null==o?void 0:o[n+e]})))}function to(e,t){return e&&e.column===t.column&&e.row===t.row}const oo=M((([{overscan:e,visibleRange:t,listBoundary:o},{scrollTop:n,viewportHeight:r,scrollBy:i,scrollTo:l,smoothScrollTargetReached:s,scrollContainerState:c,footerHeight:a,headerHeight:u},d,f,{propsReady:m,didMount:h},{windowViewportRect:p,windowScrollTo:C,useWindowScroll:b,customScrollParent:R,windowScrollContainerState:z},B])=>{const P=x(0),M=x(0),W=x(Kt),V=x({height:0,width:0}),F=x({height:0,width:0}),A=v(),D=v(),G=x(0),N=x(void 0),_=x({row:0,column:0});g(w(O(h,M,N),E((([,e])=>0!==e)),H((([,e,t])=>({items:eo(0,e-1,t),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0})))),W),g(w(O(L(P),t,L(_,to),L(F,((e,t)=>e&&e.width===t.width&&e.height===t.height)),N),k(V),H((([[e,[t,o],n,r,i],l])=>{const{row:s,column:c}=n,{height:a,width:u}=r,{width:d}=l;if(0===e||0===d)return Kt;if(0===u)return function(e){return{...qt,items:e}}(eo(0,0,i));const f=io(d,u,c);let m=f*Jt((t+s)/(a+s)),h=f*Zt((o+s)/(a+s))-1;h=Qt(e-1,Xt(h,f-1)),m=Qt(h,Xt(0,m));const g=eo(m,h,i),{top:p,bottom:v}=no(l,n,r,g),x=Zt(e/f);return{items:g,offsetTop:p,offsetBottom:x*a+(x-1)*s-v,top:p,bottom:v,itemHeight:a,itemWidth:u}}))),W),g(w(N,E((e=>void 0!==e)),H((e=>e.length))),P),g(w(V,H((({height:e})=>e))),r),g(w(O(V,F,W,_),H((([e,t,{items:o},n])=>{const{top:r,bottom:i}=no(e,n,t,o);return[r,i]})),S(Ue)),o);const U=I(w(L(W),E((({items:e})=>e.length>0)),k(P),E((([{items:e},t])=>e[e.length-1].index===t-1)),H((([,e])=>e-1)),S())),$=I(w(L(W),E((({items:e})=>e.length>0&&0===e[0].index)),y(0),S())),j=I(w(L(W),E((({items:e})=>e.length>0)),H((({items:e})=>({startIndex:e[0].index,endIndex:e[e.length-1].index}))),S($e)));g(j,f.scrollSeekRangeChanged),g(w(A,k(V,F,P,_),H((([e,t,o,n,r])=>{const i=Pe(e),{align:l,behavior:s,offset:c}=i;let a=i.index;"LAST"===a&&(a=n-1),a=Xt(0,a,Qt(n-1,a));let u=ro(t,r,o,a);return"end"===l?u=Yt(u-t.height+o.height):"center"===l&&(u=Yt(u-t.height/2+o.height/2)),c&&(u+=c),{top:u,behavior:s}}))),l);const K=T(w(W,H((e=>e.offsetBottom+e.bottom))),0);return g(w(p,H((e=>({width:e.visibleWidth,height:e.visibleHeight})))),V),{data:N,totalCount:P,viewportDimensions:V,itemDimensions:F,scrollTop:n,scrollHeight:D,overscan:e,scrollBy:i,scrollTo:l,scrollToIndex:A,smoothScrollTargetReached:s,windowViewportRect:p,windowScrollTo:C,useWindowScroll:b,customScrollParent:R,windowScrollContainerState:z,deviation:G,scrollContainerState:c,footerHeight:a,headerHeight:u,initialItemCount:M,gap:_,...f,gridState:W,totalListHeight:K,...d,startReached:$,endReached:U,rangeChanged:j,propsReady:m,...B}}),s(Je,Y,Ve,nt,Fe,dt,N));function no(e,t,o,n){const{height:r}=o;if(void 0===r||0===n.length)return{top:0,bottom:0};return{top:ro(e,t,o,n[0].index),bottom:ro(e,t,o,n[n.length-1].index)+r}}function ro(e,t,o,n){const r=io(e.width,o.width,t.column),i=Jt(n/r),l=i*o.height+Xt(0,i-1)*t.row;return l>0?l+t.row:l}function io(e,t,o){return Xt(1,Jt((e+o)/(t+o)))}const lo=M((([e,t])=>({...e,...t})),s(oo,M((()=>{const e=x((e=>`Item ${e}`)),t=x({}),o=x(null),n=x("virtuoso-grid-item"),r=x("virtuoso-grid-list"),i=x(wt),l=x("div"),s=x(u),c=(e,o=null)=>T(w(t,H((t=>t[e])),S()),o);return{context:o,itemContent:e,components:t,computeItemKey:i,itemClassName:n,listClassName:r,headerFooterTag:l,scrollerRef:s,FooterComponent:c("Footer"),HeaderComponent:c("Header"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),ScrollerComponent:c("Scroller","div"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}})))),so=e.memo((function(){const t=po("gridState"),o=po("listClassName"),n=po("itemClassName"),r=po("itemContent"),i=po("computeItemKey"),l=po("isSeeking"),s=go("scrollHeight"),c=po("ItemComponent"),a=po("ListComponent"),u=po("ScrollSeekPlaceholder"),d=po("context"),f=go("itemDimensions"),m=go("gap"),h=po("log"),g=U((e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const o=e.firstChild;o&&f(o.getBoundingClientRect()),m({row:To("row-gap",getComputedStyle(e).rowGap,h),column:To("column-gap",getComputedStyle(e).columnGap,h)})}));return e.createElement(a,{ref:g,className:o,...Bt(a,d),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map((o=>{const s=i(o.index,o.data,d);return l?e.createElement(u,{key:s,...Bt(u,d),index:o.index,height:t.itemHeight,width:t.itemWidth}):e.createElement(c,{...Bt(c,d),className:n,"data-index":o.index,key:s},r(o.index,o.data,d))})))})),co=e.memo((function(){const t=po("HeaderComponent"),o=go("headerHeight"),n=po("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=po("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null})),ao=e.memo((function(){const t=po("FooterComponent"),o=go("footerHeight"),n=po("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=po("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null})),uo=({children:t})=>{const o=e.useContext(Tt),n=go("itemDimensions"),r=go("viewportDimensions"),i=U((e=>{r(e.getBoundingClientRect())}));return e.useEffect((()=>{o&&(r({height:o.viewportHeight,width:o.viewportWidth}),n({height:o.itemHeight,width:o.itemWidth}))}),[o,r,n]),e.createElement("div",{style:Rt,ref:i},t)},fo=({children:t})=>{const o=e.useContext(Tt),n=go("windowViewportRect"),r=go("itemDimensions"),i=po("customScrollParent"),l=xt(n,i);return e.useEffect((()=>{o&&(r({height:o.itemHeight,width:o.itemWidth}),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:o.viewportWidth}))}),[o,n,r]),e.createElement("div",{ref:l,style:Rt},t)},mo=e.memo((function({...t}){const o=po("useWindowScroll"),n=po("customScrollParent"),r=n||o?Io:xo,i=n||o?fo:uo;return e.createElement(r,{...t},e.createElement(i,null,e.createElement(co,null),e.createElement(so,null),e.createElement(ao,null)))})),{Component:ho,usePublisher:go,useEmitterValue:po,useEmitter:vo}=F(lo,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},mo),xo=Lt({usePublisher:go,useEmitterValue:po,useEmitter:vo}),Io=Ot({usePublisher:go,useEmitterValue:po,useEmitter:vo});function To(e,t,o){return"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN),"normal"===t?0:parseInt(t??"0",10)}const wo=ho,Co=M((([e,t])=>({...e,...t})),s(ht,M((()=>{const t=x((t=>e.createElement("td",null,"Item $",t))),o=x(null),n=x(null),r=x(null),i=x({}),l=x(wt),s=x(u),c=(e,t=null)=>T(w(i,H((t=>t[e])),S()),t);return{context:o,itemContent:t,fixedHeaderContent:n,fixedFooterContent:r,components:i,computeItemKey:l,scrollerRef:s,TableComponent:c("Table","table"),TableHeadComponent:c("TableHead","thead"),TableFooterComponent:c("TableFoot","tfoot"),TableBodyComponent:c("TableBody","tbody"),TableRowComponent:c("TableRow","tr"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),FillerRow:c("FillerRow")}})))),So=({height:t})=>e.createElement("tr",null,e.createElement("td",{style:{height:t}})),Eo=({height:t})=>e.createElement("tr",null,e.createElement("td",{style:{height:t,padding:0,border:0}})),Ho=e.memo((function(){const t=ko("listState"),o=Bo("sizeRanges"),n=ko("useWindowScroll"),r=ko("customScrollParent"),i=Bo("windowScrollContainerState"),l=Bo("scrollContainerState"),s=r||n?i:l,c=ko("itemContent"),a=ko("trackItemSizes"),u=ko("itemSize"),d=ko("log"),{callbackRef:f,ref:m}=$(o,u,a,s,d,void 0,r),[h,g]=e.useState(0);Po("deviation",(e=>{h!==e&&(m.current.style.marginTop=`${e}px`,g(e))}));const p=ko("EmptyPlaceholder"),v=ko("ScrollSeekPlaceholder")||So,x=ko("FillerRow")||Eo,I=ko("TableBodyComponent"),T=ko("TableRowComponent"),w=ko("computeItemKey"),C=ko("isSeeking"),S=ko("paddingTopAddition"),E=ko("firstItemIndex"),H=ko("statefulTotalCount"),y=ko("context");if(0===H&&p)return e.createElement(p,Bt(p,y));const b=t.offsetTop+S+h,R=t.offsetBottom,z=b>0?e.createElement(x,{height:b,key:"padding-top",context:y}):null,B=R>0?e.createElement(x,{height:R,key:"padding-bottom",context:y}):null,k=t.items.map((t=>{const o=t.originalIndex,n=w(o+E,t.data,y);return C?e.createElement(v,{...Bt(v,y),key:n,index:t.index,height:t.size,type:t.type||"item"}):e.createElement(T,{...Bt(T,y),key:n,"data-index":o,"data-known-size":t.size,"data-item-index":t.index,item:t.data,style:{overflowAnchor:"none"}},c(t.index,t.data,y))}));return e.createElement(I,{ref:f,"data-test-id":"virtuoso-item-list",...Bt(I,y)},[z,...k,B])})),yo=({children:t})=>{const n=e.useContext(It),r=Bo("viewportHeight"),i=Bo("fixedItemHeight"),l=U(o(r,(e=>j(e,"height"))));return e.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.createElement("div",{style:Rt,ref:l,"data-viewport-type":"element"},t)},bo=({children:t})=>{const o=e.useContext(It),n=Bo("windowViewportRect"),r=Bo("fixedItemHeight"),i=ko("customScrollParent"),l=xt(n,i);return e.useEffect((()=>{o&&(r(o.itemHeight),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))}),[o,n,r]),e.createElement("div",{ref:l,style:Rt,"data-viewport-type":"window"},t)},Ro=e.memo((function(t){const n=ko("useWindowScroll"),r=ko("customScrollParent"),i=Bo("fixedHeaderHeight"),l=Bo("fixedFooterHeight"),s=ko("fixedHeaderContent"),c=ko("fixedFooterContent"),a=ko("context"),u=U(o(i,(e=>j(e,"height")))),d=U(o(l,(e=>j(e,"height")))),f=r||n?Oo:Lo,m=r||n?bo:yo,h=ko("TableComponent"),g=ko("TableHeadComponent"),p=ko("TableFooterComponent"),v=s?e.createElement(g,{key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u,...Bt(g,a)},s()):null,x=c?e.createElement(p,{key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:d,...Bt(p,a)},c()):null;return e.createElement(f,{...t},e.createElement(m,null,e.createElement(h,{style:{borderSpacing:0},...Bt(h,a)},[v,e.createElement(Ho,{key:"TableBody"}),x])))})),{Component:zo,usePublisher:Bo,useEmitterValue:ko,useEmitter:Po}=F(Co,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ro),Lo=Lt({usePublisher:Bo,useEmitterValue:ko,useEmitter:Po}),Oo=Ot({usePublisher:Bo,useEmitterValue:ko,useEmitter:Po}),Mo=zo;exports.GroupedVirtuoso=jt,exports.LogLevel=D,exports.TableVirtuoso=Mo,exports.Virtuoso=$t,exports.VirtuosoGrid=wo,exports.VirtuosoGridMockContext=Tt,exports.VirtuosoMockContext=It;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ComponentPropsWithRef } from 'react';
|
|
4
|
-
import { ComponentType } from 'react';
|
|
5
|
-
import { Context } from 'react';
|
|
6
|
-
import { HTMLProps } from 'react';
|
|
7
|
-
import { Key } from 'react';
|
|
8
|
-
import { ReactElement } from 'react';
|
|
9
|
-
import { ReactNode } from 'react';
|
|
10
|
-
import { Ref } from 'react';
|
|
1
|
+
import { default as React_2 } from 'react';
|
|
11
2
|
|
|
12
3
|
/**
|
|
13
4
|
* Customize the Virtuoso rendering by passing a set of custom components.
|
|
@@ -18,63 +9,63 @@ export declare interface Components<Data = unknown, Context = unknown> {
|
|
|
18
9
|
*
|
|
19
10
|
* The header remains above the top items and does not remain sticky.
|
|
20
11
|
*/
|
|
21
|
-
Header?: ComponentType<{
|
|
12
|
+
Header?: React_2.ComponentType<{
|
|
22
13
|
context?: Context;
|
|
23
14
|
}>;
|
|
24
15
|
/**
|
|
25
16
|
* Set to render a component at the bottom of the list.
|
|
26
17
|
*/
|
|
27
|
-
Footer?: ComponentType<{
|
|
18
|
+
Footer?: React_2.ComponentType<{
|
|
28
19
|
context?: Context;
|
|
29
20
|
}>;
|
|
30
21
|
/**
|
|
31
22
|
* Set to customize the item wrapping element. Use only if you would like to render list from elements different than a `div`.
|
|
32
23
|
*/
|
|
33
|
-
Item?: ComponentType<ItemProps<Data> & {
|
|
24
|
+
Item?: React_2.ComponentType<ItemProps<Data> & {
|
|
34
25
|
context?: Context;
|
|
35
26
|
}>;
|
|
36
27
|
/**
|
|
37
28
|
* Set to customize the group item wrapping element. Use only if you would like to render list from elements different than a `div`.
|
|
38
29
|
*/
|
|
39
|
-
Group?: ComponentType<GroupProps & {
|
|
30
|
+
Group?: React_2.ComponentType<GroupProps & {
|
|
40
31
|
context?: Context;
|
|
41
32
|
}>;
|
|
42
33
|
/**
|
|
43
34
|
* Set to customize the top list item wrapping element. Use if you would like to render list from elements different than a `div`
|
|
44
35
|
* or you want to set a custom z-index for the sticky position.
|
|
45
36
|
*/
|
|
46
|
-
TopItemList?: ComponentType<TopItemListProps & {
|
|
37
|
+
TopItemList?: React_2.ComponentType<TopItemListProps & {
|
|
47
38
|
context?: Context;
|
|
48
39
|
}>;
|
|
49
40
|
/**
|
|
50
41
|
* Set to customize the outermost scrollable element. This should not be necessary in general,
|
|
51
42
|
* as the component passes its HTML attribute props to it.
|
|
52
43
|
*/
|
|
53
|
-
Scroller?: ComponentType<ScrollerProps & {
|
|
44
|
+
Scroller?: React_2.ComponentType<ScrollerProps & {
|
|
54
45
|
context?: Context;
|
|
55
46
|
}>;
|
|
56
47
|
/**
|
|
57
48
|
* Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
|
|
58
49
|
*/
|
|
59
|
-
List?: ComponentType<ListProps & {
|
|
50
|
+
List?: React_2.ComponentType<ListProps & {
|
|
60
51
|
context?: Context;
|
|
61
52
|
}>;
|
|
62
53
|
/**
|
|
63
54
|
* Set to render a custom UI when the list is empty.
|
|
64
55
|
*/
|
|
65
|
-
EmptyPlaceholder?: ComponentType<{
|
|
56
|
+
EmptyPlaceholder?: React_2.ComponentType<{
|
|
66
57
|
context?: Context;
|
|
67
58
|
}>;
|
|
68
59
|
/**
|
|
69
60
|
* Set to render an item placeholder when the user scrolls fast. See the `scrollSeek` property for more details.
|
|
70
61
|
*/
|
|
71
|
-
ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps & {
|
|
62
|
+
ScrollSeekPlaceholder?: React_2.ComponentType<ScrollSeekPlaceholderProps & {
|
|
72
63
|
context?: Context;
|
|
73
64
|
}>;
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
export declare interface ComputeItemKey<D, C> {
|
|
77
|
-
(index: number, item: D, context: C): Key;
|
|
68
|
+
(index: number, item: D, context: C): React_2.Key;
|
|
78
69
|
}
|
|
79
70
|
|
|
80
71
|
/**
|
|
@@ -84,9 +75,9 @@ export declare interface FillerRowProps {
|
|
|
84
75
|
height: number;
|
|
85
76
|
}
|
|
86
77
|
|
|
87
|
-
export declare type FixedFooterContent = (() => ReactNode) | null;
|
|
78
|
+
export declare type FixedFooterContent = (() => React_2.ReactNode) | null;
|
|
88
79
|
|
|
89
|
-
export declare type FixedHeaderContent = (() => ReactNode) | null;
|
|
80
|
+
export declare type FixedHeaderContent = (() => React_2.ReactNode) | null;
|
|
90
81
|
|
|
91
82
|
export declare interface FlatIndexLocationWithAlign extends LocationOptions {
|
|
92
83
|
/**
|
|
@@ -109,20 +100,20 @@ export declare interface GridComponents<Context = any> {
|
|
|
109
100
|
/**
|
|
110
101
|
* Set to customize the item wrapping element. Use only if you would like to render list from elements different than a `div`.
|
|
111
102
|
*/
|
|
112
|
-
Item?: ComponentType<GridItemProps & {
|
|
103
|
+
Item?: React_2.ComponentType<GridItemProps & {
|
|
113
104
|
context?: Context;
|
|
114
105
|
}>;
|
|
115
106
|
/**
|
|
116
107
|
* Set to customize the outermost scrollable element. This should not be necessary in general,
|
|
117
108
|
* as the component passes its HTML attribute props to it.
|
|
118
109
|
*/
|
|
119
|
-
Scroller?: ComponentType<ScrollerProps & {
|
|
110
|
+
Scroller?: React_2.ComponentType<ScrollerProps & {
|
|
120
111
|
context?: Context;
|
|
121
112
|
}>;
|
|
122
113
|
/**
|
|
123
114
|
* Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
|
|
124
115
|
*/
|
|
125
|
-
List?: ComponentType<GridListProps & {
|
|
116
|
+
List?: React_2.ComponentType<GridListProps & {
|
|
126
117
|
context?: Context;
|
|
127
118
|
}>;
|
|
128
119
|
/**
|
|
@@ -130,26 +121,26 @@ export declare interface GridComponents<Context = any> {
|
|
|
130
121
|
*
|
|
131
122
|
* The header remains above the top items and does not remain sticky.
|
|
132
123
|
*/
|
|
133
|
-
Header?: ComponentType<{
|
|
124
|
+
Header?: React_2.ComponentType<{
|
|
134
125
|
context?: Context;
|
|
135
126
|
}>;
|
|
136
127
|
/**
|
|
137
128
|
* Set to render a component at the bottom of the list.
|
|
138
129
|
*/
|
|
139
|
-
Footer?: ComponentType<{
|
|
130
|
+
Footer?: React_2.ComponentType<{
|
|
140
131
|
context?: Context;
|
|
141
132
|
}>;
|
|
142
133
|
/**
|
|
143
134
|
* Set to render an item placeholder when the user scrolls fast.
|
|
144
135
|
* See the `scrollSeekConfiguration` property for more details.
|
|
145
136
|
*/
|
|
146
|
-
ScrollSeekPlaceholder?: ComponentType<GridScrollSeekPlaceholderProps & {
|
|
137
|
+
ScrollSeekPlaceholder?: React_2.ComponentType<GridScrollSeekPlaceholderProps & {
|
|
147
138
|
context?: Context;
|
|
148
139
|
}>;
|
|
149
140
|
}
|
|
150
141
|
|
|
151
142
|
export declare interface GridComputeItemKey<D, C> {
|
|
152
|
-
(index: number, item: D, context: C): Key;
|
|
143
|
+
(index: number, item: D, context: C): React_2.Key;
|
|
153
144
|
}
|
|
154
145
|
|
|
155
146
|
export declare interface GridItem<D> {
|
|
@@ -158,7 +149,7 @@ export declare interface GridItem<D> {
|
|
|
158
149
|
}
|
|
159
150
|
|
|
160
151
|
export declare interface GridItemContent<D, C> {
|
|
161
|
-
(index: number, data: D, context: C): ReactNode;
|
|
152
|
+
(index: number, data: D, context: C): React_2.ReactNode;
|
|
162
153
|
}
|
|
163
154
|
|
|
164
155
|
export declare interface GridItemProps {
|
|
@@ -169,11 +160,11 @@ export declare interface GridItemProps {
|
|
|
169
160
|
/**
|
|
170
161
|
* Passed to the Components.List custom component
|
|
171
162
|
*/
|
|
172
|
-
export declare type GridListProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref' | 'className'> & {
|
|
163
|
+
export declare type GridListProps = Pick<React_2.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref' | 'className'> & {
|
|
173
164
|
'data-test-id': string;
|
|
174
165
|
};
|
|
175
166
|
|
|
176
|
-
export declare type GridRootProps = Omit<HTMLProps<HTMLDivElement>, 'ref' | 'data'>;
|
|
167
|
+
export declare type GridRootProps = Omit<React_2.HTMLProps<HTMLDivElement>, 'ref' | 'data'>;
|
|
177
168
|
|
|
178
169
|
/**
|
|
179
170
|
* Passed to the GridComponents.ScrollSeekPlaceholder custom component
|
|
@@ -185,7 +176,7 @@ export declare interface GridScrollSeekPlaceholderProps {
|
|
|
185
176
|
}
|
|
186
177
|
|
|
187
178
|
export declare interface GroupContent {
|
|
188
|
-
(index: number): ReactNode;
|
|
179
|
+
(index: number): React_2.ReactNode;
|
|
189
180
|
}
|
|
190
181
|
|
|
191
182
|
export declare interface GroupedScrollIntoViewLocation extends ScrollIntoViewLocationOptions {
|
|
@@ -193,8 +184,8 @@ export declare interface GroupedScrollIntoViewLocation extends ScrollIntoViewLoc
|
|
|
193
184
|
}
|
|
194
185
|
|
|
195
186
|
export declare const GroupedVirtuoso: <ItemData = any, Context = any>(props: GroupedVirtuosoProps<ItemData, Context> & {
|
|
196
|
-
ref?: Ref<GroupedVirtuosoHandle> | undefined;
|
|
197
|
-
}) => ReactElement;
|
|
187
|
+
ref?: React_2.Ref<GroupedVirtuosoHandle> | undefined;
|
|
188
|
+
}) => React_2.ReactElement;
|
|
198
189
|
|
|
199
190
|
export declare interface GroupedVirtuosoHandle {
|
|
200
191
|
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
@@ -233,10 +224,10 @@ export declare interface GroupItem<D> extends Item<D> {
|
|
|
233
224
|
}
|
|
234
225
|
|
|
235
226
|
export declare interface GroupItemContent<D, C> {
|
|
236
|
-
(index: number, groupIndex: number, data: D, context: C): ReactNode;
|
|
227
|
+
(index: number, groupIndex: number, data: D, context: C): React_2.ReactNode;
|
|
237
228
|
}
|
|
238
229
|
|
|
239
|
-
export declare type GroupProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children'> & {
|
|
230
|
+
export declare type GroupProps = Pick<React_2.ComponentPropsWithRef<'div'>, 'style' | 'children'> & {
|
|
240
231
|
'data-index': number;
|
|
241
232
|
'data-item-index': number;
|
|
242
233
|
'data-known-size': number;
|
|
@@ -252,10 +243,10 @@ export declare interface Item<D> {
|
|
|
252
243
|
}
|
|
253
244
|
|
|
254
245
|
export declare interface ItemContent<D, C> {
|
|
255
|
-
(index: number, data: D, context: C): ReactNode;
|
|
246
|
+
(index: number, data: D, context: C): React_2.ReactNode;
|
|
256
247
|
}
|
|
257
248
|
|
|
258
|
-
export declare type ItemProps<D> = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children'> & {
|
|
249
|
+
export declare type ItemProps<D> = Pick<React_2.ComponentPropsWithRef<'div'>, 'style' | 'children'> & {
|
|
259
250
|
'data-index': number;
|
|
260
251
|
'data-item-index': number;
|
|
261
252
|
'data-item-group-index'?: number;
|
|
@@ -268,7 +259,7 @@ export declare type ListItem<D> = RecordItem<D> | GroupItem<D>;
|
|
|
268
259
|
/**
|
|
269
260
|
* Passed to the Components.List custom component
|
|
270
261
|
*/
|
|
271
|
-
export declare type ListProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref'> & {
|
|
262
|
+
export declare type ListProps = Pick<React_2.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref'> & {
|
|
272
263
|
'data-test-id': string;
|
|
273
264
|
};
|
|
274
265
|
|
|
@@ -277,7 +268,7 @@ export declare interface ListRange {
|
|
|
277
268
|
endIndex: number;
|
|
278
269
|
}
|
|
279
270
|
|
|
280
|
-
export declare type ListRootProps = Omit<HTMLProps<HTMLDivElement>, 'ref' | 'data'>;
|
|
271
|
+
export declare type ListRootProps = Omit<React_2.HTMLProps<HTMLDivElement>, 'ref' | 'data'>;
|
|
281
272
|
|
|
282
273
|
export declare interface LocationOptions {
|
|
283
274
|
/**
|
|
@@ -317,7 +308,7 @@ export declare interface ScrollContainerState {
|
|
|
317
308
|
/**
|
|
318
309
|
* Passed to the Components.Scroller custom component
|
|
319
310
|
*/
|
|
320
|
-
export declare type ScrollerProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'tabIndex' | 'ref'> & {
|
|
311
|
+
export declare type ScrollerProps = Pick<React_2.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'tabIndex' | 'ref'> & {
|
|
321
312
|
'data-test-id'?: string;
|
|
322
313
|
'data-virtuoso-scroller'?: boolean;
|
|
323
314
|
};
|
|
@@ -365,7 +356,7 @@ export declare type SizeFunction = (el: HTMLElement, field: 'offsetHeight' | 'of
|
|
|
365
356
|
/**
|
|
366
357
|
* Passed to the Components.TableBody custom component
|
|
367
358
|
*/
|
|
368
|
-
export declare type TableBodyProps = Pick<ComponentPropsWithRef<'tbody'>, 'style' | 'children' | 'ref' | 'className'> & {
|
|
359
|
+
export declare type TableBodyProps = Pick<React_2.ComponentPropsWithRef<'tbody'>, 'style' | 'children' | 'ref' | 'className'> & {
|
|
369
360
|
'data-test-id': string;
|
|
370
361
|
};
|
|
371
362
|
|
|
@@ -377,68 +368,68 @@ export declare interface TableComponents<Data = unknown, Context = unknown> {
|
|
|
377
368
|
* Set to customize the wrapping `table` element.
|
|
378
369
|
*
|
|
379
370
|
*/
|
|
380
|
-
Table?: ComponentType<TableProps & {
|
|
371
|
+
Table?: React_2.ComponentType<TableProps & {
|
|
381
372
|
context?: Context;
|
|
382
373
|
}>;
|
|
383
374
|
/**
|
|
384
375
|
* Set to render a fixed header at the top of the table (`thead`). use [[fixedHeaderHeight]] to set the contents
|
|
385
376
|
*
|
|
386
377
|
*/
|
|
387
|
-
TableHead?: ComponentType<Pick<ComponentPropsWithRef<'thead'>, 'style' | 'ref'> & {
|
|
378
|
+
TableHead?: React_2.ComponentType<Pick<React_2.ComponentPropsWithRef<'thead'>, 'style' | 'ref'> & {
|
|
388
379
|
context?: Context;
|
|
389
380
|
}>;
|
|
390
381
|
/**
|
|
391
382
|
* Set to render a fixed footer at the bottom of the table (`tfoot`). use [[fixedFooterContent]] to set the contents
|
|
392
383
|
*/
|
|
393
|
-
TableFoot?: ComponentType<Pick<ComponentPropsWithRef<'tfoot'>, 'style' | 'ref'> & {
|
|
384
|
+
TableFoot?: React_2.ComponentType<Pick<React_2.ComponentPropsWithRef<'tfoot'>, 'style' | 'ref'> & {
|
|
394
385
|
context?: Context;
|
|
395
386
|
}>;
|
|
396
387
|
/**
|
|
397
388
|
* Set to customize the item wrapping element. Default is `tr`.
|
|
398
389
|
*/
|
|
399
|
-
TableRow?: ComponentType<ItemProps<Data> & {
|
|
390
|
+
TableRow?: React_2.ComponentType<ItemProps<Data> & {
|
|
400
391
|
context?: Context;
|
|
401
392
|
}>;
|
|
402
393
|
/**
|
|
403
394
|
* Set to customize the outermost scrollable element. This should not be necessary in general,
|
|
404
395
|
* as the component passes its HTML attribute props to it.
|
|
405
396
|
*/
|
|
406
|
-
Scroller?: ComponentType<ScrollerProps & {
|
|
397
|
+
Scroller?: React_2.ComponentType<ScrollerProps & {
|
|
407
398
|
context?: Context;
|
|
408
399
|
}>;
|
|
409
400
|
/**
|
|
410
401
|
* Set to customize the items wrapper. Default is `tbody`.
|
|
411
402
|
*/
|
|
412
|
-
TableBody?: ComponentType<TableBodyProps & {
|
|
403
|
+
TableBody?: React_2.ComponentType<TableBodyProps & {
|
|
413
404
|
context?: Context;
|
|
414
405
|
}>;
|
|
415
406
|
/**
|
|
416
407
|
* Set to render a custom UI when the list is empty.
|
|
417
408
|
*/
|
|
418
|
-
EmptyPlaceholder?: ComponentType<{
|
|
409
|
+
EmptyPlaceholder?: React_2.ComponentType<{
|
|
419
410
|
context?: Context;
|
|
420
411
|
}>;
|
|
421
412
|
/**
|
|
422
413
|
* Set to render an item placeholder when the user scrolls fast. See the `scrollSeek` property for more details.
|
|
423
414
|
*/
|
|
424
|
-
ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps & {
|
|
415
|
+
ScrollSeekPlaceholder?: React_2.ComponentType<ScrollSeekPlaceholderProps & {
|
|
425
416
|
context?: Context;
|
|
426
417
|
}>;
|
|
427
418
|
/**
|
|
428
419
|
* Set to render an empty item placeholder.
|
|
429
420
|
*/
|
|
430
|
-
FillerRow?: ComponentType<FillerRowProps & {
|
|
421
|
+
FillerRow?: React_2.ComponentType<FillerRowProps & {
|
|
431
422
|
context?: Context;
|
|
432
423
|
}>;
|
|
433
424
|
}
|
|
434
425
|
|
|
435
|
-
export declare type TableProps = Pick<ComponentPropsWithRef<'table'>, 'style' | 'children'>;
|
|
426
|
+
export declare type TableProps = Pick<React_2.ComponentPropsWithRef<'table'>, 'style' | 'children'>;
|
|
436
427
|
|
|
437
|
-
export declare type TableRootProps = Omit<HTMLProps<HTMLTableElement>, 'ref' | 'data'>;
|
|
428
|
+
export declare type TableRootProps = Omit<React_2.HTMLProps<HTMLTableElement>, 'ref' | 'data'>;
|
|
438
429
|
|
|
439
430
|
export declare const TableVirtuoso: <ItemData = any, Context = any>(props: TableVirtuosoProps<ItemData, Context> & {
|
|
440
|
-
ref?: Ref<TableVirtuosoHandle> | undefined;
|
|
441
|
-
}) => ReactElement;
|
|
431
|
+
ref?: React_2.Ref<TableVirtuosoHandle> | undefined;
|
|
432
|
+
}) => React_2.ReactElement;
|
|
442
433
|
|
|
443
434
|
export declare interface TableVirtuosoHandle {
|
|
444
435
|
scrollIntoView(location: number | FlatScrollIntoViewLocation): void;
|
|
@@ -624,15 +615,15 @@ export declare interface TableVirtuosoProps<D, C> extends Omit<VirtuosoProps<D,
|
|
|
624
615
|
atBottomThreshold?: number;
|
|
625
616
|
}
|
|
626
617
|
|
|
627
|
-
export declare type TopItemListProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children'>;
|
|
618
|
+
export declare type TopItemListProps = Pick<React_2.ComponentPropsWithRef<'div'>, 'style' | 'children'>;
|
|
628
619
|
|
|
629
620
|
export declare const Virtuoso: <ItemData = any, Context = any>(props: VirtuosoProps<ItemData, Context> & {
|
|
630
|
-
ref?: Ref<VirtuosoHandle> | undefined;
|
|
631
|
-
}) => ReactElement;
|
|
621
|
+
ref?: React_2.Ref<VirtuosoHandle> | undefined;
|
|
622
|
+
}) => React_2.ReactElement;
|
|
632
623
|
|
|
633
624
|
export declare const VirtuosoGrid: <ItemData = any, Context = any>(props: VirtuosoGridProps<ItemData, Context> & {
|
|
634
|
-
ref?: Ref<VirtuosoGridHandle> | undefined;
|
|
635
|
-
}) => ReactElement;
|
|
625
|
+
ref?: React_2.Ref<VirtuosoGridHandle> | undefined;
|
|
626
|
+
}) => React_2.ReactElement;
|
|
636
627
|
|
|
637
628
|
export declare interface VirtuosoGridHandle {
|
|
638
629
|
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
@@ -640,7 +631,7 @@ export declare interface VirtuosoGridHandle {
|
|
|
640
631
|
scrollBy(location: ScrollToOptions): void;
|
|
641
632
|
}
|
|
642
633
|
|
|
643
|
-
export declare const VirtuosoGridMockContext: Context<VirtuosoGridMockContextValue | undefined>;
|
|
634
|
+
export declare const VirtuosoGridMockContext: React_2.Context<VirtuosoGridMockContextValue | undefined>;
|
|
644
635
|
|
|
645
636
|
export declare interface VirtuosoGridMockContextValue {
|
|
646
637
|
viewportHeight: number;
|
|
@@ -765,7 +756,7 @@ export declare interface VirtuosoHandle {
|
|
|
765
756
|
autoscrollToBottom(): void;
|
|
766
757
|
}
|
|
767
758
|
|
|
768
|
-
export declare const VirtuosoMockContext: Context<VirtuosoMockContextValue | undefined>;
|
|
759
|
+
export declare const VirtuosoMockContext: React_2.Context<VirtuosoMockContextValue | undefined>;
|
|
769
760
|
|
|
770
761
|
export declare interface VirtuosoMockContextValue {
|
|
771
762
|
viewportHeight: number;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { flushSync } from "react-dom";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
4
3
|
const PUBLISH = 0;
|
|
5
4
|
const SUBSCRIBE = 1;
|
|
6
5
|
const RESET = 2;
|
|
@@ -320,13 +319,13 @@ function omit(keys, obj) {
|
|
|
320
319
|
}
|
|
321
320
|
return result;
|
|
322
321
|
}
|
|
323
|
-
const useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
322
|
+
const useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
324
323
|
function systemToComponent(systemSpec, map2, Root) {
|
|
325
324
|
const requiredPropNames = Object.keys(map2.required || {});
|
|
326
325
|
const optionalPropNames = Object.keys(map2.optional || {});
|
|
327
326
|
const methodNames = Object.keys(map2.methods || {});
|
|
328
327
|
const eventNames = Object.keys(map2.events || {});
|
|
329
|
-
const Context = createContext({});
|
|
328
|
+
const Context = React.createContext({});
|
|
330
329
|
function applyPropsToSystem(system2, props) {
|
|
331
330
|
if (system2["propsReady"]) {
|
|
332
331
|
publish(system2["propsReady"], false);
|
|
@@ -360,12 +359,12 @@ function systemToComponent(systemSpec, map2, Root) {
|
|
|
360
359
|
return handlers;
|
|
361
360
|
}, {});
|
|
362
361
|
}
|
|
363
|
-
const Component = forwardRef((propsWithChildren, ref) => {
|
|
362
|
+
const Component = React.forwardRef((propsWithChildren, ref) => {
|
|
364
363
|
const { children, ...props } = propsWithChildren;
|
|
365
|
-
const [system2] = useState(() => {
|
|
364
|
+
const [system2] = React.useState(() => {
|
|
366
365
|
return tap(init(systemSpec), (system22) => applyPropsToSystem(system22, props));
|
|
367
366
|
});
|
|
368
|
-
const [handlers] = useState(curry1to0(buildEventHandlers, system2));
|
|
367
|
+
const [handlers] = React.useState(curry1to0(buildEventHandlers, system2));
|
|
369
368
|
useIsomorphicLayoutEffect$2(() => {
|
|
370
369
|
for (const eventName of eventNames) {
|
|
371
370
|
if (eventName in props) {
|
|
@@ -379,11 +378,11 @@ function systemToComponent(systemSpec, map2, Root) {
|
|
|
379
378
|
useIsomorphicLayoutEffect$2(() => {
|
|
380
379
|
applyPropsToSystem(system2, props);
|
|
381
380
|
});
|
|
382
|
-
useImperativeHandle(ref, always(buildMethods(system2)));
|
|
383
|
-
return createElement(
|
|
381
|
+
React.useImperativeHandle(ref, always(buildMethods(system2)));
|
|
382
|
+
return React.createElement(
|
|
384
383
|
Context.Provider,
|
|
385
384
|
{ value: system2 },
|
|
386
|
-
Root ? createElement(
|
|
385
|
+
Root ? React.createElement(
|
|
387
386
|
Root,
|
|
388
387
|
omit([...requiredPropNames, ...optionalPropNames, ...eventNames], props),
|
|
389
388
|
children
|
|
@@ -391,12 +390,12 @@ function systemToComponent(systemSpec, map2, Root) {
|
|
|
391
390
|
);
|
|
392
391
|
});
|
|
393
392
|
const usePublisher2 = (key) => {
|
|
394
|
-
return useCallback(curry2to1(publish, useContext(Context)[key]), [key]);
|
|
393
|
+
return React.useCallback(curry2to1(publish, React.useContext(Context)[key]), [key]);
|
|
395
394
|
};
|
|
396
395
|
const useEmitterValue2 = (key) => {
|
|
397
|
-
const system2 = useContext(Context);
|
|
396
|
+
const system2 = React.useContext(Context);
|
|
398
397
|
const source = system2[key];
|
|
399
|
-
const [value, setValue] = useState(curry1to0(getValue, source));
|
|
398
|
+
const [value, setValue] = React.useState(curry1to0(getValue, source));
|
|
400
399
|
useIsomorphicLayoutEffect$2(
|
|
401
400
|
() => subscribe(source, (next) => {
|
|
402
401
|
if (next !== value) {
|
|
@@ -408,7 +407,7 @@ function systemToComponent(systemSpec, map2, Root) {
|
|
|
408
407
|
return value;
|
|
409
408
|
};
|
|
410
409
|
const useEmitter2 = (key, callback) => {
|
|
411
|
-
const context = useContext(Context);
|
|
410
|
+
const context = React.useContext(Context);
|
|
412
411
|
const source = context[key];
|
|
413
412
|
useIsomorphicLayoutEffect$2(() => subscribe(source, callback), [callback, source]);
|
|
414
413
|
};
|
|
@@ -419,7 +418,7 @@ function systemToComponent(systemSpec, map2, Root) {
|
|
|
419
418
|
useEmitter: useEmitter2
|
|
420
419
|
};
|
|
421
420
|
}
|
|
422
|
-
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
421
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
423
422
|
const useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
|
|
424
423
|
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
425
424
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
@@ -459,7 +458,7 @@ const loggerSystem = system(
|
|
|
459
458
|
{ singleton: true }
|
|
460
459
|
);
|
|
461
460
|
function useSizeWithElRef(callback, enabled = true) {
|
|
462
|
-
const ref = useRef(null);
|
|
461
|
+
const ref = React.useRef(null);
|
|
463
462
|
let callbackRef = (_el) => {
|
|
464
463
|
};
|
|
465
464
|
if (typeof ResizeObserver !== "undefined") {
|
|
@@ -553,10 +552,10 @@ function approximatelyEqual(num1, num2) {
|
|
|
553
552
|
return Math.abs(num1 - num2) < 1.01;
|
|
554
553
|
}
|
|
555
554
|
function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, scrollerElement, scrollerRefCallback = noop, customScrollParent) {
|
|
556
|
-
const scrollerRef = useRef(null);
|
|
557
|
-
const scrollTopTarget = useRef(null);
|
|
558
|
-
const timeoutRef = useRef(null);
|
|
559
|
-
const handler = useCallback(
|
|
555
|
+
const scrollerRef = React.useRef(null);
|
|
556
|
+
const scrollTopTarget = React.useRef(null);
|
|
557
|
+
const timeoutRef = React.useRef(null);
|
|
558
|
+
const handler = React.useCallback(
|
|
560
559
|
(ev) => {
|
|
561
560
|
const el = ev.target;
|
|
562
561
|
const windowScroll = el === window || el === document;
|
|
@@ -573,7 +572,7 @@ function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, s
|
|
|
573
572
|
if (ev.suppressFlushSync) {
|
|
574
573
|
call2();
|
|
575
574
|
} else {
|
|
576
|
-
flushSync(call2);
|
|
575
|
+
ReactDOM.flushSync(call2);
|
|
577
576
|
}
|
|
578
577
|
if (scrollTopTarget.current !== null) {
|
|
579
578
|
if (scrollTop === scrollTopTarget.current || scrollTop <= 0 || scrollTop === scrollHeight - viewportHeight) {
|
|
@@ -588,7 +587,7 @@ function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, s
|
|
|
588
587
|
},
|
|
589
588
|
[scrollContainerStateCallback, smoothScrollTargetReached]
|
|
590
589
|
);
|
|
591
|
-
useEffect(() => {
|
|
590
|
+
React.useEffect(() => {
|
|
592
591
|
const localRef = customScrollParent ? customScrollParent : scrollerRef.current;
|
|
593
592
|
scrollerRefCallback(customScrollParent ? customScrollParent : scrollerRef.current);
|
|
594
593
|
handler({ target: localRef, suppressFlushSync: true });
|
|
@@ -2670,8 +2669,8 @@ const positionStickyCssValue = simpleMemoize(() => {
|
|
|
2670
2669
|
return node.style.position === WEBKIT_STICKY ? WEBKIT_STICKY : STICKY;
|
|
2671
2670
|
});
|
|
2672
2671
|
function useWindowViewportRectRef(callback, customScrollParent) {
|
|
2673
|
-
const viewportInfo = useRef(null);
|
|
2674
|
-
const calculateInfo = useCallback(
|
|
2672
|
+
const viewportInfo = React.useRef(null);
|
|
2673
|
+
const calculateInfo = React.useCallback(
|
|
2675
2674
|
(element) => {
|
|
2676
2675
|
if (element === null || !element.offsetParent) {
|
|
2677
2676
|
return;
|
|
@@ -2698,10 +2697,10 @@ function useWindowViewportRectRef(callback, customScrollParent) {
|
|
|
2698
2697
|
[callback, customScrollParent]
|
|
2699
2698
|
);
|
|
2700
2699
|
const { callbackRef, ref } = useSizeWithElRef(calculateInfo);
|
|
2701
|
-
const scrollAndResizeEventHandler = useCallback(() => {
|
|
2700
|
+
const scrollAndResizeEventHandler = React.useCallback(() => {
|
|
2702
2701
|
calculateInfo(ref.current);
|
|
2703
2702
|
}, [calculateInfo, ref]);
|
|
2704
|
-
useEffect(() => {
|
|
2703
|
+
React.useEffect(() => {
|
|
2705
2704
|
if (customScrollParent) {
|
|
2706
2705
|
customScrollParent.addEventListener("scroll", scrollAndResizeEventHandler);
|
|
2707
2706
|
const observer = new ResizeObserver(scrollAndResizeEventHandler);
|
|
@@ -2721,8 +2720,8 @@ function useWindowViewportRectRef(callback, customScrollParent) {
|
|
|
2721
2720
|
}, [scrollAndResizeEventHandler, customScrollParent]);
|
|
2722
2721
|
return callbackRef;
|
|
2723
2722
|
}
|
|
2724
|
-
const VirtuosoMockContext = createContext(void 0);
|
|
2725
|
-
const VirtuosoGridMockContext = createContext(void 0);
|
|
2723
|
+
const VirtuosoMockContext = React.createContext(void 0);
|
|
2724
|
+
const VirtuosoGridMockContext = React.createContext(void 0);
|
|
2726
2725
|
function identity(value) {
|
|
2727
2726
|
return value;
|
|
2728
2727
|
}
|
|
@@ -2766,10 +2765,10 @@ const listComponentPropsSystem = /* @__PURE__ */ system(() => {
|
|
|
2766
2765
|
const combinedSystem$2 = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
|
|
2767
2766
|
return { ...listSystem2, ...propsSystem };
|
|
2768
2767
|
}, tup(listSystem, listComponentPropsSystem));
|
|
2769
|
-
const DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */
|
|
2768
|
+
const DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */ React.createElement("div", { style: { height } });
|
|
2770
2769
|
const GROUP_STYLE = { position: positionStickyCssValue(), zIndex: 1, overflowAnchor: "none" };
|
|
2771
2770
|
const ITEM_STYLE = { overflowAnchor: "none" };
|
|
2772
|
-
const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = false }) {
|
|
2771
|
+
const Items$1 = /* @__PURE__ */ React.memo(function VirtuosoItems({ showTopList = false }) {
|
|
2773
2772
|
const listState = useEmitterValue$2("listState");
|
|
2774
2773
|
const sizeRanges = usePublisher$2("sizeRanges");
|
|
2775
2774
|
const useWindowScroll = useEmitterValue$2("useWindowScroll");
|
|
@@ -2793,7 +2792,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
|
|
|
2793
2792
|
listGap,
|
|
2794
2793
|
customScrollParent
|
|
2795
2794
|
);
|
|
2796
|
-
const [deviation, setDeviation] = useState(0);
|
|
2795
|
+
const [deviation, setDeviation] = React.useState(0);
|
|
2797
2796
|
useEmitter$2("deviation", (value) => {
|
|
2798
2797
|
if (deviation !== value) {
|
|
2799
2798
|
setDeviation(value);
|
|
@@ -2815,9 +2814,9 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
|
|
|
2815
2814
|
marginTop: deviation
|
|
2816
2815
|
};
|
|
2817
2816
|
if (!showTopList && listState.totalCount === 0 && EmptyPlaceholder) {
|
|
2818
|
-
return createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
|
|
2817
|
+
return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
|
|
2819
2818
|
}
|
|
2820
|
-
return createElement(
|
|
2819
|
+
return React.createElement(
|
|
2821
2820
|
ListComponent,
|
|
2822
2821
|
{
|
|
2823
2822
|
...contextPropIfNotDomElement(ListComponent, context),
|
|
@@ -2829,7 +2828,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
|
|
|
2829
2828
|
const index = item.originalIndex;
|
|
2830
2829
|
const key = computeItemKey(index + listState.firstItemIndex, item.data, context);
|
|
2831
2830
|
if (isSeeking) {
|
|
2832
|
-
return createElement(ScrollSeekPlaceholder, {
|
|
2831
|
+
return React.createElement(ScrollSeekPlaceholder, {
|
|
2833
2832
|
...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
|
|
2834
2833
|
key,
|
|
2835
2834
|
index: item.index,
|
|
@@ -2839,7 +2838,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
|
|
|
2839
2838
|
});
|
|
2840
2839
|
}
|
|
2841
2840
|
if (item.type === "group") {
|
|
2842
|
-
return createElement(
|
|
2841
|
+
return React.createElement(
|
|
2843
2842
|
GroupComponent,
|
|
2844
2843
|
{
|
|
2845
2844
|
...contextPropIfNotDomElement(GroupComponent, context),
|
|
@@ -2852,7 +2851,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
|
|
|
2852
2851
|
groupContent(item.index)
|
|
2853
2852
|
);
|
|
2854
2853
|
} else {
|
|
2855
|
-
return createElement(
|
|
2854
|
+
return React.createElement(
|
|
2856
2855
|
ItemComponent,
|
|
2857
2856
|
{
|
|
2858
2857
|
...contextPropIfNotDomElement(ItemComponent, context),
|
|
@@ -2895,24 +2894,24 @@ function contextPropIfNotDomElement(element, context) {
|
|
|
2895
2894
|
}
|
|
2896
2895
|
return { context };
|
|
2897
2896
|
}
|
|
2898
|
-
const Header$1 = /* @__PURE__ */ memo(function VirtuosoHeader() {
|
|
2897
|
+
const Header$1 = /* @__PURE__ */ React.memo(function VirtuosoHeader() {
|
|
2899
2898
|
const Header2 = useEmitterValue$2("HeaderComponent");
|
|
2900
2899
|
const headerHeight = usePublisher$2("headerHeight");
|
|
2901
2900
|
const headerFooterTag = useEmitterValue$2("headerFooterTag");
|
|
2902
2901
|
const ref = useSize((el) => headerHeight(correctItemSize(el, "height")));
|
|
2903
2902
|
const context = useEmitterValue$2("context");
|
|
2904
|
-
return Header2 ? createElement(headerFooterTag, { ref }, createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
|
|
2903
|
+
return Header2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
|
|
2905
2904
|
});
|
|
2906
|
-
const Footer$1 = /* @__PURE__ */ memo(function VirtuosoFooter() {
|
|
2905
|
+
const Footer$1 = /* @__PURE__ */ React.memo(function VirtuosoFooter() {
|
|
2907
2906
|
const Footer2 = useEmitterValue$2("FooterComponent");
|
|
2908
2907
|
const footerHeight = usePublisher$2("footerHeight");
|
|
2909
2908
|
const headerFooterTag = useEmitterValue$2("headerFooterTag");
|
|
2910
2909
|
const ref = useSize((el) => footerHeight(correctItemSize(el, "height")));
|
|
2911
2910
|
const context = useEmitterValue$2("context");
|
|
2912
|
-
return Footer2 ? createElement(headerFooterTag, { ref }, createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
|
|
2911
|
+
return Footer2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
|
|
2913
2912
|
});
|
|
2914
2913
|
function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
|
|
2915
|
-
const Scroller2 = memo(function VirtuosoScroller({ style, children, ...props }) {
|
|
2914
|
+
const Scroller2 = React.memo(function VirtuosoScroller({ style, children, ...props }) {
|
|
2916
2915
|
const scrollContainerStateCallback = usePublisher2("scrollContainerState");
|
|
2917
2916
|
const ScrollerComponent = useEmitterValue2("ScrollerComponent");
|
|
2918
2917
|
const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached");
|
|
@@ -2926,7 +2925,7 @@ function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, u
|
|
|
2926
2925
|
);
|
|
2927
2926
|
useEmitter2("scrollTo", scrollToCallback);
|
|
2928
2927
|
useEmitter2("scrollBy", scrollByCallback);
|
|
2929
|
-
return createElement(
|
|
2928
|
+
return React.createElement(
|
|
2930
2929
|
ScrollerComponent,
|
|
2931
2930
|
{
|
|
2932
2931
|
ref: scrollerRef,
|
|
@@ -2943,7 +2942,7 @@ function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, u
|
|
|
2943
2942
|
return Scroller2;
|
|
2944
2943
|
}
|
|
2945
2944
|
function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
|
|
2946
|
-
const Scroller2 = memo(function VirtuosoWindowScroller({ style, children, ...props }) {
|
|
2945
|
+
const Scroller2 = React.memo(function VirtuosoWindowScroller({ style, children, ...props }) {
|
|
2947
2946
|
const scrollContainerStateCallback = usePublisher2("windowScrollContainerState");
|
|
2948
2947
|
const ScrollerComponent = useEmitterValue2("ScrollerComponent");
|
|
2949
2948
|
const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached");
|
|
@@ -2966,7 +2965,7 @@ function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitt
|
|
|
2966
2965
|
}, [scrollerRef, customScrollParent]);
|
|
2967
2966
|
useEmitter2("windowScrollTo", scrollToCallback);
|
|
2968
2967
|
useEmitter2("scrollBy", scrollByCallback);
|
|
2969
|
-
return createElement(
|
|
2968
|
+
return React.createElement(
|
|
2970
2969
|
ScrollerComponent,
|
|
2971
2970
|
{
|
|
2972
2971
|
style: { position: "relative", ...style, ...totalListHeight !== 0 ? { height: totalListHeight + deviation } : {} },
|
|
@@ -2980,53 +2979,46 @@ function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitt
|
|
|
2980
2979
|
return Scroller2;
|
|
2981
2980
|
}
|
|
2982
2981
|
const Viewport$2 = ({ children }) => {
|
|
2983
|
-
const ctx = useContext(VirtuosoMockContext);
|
|
2982
|
+
const ctx = React.useContext(VirtuosoMockContext);
|
|
2984
2983
|
const viewportHeight = usePublisher$2("viewportHeight");
|
|
2985
2984
|
const fixedItemHeight = usePublisher$2("fixedItemHeight");
|
|
2986
2985
|
const viewportRef = useSize(compose(viewportHeight, (el) => correctItemSize(el, "height")));
|
|
2987
|
-
useEffect(() => {
|
|
2986
|
+
React.useEffect(() => {
|
|
2988
2987
|
if (ctx) {
|
|
2989
2988
|
viewportHeight(ctx.viewportHeight);
|
|
2990
2989
|
fixedItemHeight(ctx.itemHeight);
|
|
2991
2990
|
}
|
|
2992
2991
|
}, [ctx, viewportHeight, fixedItemHeight]);
|
|
2993
|
-
return /* @__PURE__ */
|
|
2992
|
+
return /* @__PURE__ */ React.createElement("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children);
|
|
2994
2993
|
};
|
|
2995
2994
|
const WindowViewport$2 = ({ children }) => {
|
|
2996
|
-
const ctx = useContext(VirtuosoMockContext);
|
|
2995
|
+
const ctx = React.useContext(VirtuosoMockContext);
|
|
2997
2996
|
const windowViewportRect = usePublisher$2("windowViewportRect");
|
|
2998
2997
|
const fixedItemHeight = usePublisher$2("fixedItemHeight");
|
|
2999
2998
|
const customScrollParent = useEmitterValue$2("customScrollParent");
|
|
3000
2999
|
const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
|
|
3001
|
-
useEffect(() => {
|
|
3000
|
+
React.useEffect(() => {
|
|
3002
3001
|
if (ctx) {
|
|
3003
3002
|
fixedItemHeight(ctx.itemHeight);
|
|
3004
3003
|
windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
|
|
3005
3004
|
}
|
|
3006
3005
|
}, [ctx, windowViewportRect, fixedItemHeight]);
|
|
3007
|
-
return /* @__PURE__ */
|
|
3006
|
+
return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window" }, children);
|
|
3008
3007
|
};
|
|
3009
3008
|
const TopItemListContainer = ({ children }) => {
|
|
3010
3009
|
const TopItemList = useEmitterValue$2("TopItemListComponent");
|
|
3011
3010
|
const headerHeight = useEmitterValue$2("headerHeight");
|
|
3012
3011
|
const style = { ...topItemListStyle, marginTop: `${headerHeight}px` };
|
|
3013
3012
|
const context = useEmitterValue$2("context");
|
|
3014
|
-
return createElement(TopItemList || "div", { style, context }, children);
|
|
3013
|
+
return React.createElement(TopItemList || "div", { style, context }, children);
|
|
3015
3014
|
};
|
|
3016
|
-
const ListRoot = /* @__PURE__ */ memo(function VirtuosoRoot(props) {
|
|
3015
|
+
const ListRoot = /* @__PURE__ */ React.memo(function VirtuosoRoot(props) {
|
|
3017
3016
|
const useWindowScroll = useEmitterValue$2("useWindowScroll");
|
|
3018
3017
|
const showTopList = useEmitterValue$2("topItemsIndexes").length > 0;
|
|
3019
3018
|
const customScrollParent = useEmitterValue$2("customScrollParent");
|
|
3020
3019
|
const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$2 : Scroller$2;
|
|
3021
3020
|
const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$2 : Viewport$2;
|
|
3022
|
-
return /* @__PURE__ */
|
|
3023
|
-
showTopList && /* @__PURE__ */ jsx(TopItemListContainer, { children: /* @__PURE__ */ jsx(Items$1, { showTopList: true }) }),
|
|
3024
|
-
/* @__PURE__ */ jsxs(TheViewport, { children: [
|
|
3025
|
-
/* @__PURE__ */ jsx(Header$1, {}),
|
|
3026
|
-
/* @__PURE__ */ jsx(Items$1, {}),
|
|
3027
|
-
/* @__PURE__ */ jsx(Footer$1, {})
|
|
3028
|
-
] })
|
|
3029
|
-
] });
|
|
3021
|
+
return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, showTopList && /* @__PURE__ */ React.createElement(TopItemListContainer, null, /* @__PURE__ */ React.createElement(Items$1, { showTopList: true })), /* @__PURE__ */ React.createElement(TheViewport, null, /* @__PURE__ */ React.createElement(Header$1, null), /* @__PURE__ */ React.createElement(Items$1, null), /* @__PURE__ */ React.createElement(Footer$1, null)));
|
|
3030
3022
|
});
|
|
3031
3023
|
const {
|
|
3032
3024
|
Component: List,
|
|
@@ -3393,7 +3385,7 @@ const gridComponentPropsSystem = /* @__PURE__ */ system(() => {
|
|
|
3393
3385
|
const combinedSystem$1 = /* @__PURE__ */ system(([gridSystem2, gridComponentPropsSystem2]) => {
|
|
3394
3386
|
return { ...gridSystem2, ...gridComponentPropsSystem2 };
|
|
3395
3387
|
}, tup(gridSystem, gridComponentPropsSystem));
|
|
3396
|
-
const GridItems = /* @__PURE__ */ memo(function GridItems2() {
|
|
3388
|
+
const GridItems = /* @__PURE__ */ React.memo(function GridItems2() {
|
|
3397
3389
|
const gridState = useEmitterValue$1("gridState");
|
|
3398
3390
|
const listClassName = useEmitterValue$1("listClassName");
|
|
3399
3391
|
const itemClassName = useEmitterValue$1("itemClassName");
|
|
@@ -3420,7 +3412,7 @@ const GridItems = /* @__PURE__ */ memo(function GridItems2() {
|
|
|
3420
3412
|
column: resolveGapValue("column-gap", getComputedStyle(el).columnGap, log)
|
|
3421
3413
|
});
|
|
3422
3414
|
});
|
|
3423
|
-
return createElement(
|
|
3415
|
+
return React.createElement(
|
|
3424
3416
|
ListComponent,
|
|
3425
3417
|
{
|
|
3426
3418
|
ref: listRef,
|
|
@@ -3431,13 +3423,13 @@ const GridItems = /* @__PURE__ */ memo(function GridItems2() {
|
|
|
3431
3423
|
},
|
|
3432
3424
|
gridState.items.map((item) => {
|
|
3433
3425
|
const key = computeItemKey(item.index, item.data, context);
|
|
3434
|
-
return isSeeking ? createElement(ScrollSeekPlaceholder, {
|
|
3426
|
+
return isSeeking ? React.createElement(ScrollSeekPlaceholder, {
|
|
3435
3427
|
key,
|
|
3436
3428
|
...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
|
|
3437
3429
|
index: item.index,
|
|
3438
3430
|
height: gridState.itemHeight,
|
|
3439
3431
|
width: gridState.itemWidth
|
|
3440
|
-
}) : createElement(
|
|
3432
|
+
}) : React.createElement(
|
|
3441
3433
|
ItemComponent,
|
|
3442
3434
|
{ ...contextPropIfNotDomElement(ItemComponent, context), className: itemClassName, "data-index": item.index, key },
|
|
3443
3435
|
itemContent(item.index, item.data, context)
|
|
@@ -3445,61 +3437,57 @@ const GridItems = /* @__PURE__ */ memo(function GridItems2() {
|
|
|
3445
3437
|
})
|
|
3446
3438
|
);
|
|
3447
3439
|
});
|
|
3448
|
-
const Header = memo(function VirtuosoHeader2() {
|
|
3440
|
+
const Header = React.memo(function VirtuosoHeader2() {
|
|
3449
3441
|
const Header2 = useEmitterValue$1("HeaderComponent");
|
|
3450
3442
|
const headerHeight = usePublisher$1("headerHeight");
|
|
3451
3443
|
const headerFooterTag = useEmitterValue$1("headerFooterTag");
|
|
3452
3444
|
const ref = useSize((el) => headerHeight(correctItemSize(el, "height")));
|
|
3453
3445
|
const context = useEmitterValue$1("context");
|
|
3454
|
-
return Header2 ? createElement(headerFooterTag, { ref }, createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
|
|
3446
|
+
return Header2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
|
|
3455
3447
|
});
|
|
3456
|
-
const Footer = memo(function VirtuosoGridFooter() {
|
|
3448
|
+
const Footer = React.memo(function VirtuosoGridFooter() {
|
|
3457
3449
|
const Footer2 = useEmitterValue$1("FooterComponent");
|
|
3458
3450
|
const footerHeight = usePublisher$1("footerHeight");
|
|
3459
3451
|
const headerFooterTag = useEmitterValue$1("headerFooterTag");
|
|
3460
3452
|
const ref = useSize((el) => footerHeight(correctItemSize(el, "height")));
|
|
3461
3453
|
const context = useEmitterValue$1("context");
|
|
3462
|
-
return Footer2 ? createElement(headerFooterTag, { ref }, createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
|
|
3454
|
+
return Footer2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
|
|
3463
3455
|
});
|
|
3464
3456
|
const Viewport$1 = ({ children }) => {
|
|
3465
|
-
const ctx = useContext(VirtuosoGridMockContext);
|
|
3457
|
+
const ctx = React.useContext(VirtuosoGridMockContext);
|
|
3466
3458
|
const itemDimensions = usePublisher$1("itemDimensions");
|
|
3467
3459
|
const viewportDimensions = usePublisher$1("viewportDimensions");
|
|
3468
3460
|
const viewportRef = useSize((el) => {
|
|
3469
3461
|
viewportDimensions(el.getBoundingClientRect());
|
|
3470
3462
|
});
|
|
3471
|
-
useEffect(() => {
|
|
3463
|
+
React.useEffect(() => {
|
|
3472
3464
|
if (ctx) {
|
|
3473
3465
|
viewportDimensions({ height: ctx.viewportHeight, width: ctx.viewportWidth });
|
|
3474
3466
|
itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
|
|
3475
3467
|
}
|
|
3476
3468
|
}, [ctx, viewportDimensions, itemDimensions]);
|
|
3477
|
-
return /* @__PURE__ */
|
|
3469
|
+
return /* @__PURE__ */ React.createElement("div", { style: viewportStyle, ref: viewportRef }, children);
|
|
3478
3470
|
};
|
|
3479
3471
|
const WindowViewport$1 = ({ children }) => {
|
|
3480
|
-
const ctx = useContext(VirtuosoGridMockContext);
|
|
3472
|
+
const ctx = React.useContext(VirtuosoGridMockContext);
|
|
3481
3473
|
const windowViewportRect = usePublisher$1("windowViewportRect");
|
|
3482
3474
|
const itemDimensions = usePublisher$1("itemDimensions");
|
|
3483
3475
|
const customScrollParent = useEmitterValue$1("customScrollParent");
|
|
3484
3476
|
const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
|
|
3485
|
-
useEffect(() => {
|
|
3477
|
+
React.useEffect(() => {
|
|
3486
3478
|
if (ctx) {
|
|
3487
3479
|
itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
|
|
3488
3480
|
windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: ctx.viewportWidth });
|
|
3489
3481
|
}
|
|
3490
3482
|
}, [ctx, windowViewportRect, itemDimensions]);
|
|
3491
|
-
return /* @__PURE__ */
|
|
3483
|
+
return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle }, children);
|
|
3492
3484
|
};
|
|
3493
|
-
const GridRoot = /* @__PURE__ */ memo(function GridRoot2({ ...props }) {
|
|
3485
|
+
const GridRoot = /* @__PURE__ */ React.memo(function GridRoot2({ ...props }) {
|
|
3494
3486
|
const useWindowScroll = useEmitterValue$1("useWindowScroll");
|
|
3495
3487
|
const customScrollParent = useEmitterValue$1("customScrollParent");
|
|
3496
3488
|
const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$1 : Scroller$1;
|
|
3497
3489
|
const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$1 : Viewport$1;
|
|
3498
|
-
return /* @__PURE__ */
|
|
3499
|
-
/* @__PURE__ */ jsx(Header, {}),
|
|
3500
|
-
/* @__PURE__ */ jsx(GridItems, {}),
|
|
3501
|
-
/* @__PURE__ */ jsx(Footer, {})
|
|
3502
|
-
] }) });
|
|
3490
|
+
return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, /* @__PURE__ */ React.createElement(TheViewport, null, /* @__PURE__ */ React.createElement(Header, null), /* @__PURE__ */ React.createElement(GridItems, null), /* @__PURE__ */ React.createElement(Footer, null)));
|
|
3503
3491
|
});
|
|
3504
3492
|
const {
|
|
3505
3493
|
Component: Grid,
|
|
@@ -3555,10 +3543,7 @@ function resolveGapValue(property, value, log) {
|
|
|
3555
3543
|
}
|
|
3556
3544
|
const VirtuosoGrid = Grid;
|
|
3557
3545
|
const tableComponentPropsSystem = /* @__PURE__ */ system(() => {
|
|
3558
|
-
const itemContent = statefulStream((index) => /* @__PURE__ */
|
|
3559
|
-
"Item $",
|
|
3560
|
-
index
|
|
3561
|
-
] }));
|
|
3546
|
+
const itemContent = statefulStream((index) => /* @__PURE__ */ React.createElement("td", null, "Item $", index));
|
|
3562
3547
|
const context = statefulStream(null);
|
|
3563
3548
|
const fixedHeaderContent = statefulStream(null);
|
|
3564
3549
|
const fixedFooterContent = statefulStream(null);
|
|
@@ -3597,9 +3582,9 @@ const tableComponentPropsSystem = /* @__PURE__ */ system(() => {
|
|
|
3597
3582
|
const combinedSystem = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
|
|
3598
3583
|
return { ...listSystem2, ...propsSystem };
|
|
3599
3584
|
}, tup(listSystem, tableComponentPropsSystem));
|
|
3600
|
-
const DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */
|
|
3601
|
-
const DefaultFillerRow = ({ height }) => /* @__PURE__ */
|
|
3602
|
-
const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
|
|
3585
|
+
const DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { style: { height } }));
|
|
3586
|
+
const DefaultFillerRow = ({ height }) => /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { style: { height, padding: 0, border: 0 } }));
|
|
3587
|
+
const Items = /* @__PURE__ */ React.memo(function VirtuosoItems2() {
|
|
3603
3588
|
const listState = useEmitterValue("listState");
|
|
3604
3589
|
const sizeRanges = usePublisher("sizeRanges");
|
|
3605
3590
|
const useWindowScroll = useEmitterValue("useWindowScroll");
|
|
@@ -3620,7 +3605,7 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
|
|
|
3620
3605
|
void 0,
|
|
3621
3606
|
customScrollParent
|
|
3622
3607
|
);
|
|
3623
|
-
const [deviation, setDeviation] = useState(0);
|
|
3608
|
+
const [deviation, setDeviation] = React.useState(0);
|
|
3624
3609
|
useEmitter("deviation", (value) => {
|
|
3625
3610
|
if (deviation !== value) {
|
|
3626
3611
|
ref.current.style.marginTop = `${value}px`;
|
|
@@ -3639,17 +3624,17 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
|
|
|
3639
3624
|
const statefulTotalCount = useEmitterValue("statefulTotalCount");
|
|
3640
3625
|
const context = useEmitterValue("context");
|
|
3641
3626
|
if (statefulTotalCount === 0 && EmptyPlaceholder) {
|
|
3642
|
-
return createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
|
|
3627
|
+
return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
|
|
3643
3628
|
}
|
|
3644
3629
|
const paddingTop = listState.offsetTop + paddingTopAddition + deviation;
|
|
3645
3630
|
const paddingBottom = listState.offsetBottom;
|
|
3646
|
-
const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */
|
|
3647
|
-
const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */
|
|
3631
|
+
const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ React.createElement(FillerRow, { height: paddingTop, key: "padding-top", context }) : null;
|
|
3632
|
+
const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ React.createElement(FillerRow, { height: paddingBottom, key: "padding-bottom", context }) : null;
|
|
3648
3633
|
const items = listState.items.map((item) => {
|
|
3649
3634
|
const index = item.originalIndex;
|
|
3650
3635
|
const key = computeItemKey(index + firstItemIndex, item.data, context);
|
|
3651
3636
|
if (isSeeking) {
|
|
3652
|
-
return createElement(ScrollSeekPlaceholder, {
|
|
3637
|
+
return React.createElement(ScrollSeekPlaceholder, {
|
|
3653
3638
|
...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
|
|
3654
3639
|
key,
|
|
3655
3640
|
index: item.index,
|
|
@@ -3657,7 +3642,7 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
|
|
|
3657
3642
|
type: item.type || "item"
|
|
3658
3643
|
});
|
|
3659
3644
|
}
|
|
3660
|
-
return createElement(
|
|
3645
|
+
return React.createElement(
|
|
3661
3646
|
TableRowComponent,
|
|
3662
3647
|
{
|
|
3663
3648
|
...contextPropIfNotDomElement(TableRowComponent, context),
|
|
@@ -3671,40 +3656,40 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
|
|
|
3671
3656
|
itemContent(item.index, item.data, context)
|
|
3672
3657
|
);
|
|
3673
3658
|
});
|
|
3674
|
-
return createElement(
|
|
3659
|
+
return React.createElement(
|
|
3675
3660
|
TableBodyComponent,
|
|
3676
3661
|
{ ref: callbackRef, "data-test-id": "virtuoso-item-list", ...contextPropIfNotDomElement(TableBodyComponent, context) },
|
|
3677
3662
|
[paddingTopEl, ...items, paddingBottomEl]
|
|
3678
3663
|
);
|
|
3679
3664
|
});
|
|
3680
3665
|
const Viewport = ({ children }) => {
|
|
3681
|
-
const ctx = useContext(VirtuosoMockContext);
|
|
3666
|
+
const ctx = React.useContext(VirtuosoMockContext);
|
|
3682
3667
|
const viewportHeight = usePublisher("viewportHeight");
|
|
3683
3668
|
const fixedItemHeight = usePublisher("fixedItemHeight");
|
|
3684
3669
|
const viewportRef = useSize(compose(viewportHeight, (el) => correctItemSize(el, "height")));
|
|
3685
|
-
useEffect(() => {
|
|
3670
|
+
React.useEffect(() => {
|
|
3686
3671
|
if (ctx) {
|
|
3687
3672
|
viewportHeight(ctx.viewportHeight);
|
|
3688
3673
|
fixedItemHeight(ctx.itemHeight);
|
|
3689
3674
|
}
|
|
3690
3675
|
}, [ctx, viewportHeight, fixedItemHeight]);
|
|
3691
|
-
return /* @__PURE__ */
|
|
3676
|
+
return /* @__PURE__ */ React.createElement("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children);
|
|
3692
3677
|
};
|
|
3693
3678
|
const WindowViewport = ({ children }) => {
|
|
3694
|
-
const ctx = useContext(VirtuosoMockContext);
|
|
3679
|
+
const ctx = React.useContext(VirtuosoMockContext);
|
|
3695
3680
|
const windowViewportRect = usePublisher("windowViewportRect");
|
|
3696
3681
|
const fixedItemHeight = usePublisher("fixedItemHeight");
|
|
3697
3682
|
const customScrollParent = useEmitterValue("customScrollParent");
|
|
3698
3683
|
const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
|
|
3699
|
-
useEffect(() => {
|
|
3684
|
+
React.useEffect(() => {
|
|
3700
3685
|
if (ctx) {
|
|
3701
3686
|
fixedItemHeight(ctx.itemHeight);
|
|
3702
3687
|
windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
|
|
3703
3688
|
}
|
|
3704
3689
|
}, [ctx, windowViewportRect, fixedItemHeight]);
|
|
3705
|
-
return /* @__PURE__ */
|
|
3690
|
+
return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window" }, children);
|
|
3706
3691
|
};
|
|
3707
|
-
const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
|
|
3692
|
+
const TableRoot = /* @__PURE__ */ React.memo(function TableVirtuosoRoot(props) {
|
|
3708
3693
|
const useWindowScroll = useEmitterValue("useWindowScroll");
|
|
3709
3694
|
const customScrollParent = useEmitterValue("customScrollParent");
|
|
3710
3695
|
const fixedHeaderHeight = usePublisher("fixedHeaderHeight");
|
|
@@ -3719,7 +3704,7 @@ const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
|
|
|
3719
3704
|
const TheTable = useEmitterValue("TableComponent");
|
|
3720
3705
|
const TheTHead = useEmitterValue("TableHeadComponent");
|
|
3721
3706
|
const TheTFoot = useEmitterValue("TableFooterComponent");
|
|
3722
|
-
const theHead = fixedHeaderContent ? createElement(
|
|
3707
|
+
const theHead = fixedHeaderContent ? React.createElement(
|
|
3723
3708
|
TheTHead,
|
|
3724
3709
|
{
|
|
3725
3710
|
key: "TableHead",
|
|
@@ -3729,7 +3714,7 @@ const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
|
|
|
3729
3714
|
},
|
|
3730
3715
|
fixedHeaderContent()
|
|
3731
3716
|
) : null;
|
|
3732
|
-
const theFoot = fixedFooterContent ? createElement(
|
|
3717
|
+
const theFoot = fixedFooterContent ? React.createElement(
|
|
3733
3718
|
TheTFoot,
|
|
3734
3719
|
{
|
|
3735
3720
|
key: "TableFoot",
|
|
@@ -3739,11 +3724,11 @@ const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
|
|
|
3739
3724
|
},
|
|
3740
3725
|
fixedFooterContent()
|
|
3741
3726
|
) : null;
|
|
3742
|
-
return /* @__PURE__ */
|
|
3727
|
+
return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, /* @__PURE__ */ React.createElement(TheViewport, null, React.createElement(TheTable, { style: { borderSpacing: 0 }, ...contextPropIfNotDomElement(TheTable, context) }, [
|
|
3743
3728
|
theHead,
|
|
3744
|
-
/* @__PURE__ */
|
|
3729
|
+
/* @__PURE__ */ React.createElement(Items, { key: "TableBody" }),
|
|
3745
3730
|
theFoot
|
|
3746
|
-
])
|
|
3731
|
+
])));
|
|
3747
3732
|
});
|
|
3748
3733
|
const {
|
|
3749
3734
|
Component: Table,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @packageDocumentation
|
|
29
29
|
*/
|
|
30
|
-
import
|
|
30
|
+
import React from 'react';
|
|
31
31
|
import * as u from '../urx';
|
|
32
32
|
import type { Emitter, Publisher, AnySystemSpec, SR, Stream } from '../urx';
|
|
33
33
|
/** @internal */
|
|
@@ -86,7 +86,7 @@ export type MethodsFromPropMap<E extends AnySystemSpec, M extends SystemPropsMap
|
|
|
86
86
|
*
|
|
87
87
|
* @typeParam T the type of the component
|
|
88
88
|
*/
|
|
89
|
-
export type RefHandle<T> = T extends ForwardRefExoticComponent<RefAttributes<infer Handle>> ? Handle : never;
|
|
89
|
+
export type RefHandle<T> = T extends React.ForwardRefExoticComponent<React.RefAttributes<infer Handle>> ? Handle : never;
|
|
90
90
|
/**
|
|
91
91
|
* Converts a system spec to React component by mapping the system streams to component properties, events and methods. Returns hooks for querying and modifying
|
|
92
92
|
* the system streams from the component's child components.
|
|
@@ -101,9 +101,9 @@ export type RefHandle<T> = T extends ForwardRefExoticComponent<RefAttributes<inf
|
|
|
101
101
|
* <hr />
|
|
102
102
|
*/
|
|
103
103
|
export declare function systemToComponent<SS extends AnySystemSpec, M extends SystemPropsMap<SS>, S extends SR<SS>, R>(systemSpec: SS, map: M, Root?: R): {
|
|
104
|
-
Component: ForwardRefExoticComponent<
|
|
105
|
-
children?: ReactNode;
|
|
106
|
-
})> & RefAttributes<MethodsFromPropMap<SS, M>>>;
|
|
104
|
+
Component: React.ForwardRefExoticComponent<React.PropsWithoutRef<{ [K in Extract<keyof M["required"], string>]: M["required"][K] extends string ? ReturnType<SS["constructor"]>[M["required"][K]] extends Observable<infer R_1> ? R_1 : never : never; } & { [K_1 in Extract<keyof M["optional"], string>]?: (M["optional"][K_1] extends string ? ReturnType<SS["constructor"]>[M["optional"][K_1]] extends Observable<infer R_2> ? R_2 : never : never) | undefined; } & { [K_2 in Extract<keyof M["events"], string>]?: (M["events"][K_2] extends string ? ReturnType<SS["constructor"]>[M["events"][K_2]] extends Observable<infer R_3> ? (value: R_3) => void : never : never) | undefined; } & (R extends React.ComponentType<infer RP> ? RP : {
|
|
105
|
+
children?: React.ReactNode;
|
|
106
|
+
})> & React.RefAttributes<MethodsFromPropMap<SS, M>>>;
|
|
107
107
|
usePublisher: <K_3 extends keyof S>(key: K_3) => (value: S[K_3] extends u.Stream<infer R_4> ? R_4 : never) => void;
|
|
108
108
|
useEmitterValue: <K_4 extends keyof S, V = S[K_4] extends u.StatefulStream<infer R_5> ? R_5 : never>(key: K_4) => V;
|
|
109
109
|
useEmitter: <K_5 extends keyof S, V_1 = S[K_5] extends u.Stream<infer R_6> ? R_6 : never>(key: K_5, callback: (value: V_1) => void) => void;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Petyo Ivanov",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.6",
|
|
7
7
|
"homepage": "https://virtuoso.dev/",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"source": "src/index.tsx",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"e2e": "playwright test",
|
|
35
35
|
"lint": "eslint src test e2e --ext .ts,.tsx",
|
|
36
36
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
37
|
-
"dev": "ladle serve",
|
|
37
|
+
"dev": "ladle serve --viteConfig ladle.vite.config.ts",
|
|
38
38
|
"prepare": "pnpm run build && husky install",
|
|
39
39
|
"semantic-release": "semantic-release"
|
|
40
40
|
},
|