@tirth_jasoliya/ui 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  "use client"
2
- import{useState as I,useEffect as Ae,useMemo as he,useCallback as $,useRef as wt}from"react";import{Loader2 as je}from"lucide-react";import{clsx as Qe}from"clsx";import{twMerge as Ye}from"tailwind-merge";function n(...e){return Ye(Qe(e))}import{jsx as Fe}from"react/jsx-runtime";function oe({className:e,...t}){return Fe("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function ae({className:e,...t}){return Fe("div",{"data-slot":"card-content",className:n("px-6",e),...t})}import{Slot as et}from"radix-ui";import{cva as tt}from"class-variance-authority";import{jsx as at}from"react/jsx-runtime";var ot=tt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function h({className:e,variant:t,size:r,asChild:x=!1,...u}){let D=x?et.Slot:"button";return at(D,{"data-slot":"button",className:n(ot({variant:t,size:r,className:e}),"transition-none"),...u})}import{Checkbox as Be}from"radix-ui";import{CheckIcon as nt}from"lucide-react";import{jsx as ue}from"react/jsx-runtime";function Ge({className:e,...t}){return ue(Be.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:ue(Be.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:ue(nt,{className:"size-3.5"})})})}import{Search as ct,Download as mt,RefreshCw as ut,Filter as pt,ChevronDown as ft,Settings2 as gt}from"lucide-react";import{jsx as rt}from"react/jsx-runtime";function pe({className:e,type:t,...r}){return rt("input",{type:t,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}import{DropdownMenu as R}from"radix-ui";import{CheckIcon as Wt,ChevronRightIcon as qt,CircleIcon as Et}from"lucide-react";import{jsx as M,jsxs as Xt}from"react/jsx-runtime";function fe({...e}){return M(R.Root,{"data-slot":"dropdown-menu",...e})}function ge({...e}){return M(R.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ve({className:e,sideOffset:t=4,...r}){return M(R.Portal,{children:M(R.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...r})})}function j({className:e,inset:t,variant:r="default",...x}){return M(R.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:n("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...x})}function be({className:e,inset:t,...r}){return M(R.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function ne({className:e,...t}){return M(R.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t})}import{Select as C}from"radix-ui";import{CheckIcon as st,ChevronDownIcon as _e,ChevronUpIcon as it}from"lucide-react";import{jsx as v,jsxs as xe}from"react/jsx-runtime";function re({...e}){return v(C.Root,{"data-slot":"select",...e})}function se({...e}){return v(C.Value,{"data-slot":"select-value",...e})}function ie({className:e,size:t="default",children:r,...x}){return xe(C.Trigger,{"data-slot":"select-trigger","data-size":t,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...x,children:[r,v(C.Icon,{asChild:!0,children:v(_e,{className:"size-4 opacity-50"})})]})}function le({className:e,children:t,position:r="popper",...x}){return v(C.Portal,{children:xe(C.Content,{"data-slot":"select-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...x,children:[v(lt,{}),v(C.Viewport,{className:n("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),v(dt,{})]})})}function K({className:e,children:t,...r}){return xe(C.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[v("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:v(C.ItemIndicator,{children:v(st,{className:"size-4"})})}),v(C.ItemText,{children:t})]})}function lt({className:e,...t}){return v(C.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:v(it,{className:"size-4"})})}function dt({className:e,...t}){return v(C.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:v(_e,{className:"size-4"})})}import{Fragment as vt,jsx as a,jsxs as p}from"react/jsx-runtime";function Ve({fields:e,filters:t,globalFilter:r,onGlobalFilterChange:x,fieldFilters:u,onFieldFilterChange:D,sortField:P,sortDirection:B,onSortChange:G,selectedCount:O,totalCount:_,visibleCount:U,onExport:V,onRefresh:b,loading:w,onClearFilters:m,onClearSorting:k}){let W=e.filter(o=>o.sortable),de=Object.values(u).some(o=>o!=null&&o!=="")||r!=="",Q=P!=="";return a("div",{className:"rounded-xl p-0.5",children:a("div",{className:"px-2",children:a("div",{className:"flex flex-col gap-6",children:p("div",{className:"flex items-center justify-between",children:[a("div",{className:"flex items-center gap-3",children:t.length>0&&p("div",{className:"flex items-center gap-3 flex-wrap",children:[a("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:a(pt,{className:"h-4 w-4"})}),t.map(o=>a("div",{className:"relative min-w-[150px]",children:o.type==="select"?p(re,{value:u[o.key]||"all",onValueChange:f=>D(o.key,f),children:[o.icon&&a(o.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a(ie,{className:n("h-9 rounded-lg w-full",o.icon&&"pl-9"),children:a(se,{placeholder:o.placeholder||"Select..."})}),p(le,{className:"rounded-lg",children:[a(K,{value:"all",children:"All"}),o.options?.map(f=>a(K,{value:f.value,children:f.label},f.value))]})]}):p("div",{className:"relative",children:[o.icon&&a(o.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a(pe,{type:o.type,placeholder:o.placeholder,value:u[o.key]||"",onChange:f=>D(o.key,f.target.value),className:n("h-9 rounded-lg",o.icon&&"pl-9")})]})},String(o.key)))]})}),p("div",{className:"flex items-center gap-2",children:[p("div",{className:"relative",children:[a(ct,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a(pe,{placeholder:"Global search...",value:r,onChange:o=>x(o.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),W.length>0&&p(fe,{children:[a(ge,{asChild:!0,children:p(h,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[a("span",{children:"Sort"}),a(ft,{className:"h-4 w-4 opacity-50"})]})}),p(ve,{align:"end",className:"w-[200px] rounded-lg",children:[a(be,{children:"Sort By"}),a(ne,{}),W.map(o=>p("div",{children:[p(j,{onClick:()=>G(o.key,"asc"),children:[o.label," (A-Z)"]}),p(j,{onClick:()=>G(o.key,"desc"),children:[o.label," (Z-A)"]})]},String(o.key))),Q&&p(vt,{children:[a(ne,{}),a(j,{onClick:k,children:"Clear All Sorting"})]})]})]}),p(fe,{children:[a(ge,{asChild:!0,children:a(h,{variant:"outline",size:"sm",className:"rounded-lg",children:a(gt,{className:"h-4 w-4"})})}),p(ve,{align:"end",className:"w-[200px] rounded-lg",children:[a(be,{children:"Table Settings"}),a(ne,{}),a(j,{onClick:k,children:"Clear All Sorting"}),a(j,{onClick:m,children:"Clear All Filters"})]})]}),V&&p(h,{variant:"outline",size:"sm",onClick:V,className:"rounded-lg",children:[a(mt,{className:"mr-2 h-4 w-4"}),"Export"]}),b&&a(h,{variant:"outline",size:"sm",onClick:b,disabled:w,className:"rounded-lg",children:a(ut,{className:n("h-4 w-4",w&&"animate-spin")})})]})]})})})})}import{ChevronLeft as bt,ChevronRight as xt,ChevronsLeft as ht,ChevronsRight as Ct}from"lucide-react";import{jsx as c,jsxs as N}from"react/jsx-runtime";function Le({currentPage:e,totalPages:t,pageSize:r,totalItems:x,onPageChange:u,onPageSizeChange:D,config:P}){if(!P.enabled)return null;let B=P.pageSizeOptions||[10,20,50,100],G=(e-1)*r+1,O=Math.min(e*r,x),_=e>1,U=e<t,V=()=>{let w=[],m=[];for(let k=Math.max(2,e-2);k<=Math.min(t-1,e+2);k++)w.push(k);return e-2>2?m.push(1,"..."):m.push(1),m.push(...w),e+2<t-1?m.push("...",t):t>1&&m.push(t),m};return c("div",{className:"rounded-xl",children:N("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[c("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:P.showInfo!==!1&&N("span",{children:["Showing ",G," to ",O," of ",x," entries"]})}),N("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[B&&N("div",{className:"flex items-center gap-2",children:[c("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),N(re,{value:`${r}`,onValueChange:b=>D(Number(b)),children:[c(ie,{className:"h-9 w-[70px] rounded-lg",children:c(se,{})}),c(le,{side:"top",className:"rounded-lg",children:B.map(b=>c(K,{value:`${b}`,children:b},b))})]})]}),N("div",{className:"flex items-center gap-2",children:[N(h,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:!_,className:"hidden sm:flex rounded-lg",children:[c(ht,{className:"h-4 w-4"}),c("span",{className:"sr-only",children:"Go to first page"})]}),N(h,{variant:"outline",size:"sm",onClick:()=>u(e-1),disabled:!_,className:"rounded-lg",children:[c(bt,{className:"h-4 w-4 sm:mr-2"}),c("span",{className:"hidden sm:inline",children:"Previous"}),c("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),P.showPageNumbers&&t>1&&c("div",{className:"hidden sm:flex items-center gap-1",children:V().map((b,w)=>{if(b==="...")return c("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${w}`);let m=b;return c(h,{variant:m===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>u(m),children:m},m)})}),N("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),N(h,{variant:"outline",size:"sm",onClick:()=>u(e+1),disabled:!U,className:"rounded-lg",children:[c("span",{className:"hidden sm:inline",children:"Next"}),c(xt,{className:"h-4 w-4 sm:ml-2"}),c("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),N(h,{variant:"outline",size:"sm",onClick:()=>u(t),disabled:!U,className:"hidden sm:flex rounded-lg",children:[c(Ct,{className:"h-4 w-4"}),c("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as d,jsxs as F}from"react/jsx-runtime";function Po({data:e,template:t,fields:r=[],filters:x=[],pagination:u={enabled:!1},settings:D={},header:P,footer:B,className:G="",loading:O=!1,error:_,emptyMessage:U="No items found",emptyIcon:V,onSelectionChange:b,onExport:w,onRefresh:m,onTemplateReady:k,children:W}){let{enableSorting:de=!0,enableFiltering:Q=!0,enableGlobalSearch:o=!0,enableSelection:f=!1,enableExport:$e=!1,toolbar:Oe=!0,selectionMode:q="multiple",gridCols:Ue={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Ce=4,aspectRatio:we="auto",minCardWidth:ye=350,maxCardWidth:Se=350}=D,[E,Ne]=I(""),[Z,Pe]=I({}),[L,ke]=I(""),[H,De]=I("asc"),[T,Y]=I(new Set),[ee,te]=I(1),[A,We]=I(u.pageSize||12),[Te,yt]=I(Ue.default),g=he(()=>{let s=[...e];if(o&&E){let l=r.filter(i=>i.searchable!==!1);s=s.filter(i=>l.some(y=>i[y.key]?.toString().toLowerCase().includes(E.toLowerCase())))}if(Q&&Object.keys(Z).forEach(l=>{let i=Z[l];if(i!=null&&i!==""){let y=r.find(S=>S.key===l);y&&(s=s.filter(S=>{let z=S[l];return y.type==="boolean"?z===(i==="true"):y.type==="number"?z===Number(i):z?.toString().toLowerCase().includes(String(i).toLowerCase())}))}}),de&&L){let l=r.find(i=>i.key===L);l&&s.sort((i,y)=>{let S=i[L],z=y[L];if(l.type==="number")return H==="asc"?Number(S)-Number(z):Number(z)-Number(S);if(l.type==="date"){let X=new Date(S),J=new Date(z);return H==="asc"?X.getTime()-J.getTime():J.getTime()-X.getTime()}else{let X=String(S).toLowerCase(),J=String(z).toLowerCase();return H==="asc"?X.localeCompare(J):J.localeCompare(X)}})}return s},[e,E,Z,L,H,r,o,Q,de]),ze=he(()=>{if(!u.enabled)return g;let s=(ee-1)*A,l=s+A;return g.slice(s,l)},[g,ee,A,u.enabled]),qe=Math.ceil(g.length/A),ce=$(s=>{f&&Y(l=>{let i=new Set(l);return q==="single"?(i.clear(),i.add(s)):i.has(s)?i.delete(s):i.add(s),i})},[f,q]),Ie=$(()=>{!f||q==="single"||(T.size===g.length?Y(new Set):Y(new Set(g.map((s,l)=>l))))},[f,q,T.size,g.length]),Ee=$((s,l)=>{Pe(i=>({...i,[s]:l})),te(1)},[]),Ze=$((s,l)=>{ke(s),De(l)},[]),Re=$(()=>{Ne(""),Pe({}),te(1)},[]),He=$(()=>{ke(""),De("asc")},[]),Me=he(()=>({getSelectedItems:()=>Array.from(T).map(s=>g[s]),clearSelection:()=>Y(new Set),selectAll:Ie,getFilteredData:()=>g,getTotalCount:()=>e.length,getVisibleCount:()=>g.length,refresh:()=>m?.(),exportData:()=>w?.(g)}),[T,g,e.length,Ie,m,w]),me=wt(null);me.current=Me,Ae(()=>{k&&me.current&&k(me.current)},[]),Ae(()=>{if(f&&b){let s=Array.from(T).map(l=>g[l]);b(s)}},[T]);let Xe=n("w-full","overflow-hidden",G),Je=n("grid",`gap-${Ce}`,"w-full","mx-auto","items-start"),Ke={gridTemplateColumns:Te===0?`repeat(auto-fill, minmax(clamp(${ye}px, 30%, ${Se}px), 1fr))`:`repeat(auto-fill, minmax(clamp(${ye}px, calc(100%/${Te} - ${Ce*4}px), ${Se}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return _?d(oe,{className:"w-full",children:d(ae,{className:"flex items-center justify-center py-12",children:F("div",{className:"text-center",children:[d("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),d("p",{className:"text-sm text-muted-foreground mb-4",children:_}),m&&F(h,{variant:"outline",size:"sm",onClick:m,children:[d(je,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):F("div",{className:n("w-full flex gap-2 flex-col h-full",Xe),children:[P&&d(oe,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:d(ae,{className:"p-2",children:P})}),Oe&&d(Ve,{fields:r,filters:x,globalFilter:E,onGlobalFilterChange:Ne,fieldFilters:Z,onFieldFilterChange:Ee,sortField:L,sortDirection:H,onSortChange:Ze,selectedCount:T.size,totalCount:e.length,visibleCount:g.length,onExport:$e?()=>w?.(g):void 0,onRefresh:m,loading:O,onClearFilters:Re,onClearSorting:He}),d(oe,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:d(ae,{className:"px-0",children:F("div",{className:"relative",children:[O&&d("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:F("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[d(je,{className:"size-5 animate-spin text-primary"}),d("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),ze.length>0?d("div",{className:n(Je),style:Ke,children:ze.map((s,l)=>{let i=u.enabled?(ee-1)*A+l:l,y=T.has(i);return F("div",{className:n("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",we==="square"?"aspect-square":"",we==="video"?"aspect-video":"",f?"cursor-pointer":"",y?"ring-2 ring-primary":""),onClick:()=>f&&ce(i),children:[f&&q==="multiple"&&d("div",{className:"absolute top-2 right-2 z-10",children:d(Ge,{checked:y,onCheckedChange:()=>ce(i),className:"bg-background/80 backdrop-blur-sm",onClick:S=>S.stopPropagation()})}),t(s,l,y,()=>ce(i))]},i)})}):F("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[d("div",{className:"text-6xl",children:V||"\u{1F4CB}"}),d("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:U}),(E||Object.values(Z).some(s=>s))&&d(h,{variant:"outline",onClick:Re,children:"Clear Filters"})]})]})})}),u.enabled&&d("div",{className:"pb-1",children:d(Le,{currentPage:ee,totalPages:qe,pageSize:A,totalItems:g.length,onPageChange:te,onPageSizeChange:s=>{We(s),te(1)},config:u})}),B&&d("div",{className:"p-2 m-0.5",children:B}),W&&W(Me)]})}export{Po as DataTemplate};
2
+ import{useState as I,useEffect as Ve,useMemo as he,useCallback as $,useRef as wt}from"react";import{Loader2 as Le}from"lucide-react";import{clsx as Qe}from"clsx";import{twMerge as Ye}from"tailwind-merge";function n(...e){return Ye(Qe(e))}import{jsx as Re}from"react/jsx-runtime";function oe({className:e,...t}){return Re("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function ae({className:e,...t}){return Re("div",{"data-slot":"card-content",className:n("px-6",e),...t})}import{Slot as et}from"radix-ui";import{cva as tt}from"class-variance-authority";import{jsx as at}from"react/jsx-runtime";var ot=tt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function h({className:e,variant:t,size:r,asChild:x=!1,...u}){let D=x?et.Slot:"button";return at(D,{"data-slot":"button",className:n(ot({variant:t,size:r,className:e}),"transition-none"),...u})}import{Checkbox as Me}from"radix-ui";import{CheckIcon as nt}from"lucide-react";import{jsx as ue}from"react/jsx-runtime";function Fe({className:e,...t}){return ue(Me.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:ue(Me.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:ue(nt,{className:"size-3.5"})})})}import{Search as ct,Download as mt,RefreshCw as ut,Filter as pt,ChevronDown as ft,Settings2 as gt}from"lucide-react";import{jsx as rt}from"react/jsx-runtime";function pe({className:e,type:t,...r}){return rt("input",{type:t,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}import{DropdownMenu as R}from"radix-ui";import{CheckIcon as Wt,ChevronRightIcon as qt,CircleIcon as Et}from"lucide-react";import{jsx as M,jsxs as Xt}from"react/jsx-runtime";function fe({...e}){return M(R.Root,{"data-slot":"dropdown-menu",...e})}function ge({...e}){return M(R.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ve({className:e,sideOffset:t=4,...r}){return M(R.Portal,{children:M(R.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...r})})}function j({className:e,inset:t,variant:r="default",...x}){return M(R.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:n("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...x})}function be({className:e,inset:t,...r}){return M(R.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function ne({className:e,...t}){return M(R.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t})}import{Select as C}from"radix-ui";import{CheckIcon as st,ChevronDownIcon as Be,ChevronUpIcon as it}from"lucide-react";import{jsx as v,jsxs as xe}from"react/jsx-runtime";function re({...e}){return v(C.Root,{"data-slot":"select",...e})}function se({...e}){return v(C.Value,{"data-slot":"select-value",...e})}function ie({className:e,size:t="default",children:r,...x}){return xe(C.Trigger,{"data-slot":"select-trigger","data-size":t,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...x,children:[r,v(C.Icon,{asChild:!0,children:v(Be,{className:"size-4 opacity-50"})})]})}function le({className:e,children:t,position:r="popper",...x}){return v(C.Portal,{children:xe(C.Content,{"data-slot":"select-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...x,children:[v(lt,{}),v(C.Viewport,{className:n("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),v(dt,{})]})})}function K({className:e,children:t,...r}){return xe(C.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[v("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:v(C.ItemIndicator,{children:v(st,{className:"size-4"})})}),v(C.ItemText,{children:t})]})}function lt({className:e,...t}){return v(C.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:v(it,{className:"size-4"})})}function dt({className:e,...t}){return v(C.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:v(Be,{className:"size-4"})})}import{Fragment as vt,jsx as a,jsxs as p}from"react/jsx-runtime";function Ge({fields:e,filters:t,globalFilter:r,onGlobalFilterChange:x,fieldFilters:u,onFieldFilterChange:D,sortField:P,sortDirection:B,onSortChange:G,selectedCount:O,totalCount:_,visibleCount:U,onExport:V,onRefresh:b,loading:w,onClearFilters:m,onClearSorting:k}){let W=e.filter(o=>o.sortable),de=Object.values(u).some(o=>o!=null&&o!=="")||r!=="",Q=P!=="";return a("div",{className:"rounded-xl p-0.5",children:a("div",{className:"px-2",children:a("div",{className:"flex flex-col gap-6",children:p("div",{className:"flex items-center justify-between",children:[a("div",{className:"flex items-center gap-3",children:t.length>0&&p("div",{className:"flex items-center gap-3 flex-wrap",children:[a("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:a(pt,{className:"h-4 w-4"})}),t.map(o=>a("div",{className:"relative min-w-[150px]",children:o.type==="select"?p(re,{value:u[o.key]||"all",onValueChange:f=>D(o.key,f),children:[o.icon&&a(o.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a(ie,{className:n("h-9 rounded-lg w-full",o.icon&&"pl-9"),children:a(se,{placeholder:o.placeholder||"Select..."})}),p(le,{className:"rounded-lg",children:[a(K,{value:"all",children:"All"}),o.options?.map(f=>a(K,{value:f.value,children:f.label},f.value))]})]}):p("div",{className:"relative",children:[o.icon&&a(o.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a(pe,{type:o.type,placeholder:o.placeholder,value:u[o.key]||"",onChange:f=>D(o.key,f.target.value),className:n("h-9 rounded-lg",o.icon&&"pl-9")})]})},String(o.key)))]})}),p("div",{className:"flex items-center gap-2",children:[p("div",{className:"relative",children:[a(ct,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a(pe,{placeholder:"Global search...",value:r,onChange:o=>x(o.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),W.length>0&&p(fe,{children:[a(ge,{asChild:!0,children:p(h,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[a("span",{children:"Sort"}),a(ft,{className:"h-4 w-4 opacity-50"})]})}),p(ve,{align:"end",className:"w-[200px] rounded-lg",children:[a(be,{children:"Sort By"}),a(ne,{}),W.map(o=>p("div",{children:[p(j,{onClick:()=>G(o.key,"asc"),children:[o.label," (A-Z)"]}),p(j,{onClick:()=>G(o.key,"desc"),children:[o.label," (Z-A)"]})]},String(o.key))),Q&&p(vt,{children:[a(ne,{}),a(j,{onClick:k,children:"Clear All Sorting"})]})]})]}),p(fe,{children:[a(ge,{asChild:!0,children:a(h,{variant:"outline",size:"sm",className:"rounded-lg",children:a(gt,{className:"h-4 w-4"})})}),p(ve,{align:"end",className:"w-[200px] rounded-lg",children:[a(be,{children:"Table Settings"}),a(ne,{}),a(j,{onClick:k,children:"Clear All Sorting"}),a(j,{onClick:m,children:"Clear All Filters"})]})]}),V&&p(h,{variant:"outline",size:"sm",onClick:V,className:"rounded-lg",children:[a(mt,{className:"mr-2 h-4 w-4"}),"Export"]}),b&&a(h,{variant:"outline",size:"sm",onClick:b,disabled:w,className:"rounded-lg",children:a(ut,{className:n("h-4 w-4",w&&"animate-spin")})})]})]})})})})}import{ChevronLeft as bt,ChevronRight as xt,ChevronsLeft as ht,ChevronsRight as Ct}from"lucide-react";import{jsx as c,jsxs as N}from"react/jsx-runtime";function _e({currentPage:e,totalPages:t,pageSize:r,totalItems:x,onPageChange:u,onPageSizeChange:D,config:P}){if(!P.enabled)return null;let B=P.pageSizeOptions||[10,20,50,100],G=(e-1)*r+1,O=Math.min(e*r,x),_=e>1,U=e<t,V=()=>{let w=[],m=[];for(let k=Math.max(2,e-2);k<=Math.min(t-1,e+2);k++)w.push(k);return e-2>2?m.push(1,"..."):m.push(1),m.push(...w),e+2<t-1?m.push("...",t):t>1&&m.push(t),m};return c("div",{className:"rounded-xl",children:N("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[c("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:P.showInfo!==!1&&N("span",{children:["Showing ",G," to ",O," of ",x," entries"]})}),N("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[B&&N("div",{className:"flex items-center gap-2",children:[c("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),N(re,{value:`${r}`,onValueChange:b=>D(Number(b)),children:[c(ie,{className:"h-9 w-[70px] rounded-lg",children:c(se,{})}),c(le,{side:"top",className:"rounded-lg",children:B.map(b=>c(K,{value:`${b}`,children:b},b))})]})]}),N("div",{className:"flex items-center gap-2",children:[N(h,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:!_,className:"hidden sm:flex rounded-lg",children:[c(ht,{className:"h-4 w-4"}),c("span",{className:"sr-only",children:"Go to first page"})]}),N(h,{variant:"outline",size:"sm",onClick:()=>u(e-1),disabled:!_,className:"rounded-lg",children:[c(bt,{className:"h-4 w-4 sm:mr-2"}),c("span",{className:"hidden sm:inline",children:"Previous"}),c("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),P.showPageNumbers&&t>1&&c("div",{className:"hidden sm:flex items-center gap-1",children:V().map((b,w)=>{if(b==="...")return c("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${w}`);let m=b;return c(h,{variant:m===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>u(m),children:m},m)})}),N("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),N(h,{variant:"outline",size:"sm",onClick:()=>u(e+1),disabled:!U,className:"rounded-lg",children:[c("span",{className:"hidden sm:inline",children:"Next"}),c(xt,{className:"h-4 w-4 sm:ml-2"}),c("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),N(h,{variant:"outline",size:"sm",onClick:()=>u(t),disabled:!U,className:"hidden sm:flex rounded-lg",children:[c(Ct,{className:"h-4 w-4"}),c("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as d,jsxs as F}from"react/jsx-runtime";function Po({data:e,template:t,fields:r=[],filters:x=[],pagination:u={enabled:!1},settings:D={},header:P,footer:B,className:G="",loading:O=!1,error:_,emptyMessage:U="No items found",emptyIcon:V,onSelectionChange:b,onExport:w,onRefresh:m,onTemplateReady:k,children:W}){let{enableSorting:de=!0,enableFiltering:Q=!0,enableGlobalSearch:o=!0,enableSelection:f=!1,enableExport:Ae=!1,toolbar:je=!0,selectionMode:q="multiple",gridCols:$e={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Ce=4,aspectRatio:we="auto",minCardWidth:Oe=350,maxCardWidth:Ue=350}=D,[E,ye]=I(""),[Z,Se]=I({}),[L,Ne]=I(""),[H,Pe]=I("asc"),[T,Y]=I(new Set),[ee,te]=I(1),[A,We]=I(u.pageSize||12),[ke,yt]=I($e.default),g=he(()=>{let s=[...e];if(o&&E){let l=r.filter(i=>i.searchable!==!1);s=s.filter(i=>l.some(y=>i[y.key]?.toString().toLowerCase().includes(E.toLowerCase())))}if(Q&&Object.keys(Z).forEach(l=>{let i=Z[l];if(i!=null&&i!==""){let y=r.find(S=>S.key===l);y&&(s=s.filter(S=>{let z=S[l];return y.type==="boolean"?z===(i==="true"):y.type==="number"?z===Number(i):z?.toString().toLowerCase().includes(String(i).toLowerCase())}))}}),de&&L){let l=r.find(i=>i.key===L);l&&s.sort((i,y)=>{let S=i[L],z=y[L];if(l.type==="number")return H==="asc"?Number(S)-Number(z):Number(z)-Number(S);if(l.type==="date"){let X=new Date(S),J=new Date(z);return H==="asc"?X.getTime()-J.getTime():J.getTime()-X.getTime()}else{let X=String(S).toLowerCase(),J=String(z).toLowerCase();return H==="asc"?X.localeCompare(J):J.localeCompare(X)}})}return s},[e,E,Z,L,H,r,o,Q,de]),De=he(()=>{if(!u.enabled)return g;let s=(ee-1)*A,l=s+A;return g.slice(s,l)},[g,ee,A,u.enabled]),qe=Math.ceil(g.length/A),ce=$(s=>{f&&Y(l=>{let i=new Set(l);return q==="single"?(i.clear(),i.add(s)):i.has(s)?i.delete(s):i.add(s),i})},[f,q]),Te=$(()=>{!f||q==="single"||(T.size===g.length?Y(new Set):Y(new Set(g.map((s,l)=>l))))},[f,q,T.size,g.length]),Ee=$((s,l)=>{Se(i=>({...i,[s]:l})),te(1)},[]),Ze=$((s,l)=>{Ne(s),Pe(l)},[]),ze=$(()=>{ye(""),Se({}),te(1)},[]),He=$(()=>{Ne(""),Pe("asc")},[]),Ie=he(()=>({getSelectedItems:()=>Array.from(T).map(s=>g[s]),clearSelection:()=>Y(new Set),selectAll:Te,getFilteredData:()=>g,getTotalCount:()=>e.length,getVisibleCount:()=>g.length,refresh:()=>m?.(),exportData:()=>w?.(g)}),[T,g,e.length,Te,m,w]),me=wt(null);me.current=Ie,Ve(()=>{k&&me.current&&k(me.current)},[]),Ve(()=>{if(f&&b){let s=Array.from(T).map(l=>g[l]);b(s)}},[T]);let Xe=n("w-full","overflow-hidden",G),Je=n("grid",`gap-${Ce}`,"w-full","mx-auto","items-start"),Ke={gridTemplateColumns:ke===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${Oe}px, calc(100%/${ke} - ${Ce*4}px), ${Ue}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return _?d(oe,{className:"w-full",children:d(ae,{className:"flex items-center justify-center py-12",children:F("div",{className:"text-center",children:[d("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),d("p",{className:"text-sm text-muted-foreground mb-4",children:_}),m&&F(h,{variant:"outline",size:"sm",onClick:m,children:[d(Le,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):F("div",{className:n("w-full flex gap-2 flex-col h-full",Xe),children:[P&&d(oe,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:d(ae,{className:"p-2",children:P})}),je&&d(Ge,{fields:r,filters:x,globalFilter:E,onGlobalFilterChange:ye,fieldFilters:Z,onFieldFilterChange:Ee,sortField:L,sortDirection:H,onSortChange:Ze,selectedCount:T.size,totalCount:e.length,visibleCount:g.length,onExport:Ae?()=>w?.(g):void 0,onRefresh:m,loading:O,onClearFilters:ze,onClearSorting:He}),d(oe,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:d(ae,{className:"px-0",children:F("div",{className:"relative",children:[O&&d("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:F("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[d(Le,{className:"size-5 animate-spin text-primary"}),d("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),De.length>0?d("div",{className:n(Je),style:Ke,children:De.map((s,l)=>{let i=u.enabled?(ee-1)*A+l:l,y=T.has(i);return F("div",{className:n("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",we==="square"?"aspect-square":"",we==="video"?"aspect-video":"",f?"cursor-pointer":"",y?"ring-2 ring-primary":""),onClick:()=>f&&ce(i),children:[f&&q==="multiple"&&d("div",{className:"absolute top-2 right-2 z-10",children:d(Fe,{checked:y,onCheckedChange:()=>ce(i),className:"bg-background/80 backdrop-blur-sm",onClick:S=>S.stopPropagation()})}),t(s,l,y,()=>ce(i))]},i)})}):F("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[d("div",{className:"text-6xl",children:V||"\u{1F4CB}"}),d("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:U}),(E||Object.values(Z).some(s=>s))&&d(h,{variant:"outline",onClick:ze,children:"Clear Filters"})]})]})})}),u.enabled&&d("div",{className:"pb-1",children:d(_e,{currentPage:ee,totalPages:qe,pageSize:A,totalItems:g.length,onPageChange:te,onPageSizeChange:s=>{We(s),te(1)},config:u})}),B&&d("div",{className:"p-2 m-0.5",children:B}),W&&W(Ie)]})}export{Po as DataTemplate};
3
3
  //# sourceMappingURL=data-template.js.map