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