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) 725 B
"use client"; import{jsx as t}from"react/jsx-runtime";import{useState as e,useRef as r,useEffect as a}from"react";import i from"react-virtualized-auto-sizer";import{VirtualizedCardListComponent as o}from"./VirtualizedCardList.component.js";const d=d=>{const{data:n=[],renderCard:c,onFetchData:m,loading:l=!1,total:s=0,initialPage:h=0,pageSize:p=50,emptyState:g,selectedCardId:u,...C}=d,[f,z]=e(h),x=r(!1),I=l?()=>{}:()=>{const t=f+1;z(t),m(t,p)};return a((()=>{x.current||(x.current=!0,m(f,p))}),[f,p,m]),t(i,{children:({height:e=0,width:r=0})=>t(o,{page:f,total:s,data:n,renderCard:c,emptyState:g,loading:l,hasNextPage:n.length<s,loadMoreItems:I,height:e,width:r,selectedCardId:u,...C})})};export{d as VirtualizedCardList};