@akshar-technosoft/ui 1.0.14 → 1.0.16
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/components/data/data-table/data-table-types.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-types.d.cts +1 -2
- package/dist/components/data/data-table/data-table-types.d.ts +1 -2
- package/dist/components/data/data-table/data-table.cjs +1 -1
- package/dist/components/data/data-table/data-table.cjs.map +1 -1
- package/dist/components/data/data-table/data-table.d.cts +1 -1
- package/dist/components/data/data-table/data-table.d.ts +1 -1
- package/dist/components/data/data-table/data-table.js +1 -1
- package/dist/components/data/data-table/data-table.js.map +1 -1
- package/dist/components/data/data-table/index.cjs +1 -1
- package/dist/components/data/data-table/index.cjs.map +1 -1
- package/dist/components/data/data-table/index.js +1 -1
- package/dist/components/data/data-table/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/svg.d.cjs +0 -3
- package/dist/svg.d.cjs.map +0 -1
- package/dist/svg.d.d.cts +0 -3
- package/dist/svg.d.d.ts +0 -3
- package/dist/svg.d.js +0 -2
- package/dist/svg.d.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import{flexRender as At,getCoreRowModel as wn,getFilteredRowModel as Nn,getPaginationRowModel as Pn,getSortedRowModel as Dn,useReactTable as Sn}from"@tanstack/react-table";import{Loader2 as go,ChevronUp as Bt,ChevronDown as Lt,ChevronsUpDown as Tn,MoreHorizontal as kn,MoveRightIcon as Rn,PinOffIcon as Mn,Calculator as fo}from"lucide-react";import{Slot as qo}from"radix-ui";import{cva as $o}from"class-variance-authority";import{clsx as jo}from"clsx";import{twMerge as Uo}from"tailwind-merge";function o(...e){return Uo(jo(e))}import{jsx as Wo}from"react/jsx-runtime";var et=$o("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 C({className:e,variant:t,size:r,asChild:m=!1,...b}){let u=m?qo.Slot:"button";return Wo(u,{"data-slot":"button",className:o(et({variant:t,size:r,className:e}),"transition-none"),...b})}import{jsx as ce}from"react/jsx-runtime";function yt({className:e,...t}){return ce("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:ce("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function Xt({className:e,...t}){return ce("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function Kt({className:e,...t}){return ce("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function wt({className:e,...t}){return ce("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function re({className:e,...t}){return ce("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Jt({className:e,...t}){return ce("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function me({className:e,...t}){return ce("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as Qt}from"react/jsx-runtime";function Nt({className:e,...t}){return Qt("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Pt({className:e,...t}){return Qt("div",{"data-slot":"card-content",className:o("px-6",e),...t})}import{Tooltip as De}from"radix-ui";import{jsx as Se,jsxs as Xo}from"react/jsx-runtime";function Le({delayDuration:e=0,...t}){return Se(De.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Dt({...e}){return Se(Le,{children:Se(De.Root,{"data-slot":"tooltip",...e})})}function St({...e}){return Se(De.Trigger,{"data-slot":"tooltip-trigger",...e})}function Tt({className:e,sideOffset:t=0,children:r,...m}){return Se(De.Portal,{children:Xo(De.Content,{"data-slot":"tooltip-content",sideOffset:t,className:o("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...m,children:[r,Se(De.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as so,RefreshCw as mn,Download as un,Settings2 as pn,Filter as lo,ArrowUpDown as gn,PinOff as fn,Pin as bn,ChevronDown as co,Calculator as Ft}from"lucide-react";import{jsx as Ko}from"react/jsx-runtime";function kt({className:e,type:t,...r}){return Ko("input",{type:t,"data-slot":"input",className:o("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{Select as X}from"radix-ui";import{CheckIcon as Jo,ChevronDownIcon as Yt,ChevronUpIcon as Qo}from"lucide-react";import{jsx as I,jsxs as Rt}from"react/jsx-runtime";function tt({...e}){return I(X.Root,{"data-slot":"select",...e})}function ot({...e}){return I(X.Value,{"data-slot":"select-value",...e})}function nt({className:e,size:t="default",children:r,...m}){return Rt(X.Trigger,{"data-slot":"select-trigger","data-size":t,className:o("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),...m,children:[r,I(X.Icon,{asChild:!0,children:I(Yt,{className:"size-4 opacity-50"})})]})}function at({className:e,children:t,position:r="popper",...m}){return I(X.Portal,{children:Rt(X.Content,{"data-slot":"select-content",className:o("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,...m,children:[I(Yo,{}),I(X.Viewport,{className:o("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),I(Zo,{})]})})}function Oe({className:e,children:t,...r}){return Rt(X.Item,{"data-slot":"select-item",className:o("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:[I("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:I(X.ItemIndicator,{children:I(Jo,{className:"size-4"})})}),I(X.ItemText,{children:t})]})}function Yo({className:e,...t}){return I(X.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:I(Qo,{className:"size-4"})})}function Zo({className:e,...t}){return I(X.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:I(Yt,{className:"size-4"})})}import{DropdownMenu as j}from"radix-ui";import{CheckIcon as en,ChevronRightIcon as tn,CircleIcon as Ra}from"lucide-react";import{jsx as O,jsxs as oo}from"react/jsx-runtime";function oe({...e}){return O(j.Root,{"data-slot":"dropdown-menu",...e})}function ne({...e}){return O(j.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ae({className:e,sideOffset:t=4,...r}){return O(j.Portal,{children:O(j.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:o("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 Mt({...e}){return O(j.Group,{"data-slot":"dropdown-menu-group",...e})}function F({className:e,inset:t,variant:r="default",...m}){return O(j.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:o("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),...m})}function Te({className:e,children:t,checked:r,...m}){return oo(j.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:o("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",e),checked:r,...m,children:[O("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:O(j.ItemIndicator,{children:O(en,{className:"size-4"})})}),t]})}function U({className:e,inset:t,...r}){return O(j.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:o("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function K({className:e,...t}){return O(j.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}function Zt({...e}){return O(j.Sub,{"data-slot":"dropdown-menu-sub",...e})}function eo({className:e,inset:t,children:r,...m}){return oo(j.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:o("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...m,children:[r,O(tn,{className:"ml-auto size-4"})]})}function to({className:e,...t}){return O(j.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as mo}from"react";import{useEffect as ln,useState as zt}from"react";import{Calendar as dn}from"lucide-react";import{format as Ge}from"date-fns";import{Popover as rt}from"radix-ui";import{jsx as it}from"react/jsx-runtime";function st({...e}){return it(rt.Root,{"data-slot":"popover",...e})}function lt({...e}){return it(rt.Trigger,{"data-slot":"popover-trigger",...e})}function dt({className:e,align:t="center",sideOffset:r=4,...m}){return it(rt.Portal,{children:it(rt.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:o("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 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...m})})}import*as ct from"react";import{ChevronDownIcon as on,ChevronLeftIcon as nn,ChevronRightIcon as an}from"lucide-react";import{DayPicker as rn,getDefaultClassNames as no}from"react-day-picker";import{jsx as ue}from"react/jsx-runtime";function ao({className:e,classNames:t,showOutsideDays:r=!0,captionLayout:m="label",buttonVariant:b="ghost",formatters:u,components:T,...z}){let x=no();return ue(rn,{showOutsideDays:r,className:o("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:m,formatters:{formatMonthDropdown:P=>P.toLocaleString("default",{month:"short"}),...u},classNames:{root:o("w-fit",x.root),months:o("flex gap-4 flex-col md:flex-row relative",x.months),month:o("flex flex-col w-full gap-4",x.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",x.nav),button_previous:o(et({variant:b}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",x.button_previous),button_next:o(et({variant:b}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",x.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",x.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",x.dropdowns),dropdown_root:o("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",x.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",x.dropdown),caption_label:o("select-none font-medium",m==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",x.caption_label),table:"w-full border-collapse",weekdays:o("flex",x.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",x.weekday),week:o("flex w-full mt-2",x.week),week_number_header:o("select-none w-(--cell-size)",x.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",x.week_number),day:o("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",x.day),range_start:o("rounded-l-md bg-accent",x.range_start),range_middle:o("rounded-none",x.range_middle),range_end:o("rounded-r-md bg-accent",x.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",x.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",x.outside),disabled:o("text-muted-foreground opacity-50",x.disabled),hidden:o("invisible",x.hidden),...t},components:{Root:({className:P,rootRef:k,...L})=>ue("div",{"data-slot":"calendar",ref:k,className:o(P),...L}),Chevron:({className:P,orientation:k,...L})=>k==="left"?ue(nn,{className:o("size-4",P),...L}):k==="right"?ue(an,{className:o("size-4",P),...L}):ue(on,{className:o("size-4",P),...L}),DayButton:sn,WeekNumber:({children:P,...k})=>ue("td",{...k,children:ue("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:P})}),...T},...z})}function sn({className:e,day:t,modifiers:r,...m}){let b=no(),u=ct.useRef(null);return ct.useEffect(()=>{r.focused&&u.current?.focus()},[r.focused]),ue(C,{ref:u,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:o("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",b.day,e),...m})}import{jsx as he,jsxs as He}from"react/jsx-runtime";function ro({value:e,onChange:t,placeholder:r,mode:m,externalSearch:b,onExternalChange:u,onlyExternal:T=!1}){let[z,x]=zt(!1),[P,k]=zt(e),[L,J]=zt(e);ln(()=>{T||J(e)},[e,T]);let ie=()=>{T||t(P),J(P),b&&u&&u(P),x(!1)},Z=()=>{k(L),x(!1)},q=()=>{let y=m==="single"?null:{from:null,to:null};k(y),T||t(y),J(y),b&&u&&u(y),x(!1)},H=()=>{let y=T?L:e;return y?m==="single"?Ge(y,"PPP"):y.from&&y.to?`${Ge(y.from,"MMM dd")} - ${Ge(y.to,"MMM dd, yyyy")}`:y.from?`From ${Ge(y.from,"MMM dd, yyyy")}`:y.to?`To ${Ge(y.to,"MMM dd, yyyy")}`:r:r},Q=y=>{k(m==="single"?y:y||{from:null,to:null})};return He(st,{open:z,onOpenChange:x,children:[he(lt,{asChild:!0,children:He(C,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!H()&&"text-muted-foreground"),children:[he(dn,{className:"mr-2 h-4 w-4"}),H()]})}),He(dt,{className:"w-auto p-0",align:"start",children:[he("div",{className:"p-3",children:he(ao,{mode:m,selected:P,onSelect:Q,numberOfMonths:m==="range"?2:1,className:"rounded-md border",...m==="range"&&{required:!0}})}),He("div",{className:"flex items-center justify-between p-3 border-t",children:[he(C,{variant:"ghost",size:"sm",onClick:q,children:"Clear"}),He("div",{className:"flex gap-2",children:[he(C,{variant:"outline",size:"sm",onClick:Z,children:"Cancel"}),he(C,{size:"sm",onClick:ie,disabled:m==="range"&&(!P?.from||!P?.to),children:"Apply"})]})]})]})]})}import{Checkbox as io}from"radix-ui";import{CheckIcon as cn}from"lucide-react";import{jsx as It}from"react/jsx-runtime";function Ee({className:e,...t}){return It(io.Root,{"data-slot":"checkbox",className:o("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:It(io.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:It(cn,{className:"size-3.5"})})})}import{Fragment as vn,jsx as l,jsxs as h}from"react/jsx-runtime";var uo=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function _t({table:e,filters:t=[],globalFilter:r,onGlobalFilterChange:m,enableGlobalFilter:b=!0,onExport:u,onRefresh:T,loading:z=!1,enableColumnVisibility:x=!0,data:P,onClearSorting:k,onClearFilters:L,enableColumnPinning:J=!1,onExternalSearch:ie,onCustomFilterChange:Z,aggregations:q={},onAggregationChange:H}){let[Q,y]=mo({}),[ze,$]=mo({}),Ie=()=>e.getAllLeafColumns().filter(n=>n.getCanHide?.()!==!1),ye=()=>e.getAllColumns().filter(n=>!e.getAllLeafColumns().includes(n)&&n.columns?.length&&n.columns.some(c=>c.getCanHide?.()!==!1)),$e=()=>{let n=new Set(ye().flatMap(c=>c.columns?.filter(p=>p.getCanHide?.()!==!1).map(p=>p.id)||[]));return Ie().filter(c=>!n.has(c.id))},we=(n,c)=>c&&n.startsWith(`${c}.`)?n.replace(`${c}.`,"").split("_").map(D=>D.slice(1)).join(" "):n.split("_").map(p=>p.charAt(0).toUpperCase()+p.slice(1)).join(" "),Fe=(n,c)=>{let p={...Q,[n]:c};y(p)},We=(n,c)=>{let p={...ze,[n]:c};$(p),Z&&Z(n,c),t.find(D=>D.key===n)?.externalSearch&&Fe(n,c)},gt=()=>{ie&&ie(Q)},ft=()=>{y({}),$({}),L(),ie&&ie({}),Z&&Object.keys(ze).forEach(n=>{Z(n,"")})},Ne=n=>t.find(p=>p.key===n)?.customFilter?ze[n]??"":e.getColumn(n)?.getFilterValue(),_e=(n,c)=>{let p=t.find(D=>D.key===n);p?.customFilter?We(n,c):(e.getColumn(n)?.setFilterValue(c),p?.externalSearch&&Fe(n,c))},Xe=n=>{if(H){let c=q[n],p={enabled:!c?.enabled,functions:c?.functions||["sum","average"]};H(n,p)}},Ve=(n,c)=>{if(H){let D=q[n]?.functions||[],_=D.includes(c)?D.filter(Be=>Be!==c):[...D,c];H(n,{enabled:_.length>0,functions:_})}},Ke=()=>{H&&Object.keys(q).forEach(n=>{let c=q[n];c&&H(n,{...c,enabled:!1,functions:[]})})},ve=Ie().filter(n=>n.id==="select"||n.id==="serialNumber"?!1:n.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(D=>{let _=D.getValue(n.id);return typeof _=="number"||typeof _=="string"&&!isNaN(parseFloat(String(_)))||typeof _=="object"&&_!==null&&"props"in _})),Ae=Object.values(q).some(n=>n?.enabled);return l("div",{className:"rounded-xl",children:l("div",{className:"px-2",children:l("div",{className:"flex flex-col gap-6",children:h("div",{className:"flex items-center justify-between",children:[l("div",{className:"flex items-center gap-3",children:t.length>0&&h("div",{className:"flex flex-wrap items-center gap-3",children:[l("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:l(lo,{className:"size-4"})}),t.map(n=>!e.getColumn(n.key)&&!n.customFilter&&!n.externalSearch?null:l("div",{className:o("relative min-w-[150px]",n.width),children:n.type==="select"?h(tt,{value:Ne(n.key)??"",onValueChange:p=>{_e(n.key,p==="all"?"":p)},children:[n.icon&&l("span",{children:l(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),l(nt,{className:o("h-9 rounded-lg w-full",n.icon&&"pl-9"),children:l(ot,{placeholder:n.placeholder})}),h(at,{className:"rounded-lg",children:[l(Oe,{value:"all",children:"All"}),n.options?.map(p=>l(Oe,{value:p.value,children:p.label},p.label))]})]}):n.type==="date"?l(ro,{value:Ne(n.key),onChange:p=>{n.onlyExternal||_e(n.key,p)},placeholder:n.placeholder,mode:n.dateMode||"single",externalSearch:n.externalSearch,onlyExternal:n.onlyExternal,onExternalChange:p=>Fe(n.key,p)}):h("div",{className:"relative",children:[n.icon&&l("span",{children:l(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),l(kt,{placeholder:n.placeholder,value:Ne(n.key)??"",onChange:p=>{_e(n.key,p.target.value)},className:o("h-7 rounded-lg",n.icon&&"pl-9"),type:n.type==="number"?"number":"text"})]})},n.key)),(t.some(n=>n.externalSearch)||t.some(n=>n.customFilter))&&h(C,{variant:"default",size:"sm",onClick:gt,className:"rounded-lg h-7",children:[l(so,{className:"size-4"}),t.find(n=>n.externalSearch||n.customFilter)?.searchButtonText||"Search"]})]})}),h("div",{className:"flex items-center gap-2",children:[b&&h("div",{className:"relative",children:[l(so,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(kt,{placeholder:"Global search...",value:r??"",onChange:n=>m(n.target.value),className:"pl-9 h-7 max-w-max"})]}),ve.length>0&&H&&h(oe,{children:[l(ne,{asChild:!0,children:h(C,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",Ae&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[l(Ft,{className:"size-4"}),l("span",{children:"Aggregations"}),l(co,{className:"opacity-50 size-4"})]})}),h(ae,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[h(U,{className:"flex items-center justify-between px-4 py-2",children:[l("span",{className:"text-sm font-medium",children:"Column Aggregations"}),Ae&&l(C,{variant:"ghost",size:"sm",onClick:Ke,className:"h-6 px-2 text-xs",children:"Clear All"})]}),l(K,{}),ve.map(n=>{let c=q[n.id],p=c?.enabled;return h(Zt,{children:[l(eo,{className:"text-sm",children:h("div",{className:"flex items-center w-full gap-2",children:[l(Ee,{checked:p,onCheckedChange:()=>Xe(n.id),className:"data-[state=checked]:bg-primary"}),l("span",{className:o("flex-1",p&&"font-medium text-primary"),children:we(n.id)}),p&&h("div",{className:"flex items-center gap-1",children:[c?.functions?.slice(0,2).map(D=>l("div",{className:"w-2 h-2 rounded-full bg-primary",title:uo.find(_=>_.value===D)?.label},D)),c?.functions&&c.functions.length>2&&h("div",{className:"text-xs text-muted-foreground",children:["+",c.functions.length-2]})]})]})}),h(to,{className:"w-48 rounded-lg",children:[l(U,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),uo.map(D=>l(Te,{checked:c?.functions?.includes(D.value)||!1,onCheckedChange:()=>Ve(n.id,D.value),className:"py-2 text-sm",children:h("div",{className:"flex flex-col",children:[l("span",{children:D.label}),l("span",{className:"text-xs text-muted-foreground",children:D.description})]})},D.value))]})]},n.id)}),ve.length===0&&h("div",{className:"px-3 py-4 text-center",children:[l(Ft,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),l("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),u&&h(C,{variant:"outline",size:"sm",onClick:()=>u(P),className:"rounded-lg",children:[l(un,{className:"size-4"}),"Export"]}),x&&h(oe,{children:[l(ne,{asChild:!0,className:"h-7",children:h(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[l("span",{children:"Columns"}),l(co,{className:"opacity-50 size-4"})]})}),h(ae,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[l(U,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),l(K,{}),$e().length>0&&h(Mt,{children:[l(U,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),$e().map(n=>l(Te,{className:"text-sm",checked:n.getIsVisible(),onCheckedChange:c=>n.toggleVisibility(!!c),children:we(n.id)},n.id))]}),ye().map(n=>h(Mt,{children:[l(K,{}),l(U,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:n.id}),n.columns?.filter(c=>c.getCanHide?.()!==!1).map(c=>l(Te,{className:"text-sm",checked:c.getIsVisible(),onCheckedChange:p=>c.toggleVisibility(!!p),children:we(c.id,n.id)},c.id))]},n.id))]})]}),h(oe,{children:[l(ne,{asChild:!0,className:"h-7",children:l(C,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:l(pn,{className:"size-4"})})}),h(ae,{align:"end",className:"w-[200px] rounded-lg",children:[l(U,{children:"Table Settings"}),l(K,{}),h(F,{onClick:k,children:[l(gn,{className:"size-4"}),"Clear All Sorting"]}),h(F,{onClick:ft,children:[l(lo,{className:"size-4"}),"Clear All Filters"]}),Ae&&h(F,{onClick:Ke,children:[l(Ft,{className:"size-4"}),"Clear Aggregations"]}),J&&h(vn,{children:[l(K,{}),l(U,{children:"Column Pinning"}),h(F,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[l(fn,{className:"size-4"}),"Reset All Pinning"]}),h(F,{onClick:()=>{let n=Ie().filter(c=>c.getCanPin?.()!==!1).map(c=>c.id);e.setColumnPinning({left:[],right:n})},children:[l(bn,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),T&&l(C,{variant:"outline",size:"sm",onClick:T,disabled:z,className:"rounded-lg",children:l(mn,{className:o("h-4 w-4",z&&"animate-spin")})})]})]})})})})}import{jsx as G,jsxs as ke}from"react/jsx-runtime";function Vt({table:e,config:t}){return t.enabled?G("div",{className:"rounded-xl",children:G("div",{children:ke("div",{className:"flex items-center justify-between",children:[G("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&ke("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),ke("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&ke("div",{className:"flex items-center gap-2",children:[G("span",{className:"text-sm font-medium",children:"Rows per page:"}),ke(tt,{value:`${e.getState().pagination.pageSize}`,onValueChange:r=>e.setPageSize(Number(r)),children:[G(nt,{className:"h-9 w-[70px] rounded-lg",children:G(ot,{})}),G(at,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(r=>G(Oe,{value:`${r}`,children:r},r))})]})]}),ke("div",{className:"flex items-center gap-2",children:[G(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),G(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&G("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(r,m)=>{let b=e.getState().pagination.pageIndex,u=b+m;return u<1||u>e.getPageCount()?null:G(C,{variant:u===b+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(u-1),children:u},u)})}),G(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),G(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as xn}from"radix-ui";import{cva as hn}from"class-variance-authority";import{jsx as yn}from"react/jsx-runtime";var Cn=hn("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function po({className:e,variant:t,size:r,noBg:m,...b}){return yn(xn.Root,{"data-slot":"toggle",className:o(Cn({className:e,variant:t,size:r,bg:m?"disabled":"enabled"})),...b})}import{useCallback as mt,useEffect as bo,useMemo as je,useState as pe}from"react";import{Fragment as xo,jsx as i,jsxs as S}from"react/jsx-runtime";var vo={sum:e=>e.reduce((t,r)=>t+r,0),average:e=>e.length>0?e.reduce((t,r)=>t+r,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((m,b)=>m-b),r=Math.floor(t.length/2);return t.length%2===0?(t[r-1]+t[r])/2:t[r]}};function zn({data:e,columns:t,filters:r=[],pagination:m={enabled:!1},settings:b={},header:u,footer:T,className:z="",maxHeight:x="600px",loading:P=!1,error:k,emptyMessage:L="No data available",onRowSelectionChange:J,onExport:ie,onRefresh:Z,onTableReady:q,children:H,isRowDisabled:Q,isRowSelectable:y,onExternalSearch:ze,aggregations:$={},onAggregationChange:Ie,columnFooters:ye=[]}){let[$e,we]=pe([]),[Fe,We]=pe([]),[gt,ft]=pe({}),[Ne,_e]=pe({}),[Xe,Ve]=pe(""),[Ke,Et]=pe([]),[ve,Ae]=pe(b.enableColumnPinning?{left:[],right:[]}:{}),[n,c]=pe({}),p=(s,g)=>g.split(".").reduce((a,f)=>a&&a[f],s),D=je(()=>Object.keys(n).length===0?e:e.filter(s=>Object.entries(n).every(([g,a])=>{if(!a||a==="")return!0;let f=p(s,g);return typeof a=="string"?String(f).toLowerCase().includes(a.toLowerCase()):f===a})),[e,n]),{enableSorting:_=!0,enableFiltering:Be=!0,enableGlobalFilter:jt=!0,enableColumnVisibility:bt=!0,enableRowSelection:E=!0,stickyHeader:So=!0,toolbar:Je=!1,toolbarPosition:Qe="default",showSerialNumbers:se=!0,fixedCheckboxColumn:Ye=!0,striped:To=!0,hoverable:ko=!0,compact:Ze=!0,bordered:Ut=!0,fullHeight:Ro=!1,enableColumnResizing:qt=!1,enableColumnPinning:V=!0,hideHeader:Mo=!1,selectionMode:le="multiple",showCheckBox:zo=!0,checkboxColumnPosition:$t=0}=b,Io=mt((s,g)=>{c(a=>{let f={...a};return g===""||g===null||g===void 0?delete f[s]:f[s]=g,f})},[]),Pe=je(()=>{let s=[...t],g=d=>d.map(v=>{if(v.id==="select"||v.id==="serialNumber")return v;let w={...v,enablePinning:!0};return v.columns&&(w.columns=g(v.columns)),w}),a=g(s),f={id:"select",header:({table:d})=>{if(le==="single")return null;let v=d.getRowModel().rows.filter(A=>!Q?.(A.original)&&(y?y(A.original):!0)),w=v.length>0&&v.every(A=>A.getIsSelected()),R=v.some(A=>A.getIsSelected());return i(Ee,{checked:w||R&&"indeterminate",onCheckedChange:A=>{v.forEach(xe=>xe.toggleSelected(!!A))},"aria-label":"Select all selectable rows"})},cell:({row:d})=>{let v=Q?Q(d.original):!1,w=y?y(d.original):!0;return i("div",{className:o("flex items-center justify-center",v&&"opacity-50"),children:le==="multiple"?i(Ee,{checked:d.getIsSelected(),onCheckedChange:R=>w&&d.toggleSelected(!!R),"aria-label":"Select row",disabled:v||!w}):zo?i("input",{type:"radio",checked:d.getIsSelected(),onChange:()=>w&&d.toggleSelected(!0),disabled:v||!w,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:le==="multiple"?40:30};if(E){let d=$t;d<0&&(d=a.length+d+1),d=Math.max(0,Math.min(d,a.length)),a.splice(d,0,f)}if(se){let d={id:"serialNumber",header:"No.",cell:({row:v})=>i("div",{className:"font-medium text-center text-muted-foreground",children:v.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};a.unshift(d)}return a},[t,se,E,Ye,Q,y,le,$t]),Fo=je(()=>{let s=new Map;return ye.forEach(g=>{s.set(g.id,g)}),s},[ye]),N=Sn({data:D,columns:Pe,onSortingChange:_?we:void 0,onColumnFiltersChange:Be?We:void 0,onGlobalFilterChange:jt?Ve:void 0,getCoreRowModel:wn(),getPaginationRowModel:m.enabled?Pn():void 0,getSortedRowModel:_?Dn():void 0,getFilteredRowModel:Be?Nn():void 0,onColumnVisibilityChange:bt?ft:void 0,onRowSelectionChange:E?_e:void 0,onColumnOrderChange:Et,onColumnPinningChange:V?Ae:void 0,state:{sorting:_?$e:void 0,columnFilters:Be?Fe:void 0,columnVisibility:bt?gt:void 0,rowSelection:E?Ne:{},globalFilter:Xe,columnOrder:Ke,columnPinning:V?ve:{}},initialState:{pagination:m.enabled?{pageSize:m.pageSize||10}:void 0,columnPinning:V?{left:[...se?["serialNumber"]:[],...E?["select"]:[]],right:[]}:void 0},enableRowSelection:E,enableColumnResizing:qt,enableColumnPinning:V,columnResizeMode:"onChange"}),_o=je(()=>{if(!$||Object.keys($).length===0)return{};let s={},g=N.getFilteredRowModel().rows;return Object.entries($).forEach(([a,f])=>{if(!f?.enabled)return;let d=g.map(w=>{if(f.accessor)return f.accessor(w.original);{let R=w.getValue(a);return typeof R=="number"?R:parseFloat(String(R))||0}}).filter(w=>w!==null&&!isNaN(w)),v={};f.functions?.forEach(w=>{vo[w]&&(v[w]=vo[w](d))}),Object.keys(v).length>0&&(s[a]=v)}),s},[D,$,N?.getFilteredRowModel().rows]);bo(()=>{if(E&&J){let s=N.getFilteredSelectedRowModel().rows.filter(g=>!Q?.(g.original)&&(y?y(g.original):!0)).map(g=>g.original);J(s)}},[Ne,E,J,N,Q,y]);let Vo=mt(s=>{le==="single"?(N.resetRowSelection(),s.toggleSelected(!0)):s.toggleSelected()},[le,N]);bo(()=>{q&&q(N)},[N,q]);let Ao=mt(()=>{we([])},[]),Bo=mt(()=>{We([]),Ve("")},[]),Wt=(s,g)=>{if(!V)return;let a=[...se?["serialNumber"]:[],...E&&Ye?["select"]:[]],f={left:[...(ve.left??[]).filter(d=>a.includes(d))],right:[...ve.right??[]]};g===!1?(f.left=f.left.filter(d=>d!==s),f.right=f.right.filter(d=>d!==s)):g==="right"?(f.left=f.left.filter(d=>d!==s),f.right.includes(s)||f.right.push(s)):g==="left"&&(f.right=f.right.filter(d=>d!==s),!f.left.includes(s)&&!a.includes(s)&&f.left.push(s)),N.setColumnPinning(f)},Lo=()=>(!$||Object.keys($).length===0)&&ye.length===0?null:i(wt,{className:"sticky bottom-0 border-t bg-sidebar z-15",children:i(re,{className:"hover:bg-transparent bg-sidebar",children:N.getHeaderGroups()[0]?.headers.map((s,g)=>{let a=s.column.id,f=_o[a],d=Fo.get(a),v=V&&(s.column.getIsPinned()==="left"||s.column.id==="serialNumber"||s.column.id==="select"&&E),w=V&&s.column.getIsPinned()==="right",R=s.column.id==="serialNumber",A=s.column.id==="select",W=s.column.columnDef.footer;return i(me,{className:o("font-semibold text-sm py-2 px-2 border-r",Ze&&"py-1",v&&"sticky left-0 z-10 bg-sidebar/95",w&&"sticky right-0 z-10 bg-sidebar/95",(R||A)&&"sticky left-0 z-10 bg-sidebar/95",d?.className,W?.className),style:{width:s.getSize()!==150?s.getSize():"auto",minWidth:s.getSize()!==150?s.getSize():"auto",...v&&{left:R?0:A?se&&N.getColumn("serialNumber")?.getSize()||0:vt(s.column)},...w&&{right:xt(s.column)},...R&&{left:0}},children:(()=>{if(W?.content){let te=typeof W.content=="function"?W.content(N):W.content;return i("div",{className:o("w-full h-full",W.align==="center"&&"text-center",W.align==="right"&&"text-right",W.align==="left"&&"text-left"),children:te})}if(d){let te=typeof d.content=="function"?d.content(N):d.content;return i("div",{className:o("w-full h-full",d.align==="center"&&"text-center",d.align==="right"&&"text-right",d.align==="left"&&"text-left"),children:te})}return f?i("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(f).map(([te,de])=>S("div",{className:"flex items-center justify-between text-muted-foreground",children:[S("span",{className:"text-xs capitalize",children:[te,":"]}),i("span",{className:"font-medium text-foreground",children:Oo(te,de)})]},te))}):a==="serialNumber"?S("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",N.getFilteredRowModel().rows.length]}):null})()},`agg-${s.id}`)})})}),Oo=(s,g)=>typeof g=="number"?s==="count"||s==="unique"?g.toLocaleString():g.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):g,Go=()=>i(Xt,{className:o(So&&"sticky top-0 bg-sidebar z-20"),children:N.getHeaderGroups().map((s,g)=>i(re,{className:"hover:bg-transparent",children:s.headers.map((a,f)=>{let d=a.depth===0&&a.colSpan>1,v=V&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&E),w=V&&a.column.getIsPinned()==="right",R=a.column.getCanSort(),A=V&&a.column.columnDef.enablePinning!==!1,xe=a.column.id==="serialNumber",W=a.column.id==="select",te=xe||W&&Ye,de=a.column.columnDef.headerAlign||"left",Ct=$&&$[a.column.id]?.enabled,Eo={left:"justify-start",center:"justify-center",right:"justify-end"}[de];return S(Jt,{colSpan:a.colSpan,className:o("font-semibold text-foreground bg-sidebar group px-0",!Ze&&"py-2",Ut&&f<s.headers.length-1&&"border-r","relative",v&&"sticky left-0 z-15 bg-sidebar",w&&"sticky right-0 z-15 bg-sidebar",(xe||W)&&"sticky left-0 z-15 bg-sidebar",d?"text-center":"text-left",Ct&&"border-b-2 border-primary/30"),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...v&&{left:xe?0:W?se&&N.getColumn("serialNumber")?.getSize()||0:vt(a.column)},...w&&{right:xt(a.column)},...xe&&{left:0}},children:[d?S("div",{className:"flex items-center justify-center",children:[At(a.column.columnDef.header,a.getContext()),Ct&&i(fo,{className:"w-3 h-3 ml-1 text-primary"})]}):S("div",{className:o("relative flex items-center w-full px-2",Eo),children:[S("div",{className:"flex items-center gap-1",children:[Ct&&i(fo,{className:"w-3 h-3 mr-1 text-primary"}),R&&de==="right"&&i("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:i(Bt,{className:"w-4 h-4"}),desc:i(Lt,{className:"w-4 h-4"})}[a.column.getIsSorted()]}),a.isPlaceholder?null:At(a.column.columnDef.header,a.getContext()),R&&de!=="right"&&a.column.getIsSorted()&&i("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:i(Bt,{className:"w-4 h-4"}),desc:i(Lt,{className:"w-4 h-4"})}[a.column.getIsSorted()]})]}),(R||A&&!te)&&S(oe,{children:[i(ne,{asChild:!0,className:o("absolute",de==="left"&&"right-1",de==="center"&&"right-1",de==="right"&&"left-1"),children:i(po,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:i(kn,{className:"w-4 h-4"})})}),S(ae,{align:"end",className:"w-48",children:[R&&S(xo,{children:[i(U,{children:"Sorting"}),S(F,{onClick:()=>a.column.toggleSorting(!1),children:[i(Bt,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),S(F,{onClick:()=>a.column.toggleSorting(!0),children:[i(Lt,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),S(F,{onClick:()=>a.column.clearSorting(),disabled:!a.column.getIsSorted(),children:[i(Tn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),i(K,{})]}),A&&!te&&S(xo,{children:[i(U,{children:"Pin Column"}),S(F,{onClick:()=>Wt(a.column.id,"right"),disabled:a.column.getIsPinned()==="right",children:[i(Rn,{}),"Pin Right"]}),S(F,{onClick:()=>Wt(a.column.id,!1),disabled:!a.column.getIsPinned(),children:[i(Mn,{}),"Unpin"]})]})]})]})]}),qt&&a.column.getCanResize()&&!d&&a.colSpan===1&&i("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:a.getResizeHandler()})]},a.id)})},s.id))}),vt=s=>{if(!V)return;let g=0,a=N.getLeftHeaderGroups()[0]?.headers||[],f=[...se?["serialNumber"]:[],...E?["select"]:[]];for(let d of a){if(d.id===s.id)break;if(f.includes(d.id)){let v=N.getColumn(d.id);v&&(g+=v.getSize())}}return g},xt=s=>{if(!V)return;let g=N.getState().columnPinning.right||[],a=g.indexOf(s.id);if(a===-1)return;let f=0;for(let d=a+1;d<g.length;d++){let v=N.getColumn(g[d]);v&&(f+=v.getSize())}return f};if(k)return i(Nt,{className:"w-full shadow-sm rounded-xl",children:i(Pt,{className:"flex items-center justify-center",children:S("div",{className:"text-center",children:[i("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),i("p",{className:"mb-4 text-sm text-muted-foreground",children:k}),Z&&S(C,{variant:"outline",size:"sm",onClick:Z,className:"rounded-lg",children:[i(go,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let Ho=s=>s&&typeof s=="object"&&"content"in s,ee=je(()=>u?Ho(u)?{content:u.content,align:u.align||"left",className:u.className||"",sticky:u.sticky!==void 0?u.sticky:!0,showOnEmpty:u.showOnEmpty!==void 0?u.showOnEmpty:!0}:{content:u,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[u]),ht=()=>Je?i(_t,{table:N,filters:r,globalFilter:Xe,onGlobalFilterChange:Ve,enableGlobalFilter:jt,onExport:ie,onRefresh:Z,loading:P,enableColumnVisibility:bt,enableColumnPinning:V,data:D,onClearSorting:Ao,onClearFilters:Bo,onExternalSearch:ze,onCustomFilterChange:Io,aggregations:$,onAggregationChange:Ie}):null;return i(Le,{children:S("div",{className:o("w-full space-y-2 flex flex-col h-full",z),children:[Je&&Qe==="default"&&ht(),i(Nt,{className:o("shadow-sm overflow-auto py-0",Ro&&"flex-1"),children:i(Pt,{className:"h-full p-0",children:S("div",{className:"relative flex flex-col justify-between h-full",children:[P&&i("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:S("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[i(go,{className:"size-5 animate-spin text-primary"}),i("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),i("div",{className:o("relative overflow-auto border-b rounded-t-xl",N.getRowModel().rows?.length===0&&"h-full"),children:S(yt,{className:o("w-full border-collapse",N.getRowModel().rows?.length===0&&"h-full"),children:[Je&&Qe==="above-header"&&i("thead",{className:"sticky top-0 z-30 bg-sidebar border-b",children:i(re,{className:"hover:bg-transparent",children:i(me,{colSpan:Pe.length,className:"p-2 bg-sidebar",children:ht()})})}),ee&&(ee.showOnEmpty||N.getRowModel().rows?.length>0)&&i("thead",{className:o(ee.sticky&&"sticky top-0 z-20",Qe==="above-header"&&"top-10"),children:i(re,{className:"hover:bg-transparent border-b",children:i(me,{colSpan:Pe.length,className:o("p-2 font-semibold text-foreground bg-sidebar",Ze?"py-2":"py-4",ee.className),children:i("div",{className:o("flex items-center w-full",ee.align==="center"&&"justify-center",ee.align==="right"&&"justify-end",ee.align==="left"&&"justify-start"),children:typeof ee.content=="string"?i("span",{className:"text-lg font-bold tracking-tight text-foreground",children:ee.content}):ee.content})})})}),Je&&Qe==="below-header"&&i("thead",{className:"sticky top-10 z-20 bg-sidebar border-b",children:i(re,{className:"hover:bg-transparent",children:i(me,{colSpan:Pe.length,className:"p-2 bg-sidebar",children:ht()})})}),!Mo&&Go(),i(Kt,{children:N.getRowModel().rows?.length?N.getRowModel().rows.map((s,g)=>i(re,{"data-state":s.getIsSelected()&&"selected",className:o(ko&&"hover:bg-muted/50",To&&g%2===0&&"bg-muted/20",s.getIsSelected()&&"bg-muted","border-b last:border-b-0",le==="single"&&"cursor-pointer"),onClick:()=>{le==="single"&&Vo(s)},children:s.getVisibleCells().map((a,f)=>{let d=V&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&E),v=V&&a.column.getIsPinned()==="right",w=a.column.id==="serialNumber",R=a.column.id==="select",A=w||R&&Ye;return i(me,{className:o(Ze?"py-2":"py-4",Ut&&f<s.getVisibleCells().length&&"border-r",d&&"sticky left-0 z-10 bg-sidebar/97",v&&"sticky right-0 z-10 bg-sidebar/97",w&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:a.column.getSize()!==150?a.column.getSize():"auto",minWidth:a.column.getSize()!==150?a.column.getSize():"auto",...d&&{left:w?0:R?se&&N.getColumn("serialNumber")?.getSize()||0:vt(a.column)},...v&&{right:xt(a.column)},...w&&{left:0}},children:At(a.column.columnDef.cell,a.getContext())},a.id)})},s.id)):i(re,{children:i(me,{colSpan:Pe.length,className:"h-32 text-center border-0",children:S("div",{className:"flex flex-col items-center gap-3",children:[i("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),i("p",{className:"font-medium text-muted-foreground",children:L})]})})})}),Lo()]})}),T&&i("div",{className:"sticky bottom-0 z-20 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:i(yt,{children:i(wt,{children:i(re,{className:"bg-sidebar",children:i(me,{colSpan:Pe.length,className:"p-2",children:T})})})})})]})})}),i(Vt,{table:N,config:m}),H&&H(N)]})})}import{Separator as In}from"radix-ui";import{jsx as Fn}from"react/jsx-runtime";function ut({className:e,orientation:t="horizontal",decorative:r=!0,...m}){return Fn(In.Root,{"data-slot":"separator-root",decorative:r,orientation:t,className:o("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...m})}import{Loader as _n,X as Vn}from"lucide-react";import{AnimatePresence as An,motion as Bn}from"framer-motion";import*as ge from"react";import*as ho from"react-dom";import{jsx as B,jsxs as Ue}from"react/jsx-runtime";function Ln({table:e,visible:t,container:r,children:m,className:b,...u}){let[T,z]=ge.useState(!1);ge.useLayoutEffect(()=>{z(!0)},[]),ge.useEffect(()=>{function k(L){L.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[e]);let x=r??(T?globalThis.document?.body:null);if(!x||!e)return null;let P=t??e.getFilteredSelectedRowModel().rows.length>0;return ho.createPortal(B(An,{children:P&&B(Bn.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:o("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",b),...u,children:B(Le,{children:m})})}),x)}function On({size:e="sm",tooltip:t,isPending:r,disabled:m,className:b,children:u,...T}){let z=B(C,{variant:"secondary",size:e,className:o("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",b),disabled:m||r,...T,children:r?B(_n,{className:"animate-spin"}):u});return t?Ue(Dt,{children:[B(St,{asChild:!0,children:z}),B(Tt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:B("p",{children:t})})]}):z}function Gn({table:e}){let t=ge.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Ue("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Ue("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),B(ut,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Ue(Dt,{children:[B(St,{asChild:!0,children:B(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:B(Vn,{className:"size-3.5"})})}),Ue(Tt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[B("p",{children:"Clear selection"}),B("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:B("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as qe,EyeOff as Hn}from"lucide-react";import{jsx as Y,jsxs as Re}from"react/jsx-runtime";function En({column:e,title:t,className:r}){return e.getCanSort()?Y("div",{className:o("flex items-center space-x-2",r),children:Re(oe,{children:[Y(ne,{asChild:!0,children:Re(C,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[Y("span",{children:t}),e.getIsSorted()==="desc"?Y(qe,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?Y(qe,{className:"ml-2 h-4 w-4"}):Y(qe,{className:"ml-2 h-4 w-4"})]})}),Re(ae,{align:"start",className:"rounded-lg",children:[Re(F,{onClick:()=>e.toggleSorting(!1),children:[Y(qe,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),Re(F,{onClick:()=>e.toggleSorting(!0),children:[Y(qe,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),Y(K,{}),Re(F,{onClick:()=>e.toggleVisibility(!1),children:[Y(Hn,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):Y("div",{className:o(r),children:t})}import{ChevronDown as jn,Eye as Un}from"lucide-react";import{jsx as Me,jsxs as Ot}from"react/jsx-runtime";function qn({table:e}){return Ot(oe,{children:[Me(ne,{asChild:!0,children:Ot(C,{variant:"outline",size:"sm",className:"rounded-lg",children:[Me(Un,{className:"mr-2 h-4 w-4"}),"Columns ",Me(jn,{className:"ml-2 h-4 w-4"})]})}),Ot(ae,{align:"end",className:"w-[200px] rounded-lg",children:[Me(U,{children:"Toggle Columns"}),Me(K,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>Me(Te,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:r=>t.toggleVisibility(!!r),children:t.id},t.id))]})]})}import{Slot as $n}from"radix-ui";import{cva as Wn}from"class-variance-authority";import{jsx as Kn}from"react/jsx-runtime";var Xn=Wn("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-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 transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function pt({className:e,variant:t,asChild:r=!1,...m}){let b=r?$n.Slot:"span";return Kn(b,{"data-slot":"badge",className:o(Xn({variant:t}),e),...m})}import{Command as Ce}from"cmdk";import{SearchIcon as Jn}from"lucide-react";import{Dialog as vi}from"radix-ui";import{XIcon as hi}from"lucide-react";import{jsx as wi,jsxs as Ni}from"react/jsx-runtime";import{jsx as fe,jsxs as Qn}from"react/jsx-runtime";function Co({className:e,...t}){return fe(Ce,{"data-slot":"command",className:o("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function yo({className:e,...t}){return Qn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[fe(Jn,{className:"size-4 shrink-0 opacity-50"}),fe(Ce.Input,{"data-slot":"command-input",className:o("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function wo({className:e,...t}){return fe(Ce.List,{"data-slot":"command-list",className:o("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function No({...e}){return fe(Ce.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Gt({className:e,...t}){return fe(Ce.Group,{"data-slot":"command-group",className:o("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Po({className:e,...t}){return fe(Ce.Separator,{"data-slot":"command-separator",className:o("bg-border -mx-1 h-px",e),...t})}function Ht({className:e,...t}){return fe(Ce.Item,{"data-slot":"command-item",className:o("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}import{CheckIcon as Yn,PlusCircleIcon as Zn}from"lucide-react";import{Fragment as Do,jsx as M,jsxs as be}from"react/jsx-runtime";function ea({column:e,title:t,options:r}){let m=e?.getFacetedUniqueValues(),b=new Set(e?.getFilterValue());return be(st,{children:[M(lt,{asChild:!0,children:be(C,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[M(Zn,{className:"mr-2 h-4 w-4"}),t,b?.size>0&&be(Do,{children:[M(ut,{orientation:"vertical",className:"mx-2 h-4"}),M(pt,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:b.size}),M("div",{className:"hidden space-x-1 lg:flex",children:b.size>2?be(pt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[b.size," selected"]}):r.filter(u=>b.has(u.value)).map(u=>M(pt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:u.label},u.value))})]})]})}),M(dt,{className:"w-[200px] p-0 rounded-lg",align:"start",children:be(Co,{className:"rounded-lg",children:[M(yo,{placeholder:t}),be(wo,{children:[M(No,{children:"No results found."}),M(Gt,{children:r.map(u=>{let T=b.has(u.value);return be(Ht,{onSelect:()=>{T?b.delete(u.value):b.add(u.value);let z=Array.from(b);e?.setFilterValue(z.length?z:void 0)},children:[M("div",{className:o("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",T?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M(Yn,{className:o("h-4 w-4")})}),u.icon&&M(u.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M("span",{children:u.label}),m?.get(u.value)&&M("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:m.get(u.value)})]},u.value)})}),b.size>0&&be(Do,{children:[M(Po,{}),M(Gt,{children:M(Ht,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{zn as DataTable,Ln as DataTableActionBar,On as DataTableActionBarAction,Gn as DataTableActionBarSelection,En as DataTableColumnHeader,ea as DataTableFacetedFilter,Vt as DataTablePagination,_t as DataTableToolbar,qn as DataTableViewOptions};
|
|
2
|
+
import{flexRender as jt,getCoreRowModel as An,getFilteredRowModel as Bn,getPaginationRowModel as Hn,getSortedRowModel as Ln,useReactTable as On}from"@tanstack/react-table";import{Loader2 as No,ChevronUp as Ut,ChevronDown as $t,ChevronsUpDown as En,MoreHorizontal as Gn,MoveRightIcon as jn,PinOffIcon as Un,Calculator as Po}from"lucide-react";import{Slot as rn}from"radix-ui";import{cva as sn}from"class-variance-authority";import{clsx as nn}from"clsx";import{twMerge as an}from"tailwind-merge";function o(...e){return an(nn(e))}import{jsx as ln}from"react/jsx-runtime";var et=sn("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 C({className:e,variant:t,size:r,asChild:m=!1,...b}){let c=m?rn.Slot:"button";return ln(c,{"data-slot":"button",className:o(et({variant:t,size:r,className:e}),"transition-none"),...b})}import{jsx as ce}from"react/jsx-runtime";function kt({className:e,...t}){return ce("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:ce("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function no({className:e,...t}){return ce("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function ao({className:e,...t}){return ce("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function Rt({className:e,...t}){return ce("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function ie({className:e,...t}){return ce("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function ro({className:e,...t}){return ce("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function me({className:e,...t}){return ce("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as io}from"react/jsx-runtime";function Mt({className:e,...t}){return io("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function zt({className:e,...t}){return io("div",{"data-slot":"card-content",className:o("px-6",e),...t})}import{Tooltip as Pe}from"radix-ui";import{jsx as De,jsxs as dn}from"react/jsx-runtime";function He({delayDuration:e=0,...t}){return De(Pe.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function It({...e}){return De(He,{children:De(Pe.Root,{"data-slot":"tooltip",...e})})}function Ft({...e}){return De(Pe.Trigger,{"data-slot":"tooltip-trigger",...e})}function _t({className:e,sideOffset:t=0,children:r,...m}){return De(Pe.Portal,{children:dn(Pe.Content,{"data-slot":"tooltip-content",sideOffset:t,className:o("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...m,children:[r,De(Pe.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as vo,RefreshCw as Dn,Download as Tn,Settings2 as Sn,Filter as xo,ArrowUpDown as kn,PinOff as Rn,Pin as Mn,ChevronDown as ho,Calculator as Ot}from"lucide-react";import{jsx as cn}from"react/jsx-runtime";function Vt({className:e,type:t,...r}){return cn("input",{type:t,"data-slot":"input",className:o("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{Select as X}from"radix-ui";import{CheckIcon as mn,ChevronDownIcon as so,ChevronUpIcon as un}from"lucide-react";import{jsx as F,jsxs as At}from"react/jsx-runtime";function tt({...e}){return F(X.Root,{"data-slot":"select",...e})}function ot({...e}){return F(X.Value,{"data-slot":"select-value",...e})}function nt({className:e,size:t="default",children:r,...m}){return At(X.Trigger,{"data-slot":"select-trigger","data-size":t,className:o("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),...m,children:[r,F(X.Icon,{asChild:!0,children:F(so,{className:"size-4 opacity-50"})})]})}function at({className:e,children:t,position:r="popper",...m}){return F(X.Portal,{children:At(X.Content,{"data-slot":"select-content",className:o("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,...m,children:[F(pn,{}),F(X.Viewport,{className:o("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),F(gn,{})]})})}function Le({className:e,children:t,...r}){return At(X.Item,{"data-slot":"select-item",className:o("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:[F("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:F(X.ItemIndicator,{children:F(mn,{className:"size-4"})})}),F(X.ItemText,{children:t})]})}function pn({className:e,...t}){return F(X.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:F(un,{className:"size-4"})})}function gn({className:e,...t}){return F(X.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:F(so,{className:"size-4"})})}import{DropdownMenu as U}from"radix-ui";import{CheckIcon as fn,ChevronRightIcon as bn,CircleIcon as Ua}from"lucide-react";import{jsx as L,jsxs as uo}from"react/jsx-runtime";function oe({...e}){return L(U.Root,{"data-slot":"dropdown-menu",...e})}function ne({...e}){return L(U.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ae({className:e,sideOffset:t=4,...r}){return L(U.Portal,{children:L(U.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:o("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 Bt({...e}){return L(U.Group,{"data-slot":"dropdown-menu-group",...e})}function _({className:e,inset:t,variant:r="default",...m}){return L(U.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:o("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),...m})}function Te({className:e,children:t,checked:r,...m}){return uo(U.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:o("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",e),checked:r,...m,children:[L("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:L(U.ItemIndicator,{children:L(fn,{className:"size-4"})})}),t]})}function $({className:e,inset:t,...r}){return L(U.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:o("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function K({className:e,...t}){return L(U.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}function lo({...e}){return L(U.Sub,{"data-slot":"dropdown-menu-sub",...e})}function co({className:e,inset:t,children:r,...m}){return uo(U.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:o("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...m,children:[r,L(bn,{className:"ml-auto size-4"})]})}function mo({className:e,...t}){return L(U.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as Co}from"react";import{useEffect as wn,useState as Ht}from"react";import{Calendar as Nn}from"lucide-react";import{format as Oe}from"date-fns";import{Popover as rt}from"radix-ui";import{jsx as it}from"react/jsx-runtime";function st({...e}){return it(rt.Root,{"data-slot":"popover",...e})}function lt({...e}){return it(rt.Trigger,{"data-slot":"popover-trigger",...e})}function dt({className:e,align:t="center",sideOffset:r=4,...m}){return it(rt.Portal,{children:it(rt.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:o("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 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...m})})}import*as ct from"react";import{ChevronDownIcon as vn,ChevronLeftIcon as xn,ChevronRightIcon as hn}from"lucide-react";import{DayPicker as Cn,getDefaultClassNames as po}from"react-day-picker";import{jsx as ue}from"react/jsx-runtime";function go({className:e,classNames:t,showOutsideDays:r=!0,captionLayout:m="label",buttonVariant:b="ghost",formatters:c,components:S,...I}){let v=po();return ue(Cn,{showOutsideDays:r,className:o("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:m,formatters:{formatMonthDropdown:D=>D.toLocaleString("default",{month:"short"}),...c},classNames:{root:o("w-fit",v.root),months:o("flex gap-4 flex-col md:flex-row relative",v.months),month:o("flex flex-col w-full gap-4",v.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",v.nav),button_previous:o(et({variant:b}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",v.button_previous),button_next:o(et({variant:b}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",v.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",v.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",v.dropdowns),dropdown_root:o("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",v.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",v.dropdown),caption_label:o("select-none font-medium",m==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",v.caption_label),table:"w-full border-collapse",weekdays:o("flex",v.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",v.weekday),week:o("flex w-full mt-2",v.week),week_number_header:o("select-none w-(--cell-size)",v.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",v.week_number),day:o("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",v.day),range_start:o("rounded-l-md bg-accent",v.range_start),range_middle:o("rounded-none",v.range_middle),range_end:o("rounded-r-md bg-accent",v.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",v.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",v.outside),disabled:o("text-muted-foreground opacity-50",v.disabled),hidden:o("invisible",v.hidden),...t},components:{Root:({className:D,rootRef:k,...H})=>ue("div",{"data-slot":"calendar",ref:k,className:o(D),...H}),Chevron:({className:D,orientation:k,...H})=>k==="left"?ue(xn,{className:o("size-4",D),...H}):k==="right"?ue(hn,{className:o("size-4",D),...H}):ue(vn,{className:o("size-4",D),...H}),DayButton:yn,WeekNumber:({children:D,...k})=>ue("td",{...k,children:ue("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:D})}),...S},...I})}function yn({className:e,day:t,modifiers:r,...m}){let b=po(),c=ct.useRef(null);return ct.useEffect(()=>{r.focused&&c.current?.focus()},[r.focused]),ue(C,{ref:c,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:o("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",b.day,e),...m})}import{jsx as xe,jsxs as Ee}from"react/jsx-runtime";function fo({value:e,onChange:t,placeholder:r,mode:m,externalSearch:b,onExternalChange:c,onlyExternal:S=!1}){let[I,v]=Ht(!1),[D,k]=Ht(e),[H,J]=Ht(e);wn(()=>{S||J(e)},[e,S]);let se=()=>{S||t(D),J(D),b&&c&&c(D),v(!1)},ee=()=>{k(H),v(!1)},W=()=>{let y=m==="single"?null:{from:null,to:null};k(y),S||t(y),J(y),b&&c&&c(y),v(!1)},E=()=>{let y=S?H:e;return y?m==="single"?Oe(y,"PPP"):y.from&&y.to?`${Oe(y.from,"MMM dd")} - ${Oe(y.to,"MMM dd, yyyy")}`:y.from?`From ${Oe(y.from,"MMM dd, yyyy")}`:y.to?`To ${Oe(y.to,"MMM dd, yyyy")}`:r:r},Q=y=>{k(m==="single"?y:y||{from:null,to:null})};return Ee(st,{open:I,onOpenChange:v,children:[xe(lt,{asChild:!0,children:Ee(C,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!E()&&"text-muted-foreground"),children:[xe(Nn,{className:"mr-2 h-4 w-4"}),E()]})}),Ee(dt,{className:"w-auto p-0",align:"start",children:[xe("div",{className:"p-3",children:xe(go,{mode:m,selected:D,onSelect:Q,numberOfMonths:m==="range"?2:1,className:"rounded-md border",...m==="range"&&{required:!0}})}),Ee("div",{className:"flex items-center justify-between p-3 border-t",children:[xe(C,{variant:"ghost",size:"sm",onClick:W,children:"Clear"}),Ee("div",{className:"flex gap-2",children:[xe(C,{variant:"outline",size:"sm",onClick:ee,children:"Cancel"}),xe(C,{size:"sm",onClick:se,disabled:m==="range"&&(!D?.from||!D?.to),children:"Apply"})]})]})]})]})}import{Checkbox as bo}from"radix-ui";import{CheckIcon as Pn}from"lucide-react";import{jsx as Lt}from"react/jsx-runtime";function Ge({className:e,...t}){return Lt(bo.Root,{"data-slot":"checkbox",className:o("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:Lt(bo.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Lt(Pn,{className:"size-3.5"})})})}import{Fragment as zn,jsx as l,jsxs as h}from"react/jsx-runtime";var yo=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function Et({table:e,filters:t=[],globalFilter:r,onGlobalFilterChange:m,enableGlobalFilter:b=!0,onExport:c,onRefresh:S,loading:I=!1,enableColumnVisibility:v=!0,data:D,onClearSorting:k,onClearFilters:H,enableColumnPinning:J=!1,onExternalSearch:se,onCustomFilterChange:ee,aggregations:W={},onAggregationChange:E}){let[Q,y]=Co({}),[Me,te]=Co({}),ze=()=>e.getAllLeafColumns().filter(n=>n.getCanHide?.()!==!1),qe=()=>e.getAllColumns().filter(n=>!e.getAllLeafColumns().includes(n)&&n.columns?.length&&n.columns.some(d=>d.getCanHide?.()!==!1)),Ie=()=>{let n=new Set(qe().flatMap(d=>d.columns?.filter(g=>g.getCanHide?.()!==!1).map(g=>g.id)||[]));return ze().filter(d=>!n.has(d.id))},Fe=(n,d)=>d&&n.startsWith(`${d}.`)?n.replace(`${d}.`,"").split("_").map(P=>P.slice(1)).join(" "):n.split("_").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" "),Ce=(n,d)=>{let g={...Q,[n]:d};y(g)},bt=(n,d)=>{let g={...Me,[n]:d};te(g),ee&&ee(n,d),t.find(P=>P.key===n)?.externalSearch&&Ce(n,d)},vt=()=>{se&&se(Q)},We=()=>{y({}),te({}),H(),se&&se({}),ee&&Object.keys(Me).forEach(n=>{ee(n,"")})},_e=n=>t.find(g=>g.key===n)?.customFilter?Me[n]??"":e.getColumn(n)?.getFilterValue(),ye=(n,d)=>{let g=t.find(P=>P.key===n);g?.customFilter?bt(n,d):(e.getColumn(n)?.setFilterValue(d),g?.externalSearch&&Ce(n,d))},Ve=n=>{if(E){let d=W[n],g={enabled:!d?.enabled,functions:d?.functions||["sum","average"]};E(n,g)}},xt=(n,d)=>{if(E){let P=W[n]?.functions||[],z=P.includes(d)?P.filter(Kt=>Kt!==d):[...P,d];E(n,{enabled:z.length>0,functions:z})}},Xe=()=>{E&&Object.keys(W).forEach(n=>{let d=W[n];d&&E(n,{...d,enabled:!1,functions:[]})})},Ae=ze().filter(n=>n.id==="select"||n.id==="serialNumber"?!1:n.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(P=>{let z=P.getValue(n.id);return typeof z=="number"||typeof z=="string"&&!isNaN(parseFloat(String(z)))||typeof z=="object"&&z!==null&&"props"in z})),be=Object.values(W).some(n=>n?.enabled);return l("div",{className:"rounded-xl",children:l("div",{className:"px-2",children:l("div",{className:"flex flex-col gap-6",children:h("div",{className:"flex items-center justify-between",children:[l("div",{className:"flex items-center gap-3",children:t.length>0&&h("div",{className:"flex flex-wrap items-center gap-3",children:[l("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:l(xo,{className:"size-4"})}),t.map(n=>!e.getColumn(n.key)&&!n.customFilter&&!n.externalSearch?null:l("div",{className:o("relative min-w-[150px]",n.width),children:n.type==="select"?h(tt,{value:_e(n.key)??"",onValueChange:g=>{ye(n.key,g==="all"?"":g)},children:[n.icon&&l("span",{children:l(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),l(nt,{className:o("h-9 rounded-lg w-full",n.icon&&"pl-9"),children:l(ot,{placeholder:n.placeholder})}),h(at,{className:"rounded-lg",children:[l(Le,{value:"all",children:"All"}),n.options?.map(g=>l(Le,{value:g.value,children:g.label},g.label))]})]}):n.type==="date"?l(fo,{value:_e(n.key),onChange:g=>{n.onlyExternal||ye(n.key,g)},placeholder:n.placeholder,mode:n.dateMode||"single",externalSearch:n.externalSearch,onlyExternal:n.onlyExternal,onExternalChange:g=>Ce(n.key,g)}):h("div",{className:"relative",children:[n.icon&&l("span",{children:l(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),l(Vt,{placeholder:n.placeholder,value:_e(n.key)??"",onChange:g=>{ye(n.key,g.target.value)},className:o("h-7 rounded-lg",n.icon&&"pl-9"),type:n.type==="number"?"number":"text"})]})},n.key)),(t.some(n=>n.externalSearch)||t.some(n=>n.customFilter))&&h(C,{variant:"default",size:"sm",onClick:vt,className:"rounded-lg h-7",children:[l(vo,{className:"size-4"}),t.find(n=>n.externalSearch||n.customFilter)?.searchButtonText||"Search"]})]})}),h("div",{className:"flex items-center gap-2",children:[b&&h("div",{className:"relative",children:[l(vo,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Vt,{placeholder:"Global search...",value:r??"",onChange:n=>m(n.target.value),className:"pl-9 h-7 max-w-max"})]}),Ae.length>0&&E&&h(oe,{children:[l(ne,{asChild:!0,children:h(C,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",be&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[l(Ot,{className:"size-4"}),l("span",{children:"Aggregations"}),l(ho,{className:"opacity-50 size-4"})]})}),h(ae,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[h($,{className:"flex items-center justify-between px-4 py-2",children:[l("span",{className:"text-sm font-medium",children:"Column Aggregations"}),be&&l(C,{variant:"ghost",size:"sm",onClick:Xe,className:"h-6 px-2 text-xs",children:"Clear All"})]}),l(K,{}),Ae.map(n=>{let d=W[n.id],g=d?.enabled;return h(lo,{children:[l(co,{className:"text-sm",children:h("div",{className:"flex items-center w-full gap-2",children:[l(Ge,{checked:g,onCheckedChange:()=>Ve(n.id),className:"data-[state=checked]:bg-primary"}),l("span",{className:o("flex-1",g&&"font-medium text-primary"),children:Fe(n.id)}),g&&h("div",{className:"flex items-center gap-1",children:[d?.functions?.slice(0,2).map(P=>l("div",{className:"w-2 h-2 rounded-full bg-primary",title:yo.find(z=>z.value===P)?.label},P)),d?.functions&&d.functions.length>2&&h("div",{className:"text-xs text-muted-foreground",children:["+",d.functions.length-2]})]})]})}),h(mo,{className:"w-48 rounded-lg",children:[l($,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),yo.map(P=>l(Te,{checked:d?.functions?.includes(P.value)||!1,onCheckedChange:()=>xt(n.id,P.value),className:"py-2 text-sm",children:h("div",{className:"flex flex-col",children:[l("span",{children:P.label}),l("span",{className:"text-xs text-muted-foreground",children:P.description})]})},P.value))]})]},n.id)}),Ae.length===0&&h("div",{className:"px-3 py-4 text-center",children:[l(Ot,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),l("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),c&&h(C,{variant:"outline",size:"sm",onClick:()=>c(D),className:"rounded-lg",children:[l(Tn,{className:"size-4"}),"Export"]}),v&&h(oe,{children:[l(ne,{asChild:!0,className:"h-7",children:h(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[l("span",{children:"Columns"}),l(ho,{className:"opacity-50 size-4"})]})}),h(ae,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[l($,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),l(K,{}),Ie().length>0&&h(Bt,{children:[l($,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),Ie().map(n=>l(Te,{className:"text-sm",checked:n.getIsVisible(),onCheckedChange:d=>n.toggleVisibility(!!d),children:Fe(n.id)},n.id))]}),qe().map(n=>h(Bt,{children:[l(K,{}),l($,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:n.id}),n.columns?.filter(d=>d.getCanHide?.()!==!1).map(d=>l(Te,{className:"text-sm",checked:d.getIsVisible(),onCheckedChange:g=>d.toggleVisibility(!!g),children:Fe(d.id,n.id)},d.id))]},n.id))]})]}),h(oe,{children:[l(ne,{asChild:!0,className:"h-7",children:l(C,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:l(Sn,{className:"size-4"})})}),h(ae,{align:"end",className:"w-[200px] rounded-lg",children:[l($,{children:"Table Settings"}),l(K,{}),h(_,{onClick:k,children:[l(kn,{className:"size-4"}),"Clear All Sorting"]}),h(_,{onClick:We,children:[l(xo,{className:"size-4"}),"Clear All Filters"]}),be&&h(_,{onClick:Xe,children:[l(Ot,{className:"size-4"}),"Clear Aggregations"]}),J&&h(zn,{children:[l(K,{}),l($,{children:"Column Pinning"}),h(_,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[l(Rn,{className:"size-4"}),"Reset All Pinning"]}),h(_,{onClick:()=>{let n=ze().filter(d=>d.getCanPin?.()!==!1).map(d=>d.id);e.setColumnPinning({left:[],right:n})},children:[l(Mn,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),S&&l(C,{variant:"outline",size:"sm",onClick:S,disabled:I,className:"rounded-lg",children:l(Dn,{className:o("h-4 w-4",I&&"animate-spin")})})]})]})})})})}import{jsx as O,jsxs as Se}from"react/jsx-runtime";function Gt({table:e,config:t}){return t.enabled?O("div",{className:"rounded-xl",children:O("div",{children:Se("div",{className:"flex items-center justify-between",children:[O("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&Se("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),Se("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&Se("div",{className:"flex items-center gap-2",children:[O("span",{className:"text-sm font-medium",children:"Rows per page:"}),Se(tt,{value:`${e.getState().pagination.pageSize}`,onValueChange:r=>e.setPageSize(Number(r)),children:[O(nt,{className:"h-9 w-[70px] rounded-lg",children:O(ot,{})}),O(at,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(r=>O(Le,{value:`${r}`,children:r},r))})]})]}),Se("div",{className:"flex items-center gap-2",children:[O(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),O(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&O("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(r,m)=>{let b=e.getState().pagination.pageIndex,c=b+m;return c<1||c>e.getPageCount()?null:O(C,{variant:c===b+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(c-1),children:c},c)})}),O(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),O(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as In}from"radix-ui";import{cva as Fn}from"class-variance-authority";import{jsx as Vn}from"react/jsx-runtime";var _n=Fn("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function wo({className:e,variant:t,size:r,noBg:m,...b}){return Vn(In.Root,{"data-slot":"toggle",className:o(_n({className:e,variant:t,size:r,bg:m?"disabled":"enabled"})),...b})}import{useCallback as mt,useEffect as ut,useMemo as pt,useRef as je,useState as q}from"react";import{Fragment as To,jsx as s,jsxs as T}from"react/jsx-runtime";var Do={sum:e=>e.reduce((t,r)=>t+r,0),average:e=>e.length>0?e.reduce((t,r)=>t+r,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((m,b)=>m-b),r=Math.floor(t.length/2);return t.length%2===0?(t[r-1]+t[r])/2:t[r]}};function $n({data:e,columns:t,filters:r=[],pagination:m={enabled:!1},settings:b={},header:c,footer:S,className:I="",maxHeight:v="100%",loading:D=!1,error:k,emptyMessage:H="No data available",onRowSelectionChange:J,onExport:se,onRefresh:ee,onTableReady:W,children:E,isRowDisabled:Q,isRowSelectable:y,onExternalSearch:Me,aggregations:te={},onAggregationChange:ze}){let[qe,Ie]=q([]),[Fe,Ce]=q([]),[bt,vt]=q({}),[We,_e]=q({}),[ye,Ve]=q(""),[xt,Xe]=q([]),[Ke,Ae]=q(b.enableColumnPinning?{left:[],right:[]}:{}),[be,n]=q({}),d=je(null),g=je(null),P=je(null),z=je(null),[Kt,_o]=q(0),[Jt,Vo]=q(0),[Ao,Bo]=q(0),[Qt,Ho]=q(0),Je=je(null),[ht,Lo]=q(!1),{enableSorting:Ct=!0,enableFiltering:yt=!0,enableGlobalFilter:Yt=!0,enableColumnVisibility:wt=!0,enableRowSelection:G=!0,stickyHeader:fa=!0,toolbar:Be=!1,toolbarPosition:ve="default",showSerialNumbers:le=!0,fixedCheckboxColumn:Qe=!0,striped:Oo=!0,hoverable:Eo=!0,compact:Ye=!0,bordered:Zt=!0,fullHeight:Go=!1,enableColumnResizing:eo=!1,enableColumnPinning:V=!0,hideHeader:jo=!1,selectionMode:de="multiple",showCheckBox:Uo=!0,checkboxColumnPosition:to=0}=b;ut(()=>{let i=()=>{Je.current&&Lo(Je.current.scrollTop>0)},p=Je.current;if(p)return p.addEventListener("scroll",i),()=>p.removeEventListener("scroll",i)},[]),ut(()=>{let i=()=>{d.current&&_o(d.current.offsetHeight+16),g.current&&Vo(g.current.offsetHeight+16),P.current&&Bo(P.current.offsetHeight+16),z.current&&Ho(z.current.offsetHeight+16)};i();let p=new ResizeObserver(()=>{setTimeout(i,50)});return d.current&&p.observe(d.current),g.current&&p.observe(g.current),P.current&&p.observe(P.current),z.current&&p.observe(z.current),()=>{p.disconnect()}},[Be,c,ve]);let $o=(i,p)=>p.split(".").reduce((a,f)=>a&&a[f],i),Nt=pt(()=>Object.keys(be).length===0?e:e.filter(i=>Object.entries(be).every(([p,a])=>{if(!a||a==="")return!0;let f=$o(i,p);return typeof a=="string"?String(f).toLowerCase().includes(a.toLowerCase()):f===a})),[e,be]),qo=mt((i,p)=>{n(a=>{let f={...a};return p===""||p===null||p===void 0?delete f[i]:f[i]=p,f})},[]),we=pt(()=>{let i=[...t],p=u=>u.map(x=>{if(x.id==="select"||x.id==="serialNumber")return x;let w={...x,enablePinning:!0};return x.columns&&(w.columns=p(x.columns)),w}),a=p(i),f={id:"select",header:({table:u})=>{if(de==="single")return null;let x=u.getRowModel().rows.filter(j=>!Q?.(j.original)&&(y?y(j.original):!0)),w=x.length>0&&x.every(j=>j.getIsSelected()),R=x.some(j=>j.getIsSelected());return s(Ge,{checked:w||R&&"indeterminate",onCheckedChange:j=>{x.forEach(A=>A.toggleSelected(!!j))},"aria-label":"Select all selectable rows"})},cell:({row:u})=>{let x=Q?Q(u.original):!1,w=y?y(u.original):!0;return s("div",{className:o("flex items-center justify-center",x&&"opacity-50"),children:de==="multiple"?s(Ge,{checked:u.getIsSelected(),onCheckedChange:R=>w&&u.toggleSelected(!!R),"aria-label":"Select row",disabled:x||!w}):Uo?s("input",{type:"radio",checked:u.getIsSelected(),onChange:()=>w&&u.toggleSelected(!0),disabled:x||!w,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:de==="multiple"?40:30};if(G){let u=to;u<0&&(u=a.length+u+1),u=Math.max(0,Math.min(u,a.length)),a.splice(u,0,f)}if(le){let u={id:"serialNumber",header:"No.",cell:({row:x})=>s("div",{className:"font-medium text-center text-muted-foreground",children:x.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};a.unshift(u)}return a},[t,le,G,Qe,Q,y,de,to]),N=On({data:Nt,columns:we,onSortingChange:Ct?Ie:void 0,onColumnFiltersChange:yt?Ce:void 0,onGlobalFilterChange:Yt?Ve:void 0,getCoreRowModel:An(),getPaginationRowModel:m.enabled?Hn():void 0,getSortedRowModel:Ct?Ln():void 0,getFilteredRowModel:yt?Bn():void 0,onColumnVisibilityChange:wt?vt:void 0,onRowSelectionChange:G?_e:void 0,onColumnOrderChange:Xe,onColumnPinningChange:V?Ae:void 0,state:{sorting:Ct?qe:void 0,columnFilters:yt?Fe:void 0,columnVisibility:wt?bt:void 0,rowSelection:G?We:{},globalFilter:ye,columnOrder:xt,columnPinning:V?Ke:{}},initialState:{pagination:m.enabled?{pageSize:m.pageSize||10}:void 0,columnPinning:V?{left:[...le?["serialNumber"]:[],...G?["select"]:[]],right:[]}:void 0},enableRowSelection:G,enableColumnResizing:eo,enableColumnPinning:V,columnResizeMode:"onChange"}),Wo=pt(()=>{if(!te||Object.keys(te).length===0)return{};let i={},p=N.getFilteredRowModel().rows;return Object.entries(te).forEach(([a,f])=>{if(!f?.enabled)return;let u=p.map(w=>{if(f.accessor)return f.accessor(w.original);{let R=w.getValue(a);return typeof R=="number"?R:parseFloat(String(R))||0}}).filter(w=>w!==null&&!isNaN(w)),x={};f.functions?.forEach(w=>{Do[w]&&(x[w]=Do[w](u))}),Object.keys(x).length>0&&(i[a]=x)}),i},[Nt,te,N?.getFilteredRowModel().rows]);ut(()=>{if(G&&J){let i=N.getFilteredSelectedRowModel().rows.filter(p=>!Q?.(p.original)&&(y?y(p.original):!0)).map(p=>p.original);J(i)}},[We,G,J,N,Q,y]);let Xo=mt(i=>{de==="single"?(N.resetRowSelection(),i.toggleSelected(!0)):i.toggleSelected()},[de,N]);ut(()=>{W&&W(N)},[N,W]);let Ko=mt(()=>{Ie([])},[]),Jo=mt(()=>{Ce([]),Ve("")},[]),oo=(i,p)=>{if(!V)return;let a=[...le?["serialNumber"]:[],...G&&Qe?["select"]:[]],f={left:[...(Ke.left??[]).filter(u=>a.includes(u))],right:[...Ke.right??[]]};p===!1?(f.left=f.left.filter(u=>u!==i),f.right=f.right.filter(u=>u!==i)):p==="right"?(f.left=f.left.filter(u=>u!==i),f.right.includes(i)||f.right.push(i)):p==="left"&&(f.right=f.right.filter(u=>u!==i),!f.left.includes(i)&&!a.includes(i)&&f.left.push(i)),N.setColumnPinning(f)},Qo=()=>s(Rt,{className:"sticky bottom-0 border-t bg-sidebar z-10",children:s(ie,{className:"hover:bg-transparent bg-sidebar",children:N.getHeaderGroups()[0]?.headers.map((i,p)=>{let a=i.column.id,f=Wo[a],u=V&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&G),x=V&&i.column.getIsPinned()==="right",w=i.column.id==="serialNumber",R=i.column.id==="select",A=i.column.columnDef.customFooter;return s(me,{className:o("font-semibold text-sm py-2 px-2 border-r",Ye&&"py-1",u&&"sticky left-0 z-30 bg-sidebar/95",x&&"sticky right-0 z-30 bg-sidebar/95",(w||R)&&"sticky left-0 z-30 bg-sidebar/95",A?.className),style:{width:i.getSize()!==150?i.getSize():"auto",minWidth:i.getSize()!==150?i.getSize():"auto",...u&&{left:w?0:R?le&&N.getColumn("serialNumber")?.getSize()||0:Pt(i.column)},...x&&{right:Dt(i.column)},...w&&{left:0}},children:(()=>{if(A?.content){let re=typeof A.content=="function"?A.content(N):A.content;return s("div",{className:o("w-full h-full",A.align==="center"&&"text-center",A.align==="right"&&"text-right",A.align==="left"&&"text-left"),children:re})}return f?s("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(f).map(([re,Ze])=>T("div",{className:"flex items-center justify-between text-muted-foreground",children:[T("span",{className:"text-xs capitalize",children:[re,":"]}),s("span",{className:"font-medium text-foreground",children:Yo(re,Ze)})]},re))}):a==="serialNumber"?T("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",N.getFilteredRowModel().rows.length]}):null})()},`agg-${i.id}`)})})}),Yo=(i,p)=>typeof p=="number"?i==="count"||i==="unique"?p.toLocaleString():p.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):p,Zo=()=>N.getHeaderGroups().map((i,p)=>s(ie,{className:"hover:bg-transparent",children:i.headers.map((a,f)=>{let u=a.depth===0&&a.colSpan>1,x=V&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&G),w=V&&a.column.getIsPinned()==="right",R=a.column.getCanSort(),j=V&&a.column.columnDef.enablePinning!==!1,A=a.column.id==="serialNumber",re=a.column.id==="select",Ze=A||re&&Qe,Ne=a.column.columnDef.headerAlign||"left",St=te&&te[a.column.id]?.enabled,on={left:"justify-start",center:"justify-center",right:"justify-end"}[Ne];return T(ro,{colSpan:a.colSpan,className:o("font-semibold text-foreground bg-sidebar group px-0",!Ye&&"py-2",Zt&&f<i.headers.length-1&&"border-r","relative",x&&"sticky left-0 z-25 bg-sidebar",w&&"sticky right-0 z-25 bg-sidebar",(A||re)&&"sticky left-0 z-25 bg-sidebar",u?"text-center":"text-left",St&&"border-b-2 border-primary/30"),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...x&&{left:A?0:re?le&&N.getColumn("serialNumber")?.getSize()||0:Pt(a.column)},...w&&{right:Dt(a.column)},...A&&{left:0}},children:[u?T("div",{className:"flex items-center justify-center",children:[jt(a.column.columnDef.header,a.getContext()),St&&s(Po,{className:"w-3 h-3 ml-1 text-primary"})]}):T("div",{className:o("relative flex items-center w-full px-2",on),children:[T("div",{className:"flex items-center gap-1",children:[St&&s(Po,{className:"w-3 h-3 mr-1 text-primary"}),R&&Ne==="right"&&s("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:s(Ut,{className:"w-4 h-4"}),desc:s($t,{className:"w-4 h-4"})}[a.column.getIsSorted()]}),a.isPlaceholder?null:jt(a.column.columnDef.header,a.getContext()),R&&Ne!=="right"&&a.column.getIsSorted()&&s("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:s(Ut,{className:"w-4 h-4"}),desc:s($t,{className:"w-4 h-4"})}[a.column.getIsSorted()]})]}),(R||j&&!Ze)&&T(oe,{children:[s(ne,{asChild:!0,className:o("absolute",Ne==="left"&&"right-1",Ne==="center"&&"right-1",Ne==="right"&&"left-1"),children:s(wo,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:s(Gn,{className:"w-4 h-4"})})}),T(ae,{align:"end",className:"w-48",children:[R&&T(To,{children:[s($,{children:"Sorting"}),T(_,{onClick:()=>a.column.toggleSorting(!1),children:[s(Ut,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),T(_,{onClick:()=>a.column.toggleSorting(!0),children:[s($t,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),T(_,{onClick:()=>a.column.clearSorting(),disabled:!a.column.getIsSorted(),children:[s(En,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),s(K,{})]}),j&&!Ze&&T(To,{children:[s($,{children:"Pin Column"}),T(_,{onClick:()=>oo(a.column.id,"right"),disabled:a.column.getIsPinned()==="right",children:[s(jn,{}),"Pin Right"]}),T(_,{onClick:()=>oo(a.column.id,!1),disabled:!a.column.getIsPinned(),children:[s(Un,{}),"Unpin"]})]})]})]})]}),eo&&a.column.getCanResize()&&!u&&a.colSpan===1&&s("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:a.getResizeHandler()})]},a.id)})},i.id)),Pt=i=>{if(!V)return;let p=0,a=N.getLeftHeaderGroups()[0]?.headers||[],f=[...le?["serialNumber"]:[],...G?["select"]:[]];for(let u of a){if(u.id===i.id)break;if(f.includes(u.id)){let x=N.getColumn(u.id);x&&(p+=x.getSize())}}return p},Dt=i=>{if(!V)return;let p=N.getState().columnPinning.right||[],a=p.indexOf(i.id);if(a===-1)return;let f=0;for(let u=a+1;u<p.length;u++){let x=N.getColumn(p[u]);x&&(f+=x.getSize())}return f};if(k)return s(Mt,{className:"w-full shadow-sm rounded-xl",children:s(zt,{className:"flex items-center justify-center",children:T("div",{className:"text-center",children:[s("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),s("p",{className:"mb-4 text-sm text-muted-foreground",children:k}),ee&&T(C,{variant:"outline",size:"sm",onClick:ee,className:"rounded-lg",children:[s(No,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let en=i=>i&&typeof i=="object"&&"content"in i,Y=pt(()=>c?en(c)?{content:c.content,align:c.align||"left",className:c.className||"",sticky:c.sticky!==void 0?c.sticky:!0,showOnEmpty:c.showOnEmpty!==void 0?c.showOnEmpty:!0}:{content:c,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[c]),Tt=()=>Be?s(Et,{table:N,filters:r,globalFilter:ye,onGlobalFilterChange:Ve,enableGlobalFilter:Yt,onExport:se,onRefresh:ee,loading:D,enableColumnVisibility:wt,enableColumnPinning:V,data:Nt,onClearSorting:Ko,onClearFilters:Jo,onExternalSearch:Me,onCustomFilterChange:qo,aggregations:te,onAggregationChange:ze}):null,tn=()=>{let i=0;return ve==="above-header"&&(i+=Jt),Y&&(i+=Qt),ve==="below-header"&&(i+=Ao),i};return s(He,{children:T("div",{className:o("w-full space-y-2 flex flex-col h-full",I),children:[Be&&ve==="default"&&s("div",{ref:d,className:"relative z-40",children:Tt()}),s(Mt,{className:o("shadow-sm overflow-hidden py-0",Go&&"flex-1"),children:s(zt,{className:"h-full p-0",children:T("div",{className:"relative flex flex-col justify-between h-full",children:[D&&s("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:T("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[s(No,{className:"size-5 animate-spin text-primary"}),s("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),s("div",{ref:Je,className:o("relative overflow-auto border-b rounded-t-xl",N.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:v},children:T(kt,{className:o("w-full border-collapse relative",N.getRowModel().rows?.length===0&&"h-full"),children:[Be&&ve==="above-header"&&s("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:s(ie,{className:"hover:bg-transparent",children:s(me,{colSpan:we.length,className:"p-2 bg-sidebar border-b shadow-sm",children:s("div",{ref:g,children:Tt()})})})}),Y&&(Y.showOnEmpty||N.getRowModel().rows?.length>0)&&s("thead",{className:o("sticky bg-sidebar border-b",ht&&"shadow-sm"),style:{top:ve==="above-header"?`${Jt}px`:"0px",zIndex:35},children:s(ie,{className:"hover:bg-transparent",children:s(me,{colSpan:we.length,className:o("p-2 font-semibold text-foreground bg-sidebar",Ye?"py-2":"py-4",Y.className),children:s("div",{ref:z,className:o("flex items-center w-full",Y.align==="center"&&"justify-center",Y.align==="right"&&"justify-end",Y.align==="left"&&"justify-start"),children:typeof Y.content=="string"?s("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Y.content}):Y.content})})})}),Be&&ve==="below-header"&&s("thead",{className:o("sticky bg-sidebar border-b",ht&&"shadow-sm"),style:{top:Y?`${Qt}px`:"0px",zIndex:35},children:s(ie,{className:"hover:bg-transparent",children:s(me,{colSpan:we.length,className:"p-2 bg-sidebar",children:s("div",{ref:P,children:Tt()})})})}),!jo&&s(no,{className:o("sticky bg-sidebar",ht&&"shadow-sm"),style:{top:`${tn()}px`,zIndex:30},children:Zo()}),s(ao,{children:N.getRowModel().rows?.length?N.getRowModel().rows.map((i,p)=>s(ie,{"data-state":i.getIsSelected()&&"selected",className:o(Eo&&"hover:bg-muted/50",Oo&&p%2===0&&"bg-muted/20",i.getIsSelected()&&"bg-muted","border-b last:border-b-0",de==="single"&&"cursor-pointer"),onClick:()=>{de==="single"&&Xo(i)},children:i.getVisibleCells().map((a,f)=>{let u=V&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&G),x=V&&a.column.getIsPinned()==="right",w=a.column.id==="serialNumber",R=a.column.id==="select",j=w||R&&Qe;return s(me,{className:o(Ye?"py-2":"py-4",Zt&&f<i.getVisibleCells().length&&"border-r",u&&"sticky left-0 z-20 bg-sidebar/95",x&&"sticky right-0 z-20 bg-sidebar/95",w&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:a.column.getSize()!==150?a.column.getSize():"auto",minWidth:a.column.getSize()!==150?a.column.getSize():"auto",...u&&{left:w?0:R?le&&N.getColumn("serialNumber")?.getSize()||0:Pt(a.column)},...x&&{right:Dt(a.column)},...w&&{left:0}},children:jt(a.column.columnDef.cell,a.getContext())},a.id)})},i.id)):s(ie,{children:s(me,{colSpan:we.length,className:"h-32 text-center border-0",children:T("div",{className:"flex flex-col items-center gap-3",children:[s("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),s("p",{className:"font-medium text-muted-foreground",children:H})]})})})}),Qo()]})}),S&&s("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:s(kt,{children:s(Rt,{children:s(ie,{className:"bg-sidebar",children:s(me,{colSpan:we.length,className:"p-2",children:S})})})})})]})})}),s(Gt,{table:N,config:m}),E&&E(N)]})})}import{Separator as qn}from"radix-ui";import{jsx as Wn}from"react/jsx-runtime";function gt({className:e,orientation:t="horizontal",decorative:r=!0,...m}){return Wn(qn.Root,{"data-slot":"separator-root",decorative:r,orientation:t,className:o("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...m})}import{Loader as Xn,X as Kn}from"lucide-react";import{AnimatePresence as Jn,motion as Qn}from"framer-motion";import*as pe from"react";import*as So from"react-dom";import{jsx as B,jsxs as Ue}from"react/jsx-runtime";function Yn({table:e,visible:t,container:r,children:m,className:b,...c}){let[S,I]=pe.useState(!1);pe.useLayoutEffect(()=>{I(!0)},[]),pe.useEffect(()=>{function k(H){H.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[e]);let v=r??(S?globalThis.document?.body:null);if(!v||!e)return null;let D=t??e.getFilteredSelectedRowModel().rows.length>0;return So.createPortal(B(Jn,{children:D&&B(Qn.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:o("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",b),...c,children:B(He,{children:m})})}),v)}function Zn({size:e="sm",tooltip:t,isPending:r,disabled:m,className:b,children:c,...S}){let I=B(C,{variant:"secondary",size:e,className:o("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",b),disabled:m||r,...S,children:r?B(Xn,{className:"animate-spin"}):c});return t?Ue(It,{children:[B(Ft,{asChild:!0,children:I}),B(_t,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:B("p",{children:t})})]}):I}function ea({table:e}){let t=pe.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Ue("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Ue("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),B(gt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Ue(It,{children:[B(Ft,{asChild:!0,children:B(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:B(Kn,{className:"size-3.5"})})}),Ue(_t,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[B("p",{children:"Clear selection"}),B("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:B("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as $e,EyeOff as ta}from"lucide-react";import{jsx as Z,jsxs as ke}from"react/jsx-runtime";function oa({column:e,title:t,className:r}){return e.getCanSort()?Z("div",{className:o("flex items-center space-x-2",r),children:ke(oe,{children:[Z(ne,{asChild:!0,children:ke(C,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[Z("span",{children:t}),e.getIsSorted()==="desc"?Z($e,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?Z($e,{className:"ml-2 h-4 w-4"}):Z($e,{className:"ml-2 h-4 w-4"})]})}),ke(ae,{align:"start",className:"rounded-lg",children:[ke(_,{onClick:()=>e.toggleSorting(!1),children:[Z($e,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),ke(_,{onClick:()=>e.toggleSorting(!0),children:[Z($e,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),Z(K,{}),ke(_,{onClick:()=>e.toggleVisibility(!1),children:[Z(ta,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):Z("div",{className:o(r),children:t})}import{ChevronDown as na,Eye as aa}from"lucide-react";import{jsx as Re,jsxs as qt}from"react/jsx-runtime";function ra({table:e}){return qt(oe,{children:[Re(ne,{asChild:!0,children:qt(C,{variant:"outline",size:"sm",className:"rounded-lg",children:[Re(aa,{className:"mr-2 h-4 w-4"}),"Columns ",Re(na,{className:"ml-2 h-4 w-4"})]})}),qt(ae,{align:"end",className:"w-[200px] rounded-lg",children:[Re($,{children:"Toggle Columns"}),Re(K,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>Re(Te,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:r=>t.toggleVisibility(!!r),children:t.id},t.id))]})]})}import{Slot as ia}from"radix-ui";import{cva as sa}from"class-variance-authority";import{jsx as da}from"react/jsx-runtime";var la=sa("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-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 transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ft({className:e,variant:t,asChild:r=!1,...m}){let b=r?ia.Slot:"span";return da(b,{"data-slot":"badge",className:o(la({variant:t}),e),...m})}import{Command as he}from"cmdk";import{SearchIcon as ca}from"lucide-react";import{Dialog as Ii}from"radix-ui";import{XIcon as _i}from"lucide-react";import{jsx as Bi,jsxs as Hi}from"react/jsx-runtime";import{jsx as ge,jsxs as ma}from"react/jsx-runtime";function ko({className:e,...t}){return ge(he,{"data-slot":"command",className:o("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function Ro({className:e,...t}){return ma("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[ge(ca,{className:"size-4 shrink-0 opacity-50"}),ge(he.Input,{"data-slot":"command-input",className:o("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Mo({className:e,...t}){return ge(he.List,{"data-slot":"command-list",className:o("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function zo({...e}){return ge(he.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Wt({className:e,...t}){return ge(he.Group,{"data-slot":"command-group",className:o("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Io({className:e,...t}){return ge(he.Separator,{"data-slot":"command-separator",className:o("bg-border -mx-1 h-px",e),...t})}function Xt({className:e,...t}){return ge(he.Item,{"data-slot":"command-item",className:o("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}import{CheckIcon as ua,PlusCircleIcon as pa}from"lucide-react";import{Fragment as Fo,jsx as M,jsxs as fe}from"react/jsx-runtime";function ga({column:e,title:t,options:r}){let m=e?.getFacetedUniqueValues(),b=new Set(e?.getFilterValue());return fe(st,{children:[M(lt,{asChild:!0,children:fe(C,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[M(pa,{className:"mr-2 h-4 w-4"}),t,b?.size>0&&fe(Fo,{children:[M(gt,{orientation:"vertical",className:"mx-2 h-4"}),M(ft,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:b.size}),M("div",{className:"hidden space-x-1 lg:flex",children:b.size>2?fe(ft,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[b.size," selected"]}):r.filter(c=>b.has(c.value)).map(c=>M(ft,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),M(dt,{className:"w-[200px] p-0 rounded-lg",align:"start",children:fe(ko,{className:"rounded-lg",children:[M(Ro,{placeholder:t}),fe(Mo,{children:[M(zo,{children:"No results found."}),M(Wt,{children:r.map(c=>{let S=b.has(c.value);return fe(Xt,{onSelect:()=>{S?b.delete(c.value):b.add(c.value);let I=Array.from(b);e?.setFilterValue(I.length?I:void 0)},children:[M("div",{className:o("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",S?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M(ua,{className:o("h-4 w-4")})}),c.icon&&M(c.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M("span",{children:c.label}),m?.get(c.value)&&M("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:m.get(c.value)})]},c.value)})}),b.size>0&&fe(Fo,{children:[M(Io,{}),M(Wt,{children:M(Xt,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{$n as DataTable,Yn as DataTableActionBar,Zn as DataTableActionBarAction,ea as DataTableActionBarSelection,oa as DataTableColumnHeader,ga as DataTableFacetedFilter,Gt as DataTablePagination,Et as DataTableToolbar,ra as DataTableViewOptions};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|