UNPKG

@nexusui/components

Version:

These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.

3 lines (2 loc) 852 B
"use client"; "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-virtualized-auto-sizer"),a=require("./VirtualizedCardList.component.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=i(r);exports.VirtualizedCardList=r=>{const{data:i=[],renderCard:u,onFetchData:n,loading:s=!1,total:o=0,initialPage:l=0,pageSize:c=50,emptyState:h,selectedCardId:p,...f}=r,[g,C]=t.useState(l),j=t.useRef(!1),m=s?()=>{}:()=>{const e=g+1;C(e),n(e,c)};return t.useEffect((()=>{j.current||(j.current=!0,n(g,c))}),[g,c,n]),e.jsx(d.default,{children:({height:t=0,width:r=0})=>e.jsx(a.VirtualizedCardListComponent,{page:g,total:o,data:i,renderCard:u,emptyState:h,loading:s,hasNextPage:i.length<o,loadMoreItems:m,height:t,width:r,selectedCardId:p,...f})})};