@akshar-technosoft/ui 1.0.2 → 1.0.3

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