@tirth_jasoliya/ui 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/data-table/data-table.cjs +1 -1
- package/dist/components/data/data-table/data-table.cjs.map +1 -1
- package/dist/components/data/data-table/data-table.js +1 -1
- package/dist/components/data/data-table/data-table.js.map +1 -1
- package/dist/components/data/data-table/index.cjs +1 -1
- package/dist/components/data/data-table/index.cjs.map +1 -1
- package/dist/components/data/data-table/index.js +1 -1
- package/dist/components/data/data-table/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/package.json +72 -65
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
"use strict";var fo=Object.create;var xe=Object.defineProperty;var bo=Object.getOwnPropertyDescriptor;var vo=Object.getOwnPropertyNames;var Co=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty;var ho=(e,t)=>{for(var i in t)xe(e,i,{get:t[i],enumerable:!0})},pt=(e,t,i,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of vo(t))!xo.call(e,c)&&c!==i&&xe(e,c,{get:()=>t[c],enumerable:!(d=bo(t,c))||d.enumerable});return e};var ut=(e,t,i)=>(i=e!=null?fo(Co(e)):{},pt(t||!e||!e.__esModule?xe(i,"default",{value:e,enumerable:!0}):i,e)),wo=e=>pt(xe({},"__esModule",{value:!0}),e);var ko={};ho(ko,{DataTable:()=>kt,DataTableActionBar:()=>Vt,DataTableActionBarAction:()=>_t,DataTableActionBarSelection:()=>Ft,DataTableColumnHeader:()=>Bt,DataTableFacetedFilter:()=>Qt,DataTablePagination:()=>ke,DataTableToolbar:()=>Re,DataTableViewOptions:()=>At});module.exports=wo(ko);var k=require("@tanstack/react-table"),w=require("lucide-react");var bt=require("radix-ui"),vt=require("class-variance-authority");var gt=require("clsx"),ft=require("tailwind-merge");function a(...e){return(0,ft.twMerge)((0,gt.clsx)(e))}var Ct=require("react/jsx-runtime"),yo=(0,vt.cva)("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 b({className:e,variant:t,size:i,asChild:d=!1,...c}){let p=d?bt.Slot.Slot:"button";return(0,Ct.jsx)(p,{"data-slot":"button",className:a(yo({variant:t,size:i,className:e}),"transition-none"),...c})}var O=require("react/jsx-runtime");function We({className:e,...t}){return(0,O.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:(0,O.jsx)("table",{"data-slot":"table",className:a("w-full caption-bottom text-sm",e),...t})})}function xt({className:e,...t}){return(0,O.jsx)("thead",{"data-slot":"table-header",className:a("[&_tr]:border-b",e),...t})}function ht({className:e,...t}){return(0,O.jsx)("tbody",{"data-slot":"table-body",className:a("[&_tr:last-child]:border-0",e),...t})}function wt({className:e,...t}){return(0,O.jsx)("tfoot",{"data-slot":"table-footer",className:a("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function me({className:e,...t}){return(0,O.jsx)("tr",{"data-slot":"table-row",className:a("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function yt({className:e,...t}){return(0,O.jsx)("th",{"data-slot":"table-head",className:a("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function he({className:e,...t}){return(0,O.jsx)("td",{"data-slot":"table-cell",className:a("p-2 align-middle whitespace-nowrap",e),...t})}var $e=require("react/jsx-runtime");function we({className:e,...t}){return(0,$e.jsx)("div",{"data-slot":"card",className:a("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(0,$e.jsx)("div",{"data-slot":"card-content",className:a("px-6",e),...t})}var Z=require("radix-ui");var E=require("react/jsx-runtime");function ce({delayDuration:e=0,...t}){return(0,E.jsx)(Z.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function qe({...e}){return(0,E.jsx)(ce,{children:(0,E.jsx)(Z.Tooltip.Root,{"data-slot":"tooltip",...e})})}function Ke({...e}){return(0,E.jsx)(Z.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function Xe({className:e,sideOffset:t=0,children:i,...d}){return(0,E.jsx)(Z.Tooltip.Portal,{children:(0,E.jsxs)(Z.Tooltip.Content,{"data-slot":"tooltip-content",sideOffset:t,className:a("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),...d,children:[i,(0,E.jsx)(Z.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var h=require("lucide-react");var Pt=require("react/jsx-runtime");function Je({className:e,type:t,...i}){return(0,Pt.jsx)("input",{type:t,"data-slot":"input",className:a("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),...i})}var M=require("radix-ui"),ee=require("lucide-react");var x=require("react/jsx-runtime");function Pe({...e}){return(0,x.jsx)(M.Select.Root,{"data-slot":"select",...e})}function De({...e}){return(0,x.jsx)(M.Select.Value,{"data-slot":"select-value",...e})}function Ne({className:e,size:t="default",children:i,...d}){return(0,x.jsxs)(M.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:a("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),...d,children:[i,(0,x.jsx)(M.Select.Icon,{asChild:!0,children:(0,x.jsx)(ee.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function Te({className:e,children:t,position:i="popper",...d}){return(0,x.jsx)(M.Select.Portal,{children:(0,x.jsxs)(M.Select.Content,{"data-slot":"select-content",className:a("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",i==="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:i,...d,children:[(0,x.jsx)(Po,{}),(0,x.jsx)(M.Select.Viewport,{className:a("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,x.jsx)(Do,{})]})})}function pe({className:e,children:t,...i}){return(0,x.jsxs)(M.Select.Item,{"data-slot":"select-item",className:a("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),...i,children:[(0,x.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,x.jsx)(M.Select.ItemIndicator,{children:(0,x.jsx)(ee.CheckIcon,{className:"size-4"})})}),(0,x.jsx)(M.Select.ItemText,{children:t})]})}function Po({className:e,...t}){return(0,x.jsx)(M.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,x.jsx)(ee.ChevronUpIcon,{className:"size-4"})})}function Do({className:e,...t}){return(0,x.jsx)(M.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,x.jsx)(ee.ChevronDownIcon,{className:"size-4"})})}var B=require("radix-ui"),Se=require("lucide-react");var R=require("react/jsx-runtime");function U({...e}){return(0,R.jsx)(B.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function j({...e}){return(0,R.jsx)(B.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function W({className:e,sideOffset:t=4,...i}){return(0,R.jsx)(B.DropdownMenu.Portal,{children:(0,R.jsx)(B.DropdownMenu.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:a("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),...i})})}function Qe({...e}){return(0,R.jsx)(B.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function T({className:e,inset:t,variant:i="default",...d}){return(0,R.jsx)(B.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":i,className:a("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),...d})}function ue({className:e,children:t,checked:i,...d}){return(0,R.jsxs)(B.DropdownMenu.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:a("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:i,...d,children:[(0,R.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,R.jsx)(B.DropdownMenu.ItemIndicator,{children:(0,R.jsx)(Se.CheckIcon,{className:"size-4"})})}),t]})}function A({className:e,inset:t,...i}){return(0,R.jsx)(B.DropdownMenu.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...i})}function L({className:e,...t}){return(0,R.jsx)(B.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t})}var r=require("react/jsx-runtime");function Re({table:e,filters:t=[],globalFilter:i,onGlobalFilterChange:d,enableGlobalFilter:c=!0,onExport:p,onRefresh:I,loading:V=!1,enableColumnVisibility:re=!0,data:te,onClearSorting:X,onClearFilters:ie,enableColumnPinning:se=!1}){let le=()=>e.getAllLeafColumns().filter(s=>s.getCanHide?.()!==!1),oe=()=>e.getAllColumns().filter(s=>!e.getAllLeafColumns().includes(s)&&s.columns?.length&&s.columns.some(m=>m.getCanHide?.()!==!1)),ae=()=>{let s=new Set(oe().flatMap(m=>m.columns?.filter(F=>F.getCanHide?.()!==!1).map(F=>F.id)||[]));return le().filter(m=>!s.has(m.id))},de=(s,m)=>m&&s.startsWith(`${m}.`)?s.replace(`${m}.`,"").split("_").map(be=>be.slice(1)).join(" "):s.split("_").map(F=>F.charAt(0).toUpperCase()+F.slice(1)).join(" ");return(0,r.jsx)("div",{className:"rounded-xl",children:(0,r.jsx)("div",{className:"px-2",children:(0,r.jsx)("div",{className:"flex flex-col gap-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,r.jsx)(h.Filter,{className:"h-4 w-4"})}),t.map(s=>(0,r.jsx)("div",{className:a("relative min-w-[150px]",s.width),children:s.type==="select"?(0,r.jsxs)(Pe,{value:e.getColumn(s.key)?.getFilterValue()??"",onValueChange:m=>e.getColumn(s.key)?.setFilterValue(m==="all"?"":m),children:[s.icon&&(0,r.jsx)("span",{children:(0,r.jsx)(s.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,r.jsx)(Ne,{className:a("h-9 rounded-lg w-full",s.icon&&"pl-9"),children:(0,r.jsx)(De,{placeholder:s.placeholder})}),(0,r.jsxs)(Te,{className:"rounded-lg",children:[(0,r.jsx)(pe,{value:"all",children:"All"}),s.options?.map(m=>(0,r.jsx)(pe,{value:m.value,children:m.label},m.label))]})]}):(0,r.jsxs)("div",{className:"relative",children:[s.icon&&(0,r.jsx)("span",{children:(0,r.jsx)(s.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,r.jsx)(Je,{placeholder:s.placeholder,value:e.getColumn(s.key)?.getFilterValue()??"",onChange:m=>e.getColumn(s.key)?.setFilterValue(m.target.value),className:a("h-9 rounded-lg",s.icon&&"pl-9"),type:s.type==="number"?"number":s.type==="date"?"date":"text"})]})},s.key))]})}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[c&&(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(h.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,r.jsx)(Je,{placeholder:"Global search...",value:i??"",onChange:s=>d(s.target.value),className:"pl-9 max-w-max"})]}),p&&(0,r.jsxs)(b,{variant:"outline",size:"sm",onClick:()=>p(te),className:"rounded-lg",children:[(0,r.jsx)(h.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),re&&(0,r.jsxs)(U,{children:[(0,r.jsx)(j,{asChild:!0,children:(0,r.jsxs)(b,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,r.jsx)("span",{children:"Columns"}),(0,r.jsx)(h.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,r.jsxs)(W,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,r.jsx)(A,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,r.jsx)(L,{}),ae().length>0&&(0,r.jsxs)(Qe,{children:[(0,r.jsx)(A,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),ae().map(s=>(0,r.jsx)(ue,{className:"text-sm",checked:s.getIsVisible(),onCheckedChange:m=>s.toggleVisibility(!!m),children:de(s.id)},s.id))]}),oe().map(s=>(0,r.jsxs)(Qe,{children:[(0,r.jsx)(L,{}),(0,r.jsx)(A,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:s.id}),s.columns?.filter(m=>m.getCanHide?.()!==!1).map(m=>(0,r.jsx)(ue,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:F=>m.toggleVisibility(!!F),children:de(m.id,s.id)},m.id))]},s.id))]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(j,{asChild:!0,children:(0,r.jsx)(b,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,r.jsx)(h.Settings2,{className:"h-4 w-4"})})}),(0,r.jsxs)(W,{align:"end",className:"w-[200px] rounded-lg",children:[(0,r.jsx)(A,{children:"Table Settings"}),(0,r.jsx)(L,{}),(0,r.jsxs)(T,{onClick:X,children:[(0,r.jsx)(h.ArrowUpDown,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),(0,r.jsxs)(T,{onClick:ie,children:[(0,r.jsx)(h.Filter,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),se&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L,{}),(0,r.jsx)(A,{children:"Column Pinning"}),(0,r.jsxs)(T,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,r.jsx)(h.PinOff,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),(0,r.jsxs)(T,{onClick:()=>{let s=le().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:s,right:[]})},children:[(0,r.jsx)(h.Pin,{className:"mr-2 h-4 w-4 rotate-90"}),"Pin All Left"]}),(0,r.jsxs)(T,{onClick:()=>{let s=le().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:[],right:s})},children:[(0,r.jsx)(h.Pin,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),I&&(0,r.jsx)(b,{variant:"outline",size:"sm",onClick:I,disabled:V,className:"rounded-lg",children:(0,r.jsx)(h.RefreshCw,{className:a("h-4 w-4",V&&"animate-spin")})})]})]})})})})}var v=require("react/jsx-runtime");function ke({table:e,config:t}){return t.enabled?(0,v.jsx)("div",{className:"rounded-xl",children:(0,v.jsx)("div",{children:(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,v.jsxs)("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"]})}),(0,v.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,v.jsxs)(Pe,{value:`${e.getState().pagination.pageSize}`,onValueChange:i=>e.setPageSize(Number(i)),children:[(0,v.jsx)(Ne,{className:"h-9 w-[70px] rounded-lg",children:(0,v.jsx)(De,{})}),(0,v.jsx)(Te,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(i=>(0,v.jsx)(pe,{value:`${i}`,children:i},i))})]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,v.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(i,d)=>{let c=e.getState().pagination.pageIndex,p=c-2+d+1;return p<1||p>e.getPageCount()?null:(0,v.jsx)(b,{variant:p===c+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(p-1),children:p},p)})}),(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Dt=require("radix-ui"),Nt=require("class-variance-authority");var St=require("react/jsx-runtime"),No=(0,Nt.cva)("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 Tt({className:e,variant:t,size:i,noBg:d,...c}){return(0,St.jsx)(Dt.Toggle.Root,{"data-slot":"toggle",className:a(No({className:e,variant:t,size:i,bg:d?"disabled":"enabled"})),...c})}var Ye=require("radix-ui"),Rt=require("lucide-react");var ze=require("react/jsx-runtime");function Ze({className:e,...t}){return(0,ze.jsx)(Ye.Checkbox.Root,{"data-slot":"checkbox",className:a("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:(0,ze.jsx)(Ye.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,ze.jsx)(Rt.CheckIcon,{className:"size-3.5"})})})}var S=require("react"),o=require("react/jsx-runtime");function kt({data:e,columns:t,filters:i=[],pagination:d={enabled:!1},settings:c={},header:p,footer:I,className:V="",maxHeight:re="600px",loading:te=!1,error:X,emptyMessage:ie="No data available",onRowSelectionChange:se,onExport:le,onRefresh:oe,onTableReady:ae,children:de}){let[s,m]=(0,S.useState)([]),[F,be]=(0,S.useState)([]),[Yt,Zt]=(0,S.useState)({}),[ot,eo]=(0,S.useState)({}),[at,Ae]=(0,S.useState)(""),[to,oo]=(0,S.useState)([]),[Le,ao]=(0,S.useState)(c.enableColumnPinning?{left:[],right:[]}:{}),{enableSorting:Ge=!0,enableFiltering:He=!0,enableGlobalFilter:nt=!0,enableColumnVisibility:Oe=!0,enableRowSelection:_=!0,stickyHeader:no=!0,toolbar:ro=!1,showSerialNumbers:J=!0,fixedCheckboxColumn:ve=!0,striped:io=!0,hoverable:so=!0,compact:rt=!0,bordered:it=!0,fullHeight:lo=!1,enableColumnResizing:st=!1,enableColumnPinning:z=!0,hideHeader:mo=!1}=c,Ee=(0,S.useMemo)(()=>{let f=[...t],P=g=>g.map(l=>{if(l.id==="select"||l.id==="serialNumber")return l;let D={...l,enablePinning:!0};return l.columns&&(D.columns=P(l.columns)),D}),n=P(f);if(_){let g={id:"select",header:({table:l})=>(0,o.jsx)(Ze,{checked:l.getIsAllPageRowsSelected()||l.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:D=>l.toggleAllPageRowsSelected(!!D),"aria-label":"Select all"}),cell:({row:l})=>(0,o.jsx)("div",{className:a("flex items-center justify-center"),children:(0,o.jsx)(Ze,{checked:l.getIsSelected(),onCheckedChange:D=>l.toggleSelected(!!D),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:10};n.unshift(g)}if(J){let g={id:"serialNumber",header:"No.",cell:({row:l})=>(0,o.jsx)("div",{className:"text-center font-medium text-muted-foreground",children:l.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};n.unshift(g)}return n},[t,J,_,ve]),N=(0,k.useReactTable)({data:e,columns:Ee,onSortingChange:Ge?m:void 0,onColumnFiltersChange:He?be:void 0,onGlobalFilterChange:nt?Ae:void 0,getCoreRowModel:(0,k.getCoreRowModel)(),getPaginationRowModel:d.enabled?(0,k.getPaginationRowModel)():void 0,getSortedRowModel:Ge?(0,k.getSortedRowModel)():void 0,getFilteredRowModel:He?(0,k.getFilteredRowModel)():void 0,onColumnVisibilityChange:Oe?Zt:void 0,onRowSelectionChange:_?eo:void 0,onColumnOrderChange:oo,onColumnPinningChange:z?ao:void 0,state:{sorting:Ge?s:void 0,columnFilters:He?F:void 0,columnVisibility:Oe?Yt:void 0,rowSelection:_?ot:{},globalFilter:at,columnOrder:to,columnPinning:z?Le:{}},initialState:{pagination:d.enabled?{pageSize:d.pageSize||10}:void 0,columnPinning:z?{left:[...J?["serialNumber"]:[],..._?["select"]:[]],right:[]}:void 0},enableRowSelection:_,enableColumnResizing:st,enableColumnPinning:z,columnResizeMode:"onChange"});(0,S.useEffect)(()=>{ae&&ae(N)},[N,ae]),(0,S.useEffect)(()=>{if(_&&se){let f=N.getFilteredSelectedRowModel().rows.map(P=>P.original);se(f)}},[ot,_,se,N]);let co=(0,S.useCallback)(()=>{m([])},[]),po=(0,S.useCallback)(()=>{be([]),Ae("")},[]),lt=(f,P)=>{if(!z)return;let n=[...J?["serialNumber"]:[],..._&&ve?["select"]:[]],g={left:[...(Le.left??[]).filter(l=>n.includes(l))],right:[...Le.right??[]]};P===!1?(g.left=g.left.filter(l=>l!==f),g.right=g.right.filter(l=>l!==f)):P==="right"?(g.left=g.left.filter(l=>l!==f),g.right.includes(f)||g.right.push(f)):P==="left"&&(g.right=g.right.filter(l=>l!==f),!g.left.includes(f)&&!n.includes(f)&&g.left.push(f)),N.setColumnPinning(g)},uo=()=>(0,o.jsx)(xt,{className:a(no&&"sticky top-0 bg-sidebar z-20"),children:N.getHeaderGroups().map((f,P)=>(0,o.jsx)(me,{className:"hover:bg-transparent",children:f.headers.map((n,g)=>{let l=n.depth===0&&n.colSpan>1,D=z&&(n.column.getIsPinned()==="left"||n.column.id==="serialNumber"||n.column.id==="select"&&_),Q=z&&n.column.getIsPinned()==="right",Y=n.column.getCanSort(),Ue=z&&n.column.columnDef.enablePinning!==!1,Ce=n.column.id==="serialNumber",je=n.column.id==="select",ct=Ce||je&&ve,ne=n.column.columnDef.headerAlign||"left",go={left:"justify-start",center:"justify-center",right:"justify-end"}[ne];return(0,o.jsxs)(yt,{colSpan:n.colSpan,className:a("font-semibold text-foreground bg-sidebar group px-0",!rt&&"py-2",it&&g<f.headers.length-1&&"border-r","relative",D&&"sticky left-0 z-15 bg-sidebar",Q&&"sticky right-0 z-15 bg-sidebar",(Ce||je)&&"sticky left-0 z-15 bg-sidebar",l?"text-center":"text-left"),style:{width:n.getSize()!==150?n.getSize():"auto",minWidth:n.getSize()!==150?n.getSize():"auto",...D&&{left:Ce?0:je?J&&N.getColumn("serialNumber")?.getSize()||0:dt(n.column)},...Q&&{right:mt(n.column)},...Ce&&{left:0}},children:[l?(0,o.jsx)("div",{className:"flex items-center justify-center",children:(0,k.flexRender)(n.column.columnDef.header,n.getContext())}):(0,o.jsxs)("div",{className:a("relative flex items-center w-full px-2",go),children:[(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[Y&&ne==="right"&&(0,o.jsx)("span",{className:"ml-1 order-2",children:n.column.getIsSorted()&&{asc:(0,o.jsx)(w.ChevronUp,{className:"h-4 w-4"}),desc:(0,o.jsx)(w.ChevronDown,{className:"h-4 w-4"})}[n.column.getIsSorted()]}),n.isPlaceholder?null:(0,k.flexRender)(n.column.columnDef.header,n.getContext()),Y&&ne!=="right"&&n.column.getIsSorted()&&(0,o.jsx)("span",{className:"ml-1 order-2",children:n.column.getIsSorted()&&{asc:(0,o.jsx)(w.ChevronUp,{className:"h-4 w-4"}),desc:(0,o.jsx)(w.ChevronDown,{className:"h-4 w-4"})}[n.column.getIsSorted()]})]}),(Y||Ue&&!ct)&&(0,o.jsxs)(U,{children:[(0,o.jsx)(j,{asChild:!0,className:a("absolute",ne==="left"&&"right-1",ne==="center"&&"right-1",ne==="right"&&"left-1"),children:(0,o.jsx)(Tt,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:(0,o.jsx)(w.MoreHorizontal,{className:"h-4 w-4"})})}),(0,o.jsxs)(W,{align:"end",className:"w-48",children:[Y&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(A,{children:"Sorting"}),(0,o.jsxs)(T,{onClick:()=>n.column.toggleSorting(!1),children:[(0,o.jsx)(w.ChevronUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),(0,o.jsxs)(T,{onClick:()=>n.column.toggleSorting(!0),children:[(0,o.jsx)(w.ChevronDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),(0,o.jsxs)(T,{onClick:()=>n.column.clearSorting(),disabled:!n.column.getIsSorted(),children:[(0,o.jsx)(w.ChevronsUpDown,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),(0,o.jsx)(L,{})]}),Ue&&!ct&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(A,{children:"Pin Column"}),(0,o.jsxs)(T,{onClick:()=>lt(n.column.id,"right"),disabled:n.column.getIsPinned()==="right",children:[(0,o.jsx)(w.MoveRightIcon,{}),"Pin Right"]}),(0,o.jsxs)(T,{onClick:()=>lt(n.column.id,!1),disabled:!n.column.getIsPinned(),children:[(0,o.jsx)(w.PinOffIcon,{}),"Unpin"]})]})]})]})]}),st&&n.column.getCanResize()&&!l&&n.colSpan===1&&(0,o.jsx)("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))}),dt=f=>{if(!z)return;let P=0,n=N.getLeftHeaderGroups()[0]?.headers||[],g=[...J?["serialNumber"]:[],..._?["select"]:[]];for(let l of n){if(l.id===f.id)break;if(g.includes(l.id)){let D=N.getColumn(l.id);D&&(P+=D.getSize())}}return P},mt=f=>{if(!z)return;let P=N.getState().columnPinning.right||[],n=P.indexOf(f.id);if(n===-1)return;let g=0;for(let l=n+1;l<P.length;l++){let D=N.getColumn(P[l]);D&&(g+=D.getSize())}return g};return X?(0,o.jsx)(we,{className:"w-full rounded-xl shadow-sm",children:(0,o.jsx)(ye,{className:"flex items-center justify-center",children:(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:X}),oe&&(0,o.jsxs)(b,{variant:"outline",size:"sm",onClick:oe,className:"rounded-lg",children:[(0,o.jsx)(w.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,o.jsx)(ce,{children:(0,o.jsxs)("div",{className:a("w-full space-y-2 flex flex-col h-full",V),children:[p&&(0,o.jsx)(we,{className:"rounded-2xl py-2 sticky top-0 z-20",children:(0,o.jsx)(ye,{className:"px-2",children:p})}),ro&&(0,o.jsx)(Re,{table:N,filters:i,globalFilter:at,onGlobalFilterChange:Ae,enableGlobalFilter:nt,onExport:le,onRefresh:oe,loading:te,enableColumnVisibility:Oe,enableColumnPinning:z,data:e,onClearSorting:co,onClearFilters:po}),(0,o.jsx)(we,{className:a("shadow-sm overflow-auto py-0",lo&&"flex-1"),children:(0,o.jsx)(ye,{className:"p-0 h-full",children:(0,o.jsxs)("div",{className:"relative flex flex-col h-full justify-between",children:[te&&(0,o.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,o.jsx)(w.Loader2,{className:"size-5 animate-spin text-primary"}),(0,o.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),(0,o.jsx)("div",{className:"relative rounded-t-xl overflow-auto border-b",children:(0,o.jsxs)(We,{className:"border-collapse w-full",children:[!mo&&uo(),(0,o.jsx)(ht,{children:N.getRowModel().rows?.length?N.getRowModel().rows.map((f,P)=>(0,o.jsx)(me,{"data-state":f.getIsSelected()&&"selected",className:a(so&&"hover:bg-muted/50",io&&P%2===0&&"bg-muted/20",f.getIsSelected()&&"bg-muted","border-b last:border-b-0"),children:f.getVisibleCells().map((n,g)=>{let l=z&&(n.column.getIsPinned()==="left"||n.column.id==="serialNumber"||n.column.id==="select"&&_),D=z&&n.column.getIsPinned()==="right",Q=n.column.id==="serialNumber",Y=n.column.id==="select",Ue=Q||Y&&ve;return(0,o.jsx)(he,{className:a(rt?"py-2":"py-4",it&&g<f.getVisibleCells().length&&"border-r",l&&"sticky left-0 z-10 bg-sidebar/97",D&&"sticky right-0 z-10 bg-sidebar/97",Q&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:n.column.getSize()!==150?n.column.getSize():"auto",minWidth:n.column.getSize()!==150?n.column.getSize():"auto",...l&&{left:Q?0:Y?J&&N.getColumn("serialNumber")?.getSize()||0:dt(n.column)},...D&&{right:mt(n.column)},...Q&&{left:0}},children:(0,k.flexRender)(n.column.columnDef.cell,n.getContext())},n.id)})},f.id)):(0,o.jsx)(me,{children:(0,o.jsx)(he,{colSpan:Ee.length,className:"h-32 text-center border-0",children:(0,o.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,o.jsx)("div",{className:"text-muted-foreground text-5xl",children:"\u{1F4CB}"}),(0,o.jsx)("p",{className:"text-muted-foreground font-medium",children:ie})]})})})})]})}),I&&(0,o.jsx)("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:(0,o.jsx)(We,{children:(0,o.jsx)(wt,{children:(0,o.jsx)(me,{className:"bg-sidebar",children:(0,o.jsx)(he,{colSpan:Ee.length,className:"p-2",children:I})})})})})]})})}),(0,o.jsx)(ke,{table:N,config:d}),de&&de(N)]})})}var zt=require("radix-ui");var Mt=require("react/jsx-runtime");function Me({className:e,orientation:t="horizontal",decorative:i=!0,...d}){return(0,Mt.jsx)(zt.Separator.Root,{"data-slot":"separator-root",decorative:i,orientation:t,className:a("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),...d})}var Ie=require("lucide-react"),Ve=require("framer-motion"),$=ut(require("react"),1),It=ut(require("react-dom"),1),C=require("react/jsx-runtime");function Vt({table:e,visible:t,container:i,children:d,className:c,...p}){let[I,V]=$.useState(!1);$.useLayoutEffect(()=>{V(!0)},[]),$.useEffect(()=>{function X(ie){ie.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[e]);let re=i??(I?globalThis.document?.body:null);if(!re||!e)return null;let te=t??e.getFilteredSelectedRowModel().rows.length>0;return It.createPortal((0,C.jsx)(Ve.AnimatePresence,{children:te&&(0,C.jsx)(Ve.motion.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:a("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",c),...p,children:(0,C.jsxs)(ce,{children:["1",d]})})}),re)}function _t({size:e="sm",tooltip:t,isPending:i,disabled:d,className:c,children:p,...I}){let V=(0,C.jsx)(b,{variant:"secondary",size:e,className:a("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",c),disabled:d||i,...I,children:i?(0,C.jsx)(Ie.Loader,{className:"animate-spin"}):p});return t?(0,C.jsxs)(qe,{children:[(0,C.jsx)(Ke,{asChild:!0,children:V}),(0,C.jsx)(Xe,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,C.jsx)("p",{children:t})})]}):V}function Ft({table:e}){let t=$.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,C.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,C.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,C.jsx)(Me,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,C.jsxs)(qe,{children:[(0,C.jsx)(Ke,{asChild:!0,children:(0,C.jsx)(b,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,C.jsx)(Ie.X,{className:"size-3.5"})})}),(0,C.jsxs)(Xe,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[(0,C.jsx)("p",{children:"Clear selection"}),(0,C.jsx)("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:(0,C.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var q=require("lucide-react");var y=require("react/jsx-runtime");function Bt({column:e,title:t,className:i}){return e.getCanSort()?(0,y.jsx)("div",{className:a("flex items-center space-x-2",i),children:(0,y.jsxs)(U,{children:[(0,y.jsx)(j,{asChild:!0,children:(0,y.jsxs)(b,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[(0,y.jsx)("span",{children:t}),e.getIsSorted()==="desc"?(0,y.jsx)(q.ArrowUpDown,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?(0,y.jsx)(q.ArrowUpDown,{className:"ml-2 h-4 w-4"}):(0,y.jsx)(q.ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),(0,y.jsxs)(W,{align:"start",className:"rounded-lg",children:[(0,y.jsxs)(T,{onClick:()=>e.toggleSorting(!1),children:[(0,y.jsx)(q.ArrowUpDown,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),(0,y.jsxs)(T,{onClick:()=>e.toggleSorting(!0),children:[(0,y.jsx)(q.ArrowUpDown,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),(0,y.jsx)(L,{}),(0,y.jsxs)(T,{onClick:()=>e.toggleVisibility(!1),children:[(0,y.jsx)(q.EyeOff,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):(0,y.jsx)("div",{className:a(i),children:t})}var _e=require("lucide-react");var G=require("react/jsx-runtime");function At({table:e}){return(0,G.jsxs)(U,{children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(b,{variant:"outline",size:"sm",className:"rounded-lg",children:[(0,G.jsx)(_e.Eye,{className:"mr-2 h-4 w-4"}),"Columns ",(0,G.jsx)(_e.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),(0,G.jsxs)(W,{align:"end",className:"w-[200px] rounded-lg",children:[(0,G.jsx)(A,{children:"Toggle Columns"}),(0,G.jsx)(L,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>(0,G.jsx)(ue,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:i=>t.toggleVisibility(!!i),children:t.id},t.id))]})]})}var Lt=require("radix-ui"),Gt=require("class-variance-authority");var Ht=require("react/jsx-runtime"),To=(0,Gt.cva)("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 Fe({className:e,variant:t,asChild:i=!1,...d}){let c=i?Lt.Slot.Slot:"span";return(0,Ht.jsx)(c,{"data-slot":"badge",className:a(To({variant:t}),e),...d})}var K=require("cmdk"),Et=require("lucide-react");var So=require("radix-ui"),Ro=require("lucide-react");var Ot=require("react/jsx-runtime");var H=require("react/jsx-runtime");function Ut({className:e,...t}){return(0,H.jsx)(K.Command,{"data-slot":"command",className:a("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function jt({className:e,...t}){return(0,H.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,H.jsx)(Et.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),(0,H.jsx)(K.Command.Input,{"data-slot":"command-input",className:a("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(0,H.jsx)(K.Command.List,{"data-slot":"command-list",className:a("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function $t({...e}){return(0,H.jsx)(K.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function et({className:e,...t}){return(0,H.jsx)(K.Command.Group,{"data-slot":"command-group",className:a("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 qt({className:e,...t}){return(0,H.jsx)(K.Command.Separator,{"data-slot":"command-separator",className:a("bg-border -mx-1 h-px",e),...t})}function tt({className:e,...t}){return(0,H.jsx)(K.Command.Item,{"data-slot":"command-item",className:a("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})}var ge=require("radix-ui");var fe=require("react/jsx-runtime");function Kt({...e}){return(0,fe.jsx)(ge.Popover.Root,{"data-slot":"popover",...e})}function Xt({...e}){return(0,fe.jsx)(ge.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function Jt({className:e,align:t="center",sideOffset:i=4,...d}){return(0,fe.jsx)(ge.Popover.Portal,{children:(0,fe.jsx)(ge.Popover.Content,{"data-slot":"popover-content",align:t,sideOffset:i,className:a("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),...d})})}var Be=require("lucide-react"),u=require("react/jsx-runtime");function Qt({column:e,title:t,options:i}){let d=e?.getFacetedUniqueValues(),c=new Set(e?.getFilterValue());return(0,u.jsxs)(Kt,{children:[(0,u.jsx)(Xt,{asChild:!0,children:(0,u.jsxs)(b,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[(0,u.jsx)(Be.PlusCircleIcon,{className:"mr-2 h-4 w-4"}),t,c?.size>0&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Me,{orientation:"vertical",className:"mx-2 h-4"}),(0,u.jsx)(Fe,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:c.size}),(0,u.jsx)("div",{className:"hidden space-x-1 lg:flex",children:c.size>2?(0,u.jsxs)(Fe,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):i.filter(p=>c.has(p.value)).map(p=>(0,u.jsx)(Fe,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:p.label},p.value))})]})]})}),(0,u.jsx)(Jt,{className:"w-[200px] p-0 rounded-lg",align:"start",children:(0,u.jsxs)(Ut,{className:"rounded-lg",children:[(0,u.jsx)(jt,{placeholder:t}),(0,u.jsxs)(Wt,{children:[(0,u.jsx)($t,{children:"No results found."}),(0,u.jsx)(et,{children:i.map(p=>{let I=c.has(p.value);return(0,u.jsxs)(tt,{onSelect:()=>{I?c.delete(p.value):c.add(p.value);let V=Array.from(c);e?.setFilterValue(V.length?V:void 0)},children:[(0,u.jsx)("div",{className:a("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",I?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,u.jsx)(Be.CheckIcon,{className:a("h-4 w-4")})}),p.icon&&(0,u.jsx)(p.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),(0,u.jsx)("span",{children:p.label}),d?.get(p.value)&&(0,u.jsx)("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:d.get(p.value)})]},p.value)})}),c.size>0&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(qt,{}),(0,u.jsx)(et,{children:(0,u.jsx)(tt,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}0&&(module.exports={DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTableColumnHeader,DataTableFacetedFilter,DataTablePagination,DataTableToolbar,DataTableViewOptions});
|
|
2
|
+
"use strict";var fo=Object.create;var xe=Object.defineProperty;var bo=Object.getOwnPropertyDescriptor;var vo=Object.getOwnPropertyNames;var Co=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty;var ho=(e,t)=>{for(var i in t)xe(e,i,{get:t[i],enumerable:!0})},pt=(e,t,i,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of vo(t))!xo.call(e,c)&&c!==i&&xe(e,c,{get:()=>t[c],enumerable:!(d=bo(t,c))||d.enumerable});return e};var ut=(e,t,i)=>(i=e!=null?fo(Co(e)):{},pt(t||!e||!e.__esModule?xe(i,"default",{value:e,enumerable:!0}):i,e)),wo=e=>pt(xe({},"__esModule",{value:!0}),e);var ko={};ho(ko,{DataTable:()=>kt,DataTableActionBar:()=>Vt,DataTableActionBarAction:()=>_t,DataTableActionBarSelection:()=>Ft,DataTableColumnHeader:()=>Bt,DataTableFacetedFilter:()=>Qt,DataTablePagination:()=>ke,DataTableToolbar:()=>Re,DataTableViewOptions:()=>At});module.exports=wo(ko);var k=require("@tanstack/react-table"),w=require("lucide-react");var bt=require("radix-ui"),vt=require("class-variance-authority");var gt=require("clsx"),ft=require("tailwind-merge");function a(...e){return(0,ft.twMerge)((0,gt.clsx)(e))}var Ct=require("react/jsx-runtime"),yo=(0,vt.cva)("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 b({className:e,variant:t,size:i,asChild:d=!1,...c}){let p=d?bt.Slot.Slot:"button";return(0,Ct.jsx)(p,{"data-slot":"button",className:a(yo({variant:t,size:i,className:e}),"transition-none"),...c})}var O=require("react/jsx-runtime");function We({className:e,...t}){return(0,O.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:(0,O.jsx)("table",{"data-slot":"table",className:a("w-full caption-bottom text-sm",e),...t})})}function xt({className:e,...t}){return(0,O.jsx)("thead",{"data-slot":"table-header",className:a("[&_tr]:border-b",e),...t})}function ht({className:e,...t}){return(0,O.jsx)("tbody",{"data-slot":"table-body",className:a("[&_tr:last-child]:border-0",e),...t})}function wt({className:e,...t}){return(0,O.jsx)("tfoot",{"data-slot":"table-footer",className:a("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function me({className:e,...t}){return(0,O.jsx)("tr",{"data-slot":"table-row",className:a("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function yt({className:e,...t}){return(0,O.jsx)("th",{"data-slot":"table-head",className:a("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function he({className:e,...t}){return(0,O.jsx)("td",{"data-slot":"table-cell",className:a("p-2 align-middle whitespace-nowrap",e),...t})}var $e=require("react/jsx-runtime");function we({className:e,...t}){return(0,$e.jsx)("div",{"data-slot":"card",className:a("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(0,$e.jsx)("div",{"data-slot":"card-content",className:a("px-6",e),...t})}var Z=require("radix-ui");var E=require("react/jsx-runtime");function ce({delayDuration:e=0,...t}){return(0,E.jsx)(Z.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function qe({...e}){return(0,E.jsx)(ce,{children:(0,E.jsx)(Z.Tooltip.Root,{"data-slot":"tooltip",...e})})}function Ke({...e}){return(0,E.jsx)(Z.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function Xe({className:e,sideOffset:t=0,children:i,...d}){return(0,E.jsx)(Z.Tooltip.Portal,{children:(0,E.jsxs)(Z.Tooltip.Content,{"data-slot":"tooltip-content",sideOffset:t,className:a("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),...d,children:[i,(0,E.jsx)(Z.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var h=require("lucide-react");var Pt=require("react/jsx-runtime");function Je({className:e,type:t,...i}){return(0,Pt.jsx)("input",{type:t,"data-slot":"input",className:a("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),...i})}var M=require("radix-ui"),ee=require("lucide-react");var x=require("react/jsx-runtime");function Pe({...e}){return(0,x.jsx)(M.Select.Root,{"data-slot":"select",...e})}function De({...e}){return(0,x.jsx)(M.Select.Value,{"data-slot":"select-value",...e})}function Ne({className:e,size:t="default",children:i,...d}){return(0,x.jsxs)(M.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:a("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),...d,children:[i,(0,x.jsx)(M.Select.Icon,{asChild:!0,children:(0,x.jsx)(ee.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function Te({className:e,children:t,position:i="popper",...d}){return(0,x.jsx)(M.Select.Portal,{children:(0,x.jsxs)(M.Select.Content,{"data-slot":"select-content",className:a("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",i==="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:i,...d,children:[(0,x.jsx)(Po,{}),(0,x.jsx)(M.Select.Viewport,{className:a("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,x.jsx)(Do,{})]})})}function pe({className:e,children:t,...i}){return(0,x.jsxs)(M.Select.Item,{"data-slot":"select-item",className:a("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),...i,children:[(0,x.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,x.jsx)(M.Select.ItemIndicator,{children:(0,x.jsx)(ee.CheckIcon,{className:"size-4"})})}),(0,x.jsx)(M.Select.ItemText,{children:t})]})}function Po({className:e,...t}){return(0,x.jsx)(M.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,x.jsx)(ee.ChevronUpIcon,{className:"size-4"})})}function Do({className:e,...t}){return(0,x.jsx)(M.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,x.jsx)(ee.ChevronDownIcon,{className:"size-4"})})}var B=require("radix-ui"),Se=require("lucide-react");var R=require("react/jsx-runtime");function U({...e}){return(0,R.jsx)(B.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function j({...e}){return(0,R.jsx)(B.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function W({className:e,sideOffset:t=4,...i}){return(0,R.jsx)(B.DropdownMenu.Portal,{children:(0,R.jsx)(B.DropdownMenu.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:a("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),...i})})}function Qe({...e}){return(0,R.jsx)(B.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function T({className:e,inset:t,variant:i="default",...d}){return(0,R.jsx)(B.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":i,className:a("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),...d})}function ue({className:e,children:t,checked:i,...d}){return(0,R.jsxs)(B.DropdownMenu.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:a("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:i,...d,children:[(0,R.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,R.jsx)(B.DropdownMenu.ItemIndicator,{children:(0,R.jsx)(Se.CheckIcon,{className:"size-4"})})}),t]})}function A({className:e,inset:t,...i}){return(0,R.jsx)(B.DropdownMenu.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...i})}function L({className:e,...t}){return(0,R.jsx)(B.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t})}var r=require("react/jsx-runtime");function Re({table:e,filters:t=[],globalFilter:i,onGlobalFilterChange:d,enableGlobalFilter:c=!0,onExport:p,onRefresh:I,loading:V=!1,enableColumnVisibility:re=!0,data:te,onClearSorting:X,onClearFilters:ie,enableColumnPinning:se=!1}){let le=()=>e.getAllLeafColumns().filter(s=>s.getCanHide?.()!==!1),oe=()=>e.getAllColumns().filter(s=>!e.getAllLeafColumns().includes(s)&&s.columns?.length&&s.columns.some(m=>m.getCanHide?.()!==!1)),ae=()=>{let s=new Set(oe().flatMap(m=>m.columns?.filter(F=>F.getCanHide?.()!==!1).map(F=>F.id)||[]));return le().filter(m=>!s.has(m.id))},de=(s,m)=>m&&s.startsWith(`${m}.`)?s.replace(`${m}.`,"").split("_").map(be=>be.slice(1)).join(" "):s.split("_").map(F=>F.charAt(0).toUpperCase()+F.slice(1)).join(" ");return(0,r.jsx)("div",{className:"rounded-xl",children:(0,r.jsx)("div",{className:"px-2",children:(0,r.jsx)("div",{className:"flex flex-col gap-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,r.jsx)(h.Filter,{className:"h-4 w-4"})}),t.map(s=>(0,r.jsx)("div",{className:a("relative min-w-[150px]",s.width),children:s.type==="select"?(0,r.jsxs)(Pe,{value:e.getColumn(s.key)?.getFilterValue()??"",onValueChange:m=>e.getColumn(s.key)?.setFilterValue(m==="all"?"":m),children:[s.icon&&(0,r.jsx)("span",{children:(0,r.jsx)(s.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,r.jsx)(Ne,{className:a("h-9 rounded-lg w-full",s.icon&&"pl-9"),children:(0,r.jsx)(De,{placeholder:s.placeholder})}),(0,r.jsxs)(Te,{className:"rounded-lg",children:[(0,r.jsx)(pe,{value:"all",children:"All"}),s.options?.map(m=>(0,r.jsx)(pe,{value:m.value,children:m.label},m.label))]})]}):(0,r.jsxs)("div",{className:"relative",children:[s.icon&&(0,r.jsx)("span",{children:(0,r.jsx)(s.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,r.jsx)(Je,{placeholder:s.placeholder,value:e.getColumn(s.key)?.getFilterValue()??"",onChange:m=>e.getColumn(s.key)?.setFilterValue(m.target.value),className:a("h-9 rounded-lg",s.icon&&"pl-9"),type:s.type==="number"?"number":s.type==="date"?"date":"text"})]})},s.key))]})}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[c&&(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(h.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,r.jsx)(Je,{placeholder:"Global search...",value:i??"",onChange:s=>d(s.target.value),className:"pl-9 max-w-max"})]}),p&&(0,r.jsxs)(b,{variant:"outline",size:"sm",onClick:()=>p(te),className:"rounded-lg",children:[(0,r.jsx)(h.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),re&&(0,r.jsxs)(U,{children:[(0,r.jsx)(j,{asChild:!0,children:(0,r.jsxs)(b,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,r.jsx)("span",{children:"Columns"}),(0,r.jsx)(h.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,r.jsxs)(W,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,r.jsx)(A,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,r.jsx)(L,{}),ae().length>0&&(0,r.jsxs)(Qe,{children:[(0,r.jsx)(A,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),ae().map(s=>(0,r.jsx)(ue,{className:"text-sm",checked:s.getIsVisible(),onCheckedChange:m=>s.toggleVisibility(!!m),children:de(s.id)},s.id))]}),oe().map(s=>(0,r.jsxs)(Qe,{children:[(0,r.jsx)(L,{}),(0,r.jsx)(A,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:s.id}),s.columns?.filter(m=>m.getCanHide?.()!==!1).map(m=>(0,r.jsx)(ue,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:F=>m.toggleVisibility(!!F),children:de(m.id,s.id)},m.id))]},s.id))]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(j,{asChild:!0,children:(0,r.jsx)(b,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,r.jsx)(h.Settings2,{className:"h-4 w-4"})})}),(0,r.jsxs)(W,{align:"end",className:"w-[200px] rounded-lg",children:[(0,r.jsx)(A,{children:"Table Settings"}),(0,r.jsx)(L,{}),(0,r.jsxs)(T,{onClick:X,children:[(0,r.jsx)(h.ArrowUpDown,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),(0,r.jsxs)(T,{onClick:ie,children:[(0,r.jsx)(h.Filter,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),se&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L,{}),(0,r.jsx)(A,{children:"Column Pinning"}),(0,r.jsxs)(T,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,r.jsx)(h.PinOff,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),(0,r.jsxs)(T,{onClick:()=>{let s=le().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:s,right:[]})},children:[(0,r.jsx)(h.Pin,{className:"mr-2 h-4 w-4 rotate-90"}),"Pin All Left"]}),(0,r.jsxs)(T,{onClick:()=>{let s=le().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:[],right:s})},children:[(0,r.jsx)(h.Pin,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),I&&(0,r.jsx)(b,{variant:"outline",size:"sm",onClick:I,disabled:V,className:"rounded-lg",children:(0,r.jsx)(h.RefreshCw,{className:a("h-4 w-4",V&&"animate-spin")})})]})]})})})})}var v=require("react/jsx-runtime");function ke({table:e,config:t}){return t.enabled?(0,v.jsx)("div",{className:"rounded-xl",children:(0,v.jsx)("div",{children:(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,v.jsxs)("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"]})}),(0,v.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,v.jsxs)(Pe,{value:`${e.getState().pagination.pageSize}`,onValueChange:i=>e.setPageSize(Number(i)),children:[(0,v.jsx)(Ne,{className:"h-9 w-[70px] rounded-lg",children:(0,v.jsx)(De,{})}),(0,v.jsx)(Te,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(i=>(0,v.jsx)(pe,{value:`${i}`,children:i},i))})]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,v.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(i,d)=>{let c=e.getState().pagination.pageIndex,p=c-2+d+1;return p<1||p>e.getPageCount()?null:(0,v.jsx)(b,{variant:p===c+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(p-1),children:p},p)})}),(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,v.jsx)(b,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Dt=require("radix-ui"),Nt=require("class-variance-authority");var St=require("react/jsx-runtime"),No=(0,Nt.cva)("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 Tt({className:e,variant:t,size:i,noBg:d,...c}){return(0,St.jsx)(Dt.Toggle.Root,{"data-slot":"toggle",className:a(No({className:e,variant:t,size:i,bg:d?"disabled":"enabled"})),...c})}var Ye=require("radix-ui"),Rt=require("lucide-react");var ze=require("react/jsx-runtime");function Ze({className:e,...t}){return(0,ze.jsx)(Ye.Checkbox.Root,{"data-slot":"checkbox",className:a("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:(0,ze.jsx)(Ye.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,ze.jsx)(Rt.CheckIcon,{className:"size-3.5"})})})}var S=require("react"),o=require("react/jsx-runtime");function kt({data:e,columns:t,filters:i=[],pagination:d={enabled:!1},settings:c={},header:p,footer:I,className:V="",maxHeight:re="600px",loading:te=!1,error:X,emptyMessage:ie="No data available",onRowSelectionChange:se,onExport:le,onRefresh:oe,onTableReady:ae,children:de}){let[s,m]=(0,S.useState)([]),[F,be]=(0,S.useState)([]),[Yt,Zt]=(0,S.useState)({}),[ot,eo]=(0,S.useState)({}),[at,Ae]=(0,S.useState)(""),[to,oo]=(0,S.useState)([]),[Le,ao]=(0,S.useState)(c.enableColumnPinning?{left:[],right:[]}:{}),{enableSorting:Ge=!0,enableFiltering:He=!0,enableGlobalFilter:nt=!0,enableColumnVisibility:Oe=!0,enableRowSelection:_=!0,stickyHeader:no=!0,toolbar:ro=!1,showSerialNumbers:J=!0,fixedCheckboxColumn:ve=!0,striped:io=!0,hoverable:so=!0,compact:rt=!0,bordered:it=!0,fullHeight:lo=!1,enableColumnResizing:st=!1,enableColumnPinning:z=!0,hideHeader:mo=!1}=c,Ee=(0,S.useMemo)(()=>{let f=[...t],P=g=>g.map(l=>{if(l.id==="select"||l.id==="serialNumber")return l;let D={...l,enablePinning:!0};return l.columns&&(D.columns=P(l.columns)),D}),n=P(f);if(_){let g={id:"select",header:({table:l})=>(0,o.jsx)(Ze,{checked:l.getIsAllPageRowsSelected()||l.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:D=>l.toggleAllPageRowsSelected(!!D),"aria-label":"Select all"}),cell:({row:l})=>(0,o.jsx)("div",{className:a("flex items-center justify-center"),children:(0,o.jsx)(Ze,{checked:l.getIsSelected(),onCheckedChange:D=>l.toggleSelected(!!D),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:10};n.unshift(g)}if(J){let g={id:"serialNumber",header:"No.",cell:({row:l})=>(0,o.jsx)("div",{className:"text-center font-medium text-muted-foreground",children:l.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};n.unshift(g)}return n},[t,J,_,ve]),N=(0,k.useReactTable)({data:e,columns:Ee,onSortingChange:Ge?m:void 0,onColumnFiltersChange:He?be:void 0,onGlobalFilterChange:nt?Ae:void 0,getCoreRowModel:(0,k.getCoreRowModel)(),getPaginationRowModel:d.enabled?(0,k.getPaginationRowModel)():void 0,getSortedRowModel:Ge?(0,k.getSortedRowModel)():void 0,getFilteredRowModel:He?(0,k.getFilteredRowModel)():void 0,onColumnVisibilityChange:Oe?Zt:void 0,onRowSelectionChange:_?eo:void 0,onColumnOrderChange:oo,onColumnPinningChange:z?ao:void 0,state:{sorting:Ge?s:void 0,columnFilters:He?F:void 0,columnVisibility:Oe?Yt:void 0,rowSelection:_?ot:{},globalFilter:at,columnOrder:to,columnPinning:z?Le:{}},initialState:{pagination:d.enabled?{pageSize:d.pageSize||10}:void 0,columnPinning:z?{left:[...J?["serialNumber"]:[],..._?["select"]:[]],right:[]}:void 0},enableRowSelection:_,enableColumnResizing:st,enableColumnPinning:z,columnResizeMode:"onChange"});(0,S.useEffect)(()=>{ae&&ae(N)},[N,ae]),(0,S.useEffect)(()=>{if(_&&se){let f=N.getFilteredSelectedRowModel().rows.map(P=>P.original);se(f)}},[ot,_,se,N]);let co=(0,S.useCallback)(()=>{m([])},[]),po=(0,S.useCallback)(()=>{be([]),Ae("")},[]),lt=(f,P)=>{if(!z)return;let n=[...J?["serialNumber"]:[],..._&&ve?["select"]:[]],g={left:[...(Le.left??[]).filter(l=>n.includes(l))],right:[...Le.right??[]]};P===!1?(g.left=g.left.filter(l=>l!==f),g.right=g.right.filter(l=>l!==f)):P==="right"?(g.left=g.left.filter(l=>l!==f),g.right.includes(f)||g.right.push(f)):P==="left"&&(g.right=g.right.filter(l=>l!==f),!g.left.includes(f)&&!n.includes(f)&&g.left.push(f)),N.setColumnPinning(g)},uo=()=>(0,o.jsx)(xt,{className:a(no&&"sticky top-0 bg-sidebar z-20"),children:N.getHeaderGroups().map((f,P)=>(0,o.jsx)(me,{className:"hover:bg-transparent",children:f.headers.map((n,g)=>{let l=n.depth===0&&n.colSpan>1,D=z&&(n.column.getIsPinned()==="left"||n.column.id==="serialNumber"||n.column.id==="select"&&_),Q=z&&n.column.getIsPinned()==="right",Y=n.column.getCanSort(),Ue=z&&n.column.columnDef.enablePinning!==!1,Ce=n.column.id==="serialNumber",je=n.column.id==="select",ct=Ce||je&&ve,ne=n.column.columnDef.headerAlign||"left",go={left:"justify-start",center:"justify-center",right:"justify-end"}[ne];return(0,o.jsxs)(yt,{colSpan:n.colSpan,className:a("font-semibold text-foreground bg-sidebar group px-0",!rt&&"py-2",it&&g<f.headers.length-1&&"border-r","relative",D&&"sticky left-0 z-15 bg-sidebar",Q&&"sticky right-0 z-15 bg-sidebar",(Ce||je)&&"sticky left-0 z-15 bg-sidebar",l?"text-center":"text-left"),style:{width:n.getSize()!==150?n.getSize():"auto",minWidth:n.getSize()!==150?n.getSize():"auto",...D&&{left:Ce?0:je?J&&N.getColumn("serialNumber")?.getSize()||0:dt(n.column)},...Q&&{right:mt(n.column)},...Ce&&{left:0}},children:[l?(0,o.jsx)("div",{className:"flex items-center justify-center",children:(0,k.flexRender)(n.column.columnDef.header,n.getContext())}):(0,o.jsxs)("div",{className:a("relative flex items-center w-full px-2",go),children:[(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[Y&&ne==="right"&&(0,o.jsx)("span",{className:"ml-1 order-2",children:n.column.getIsSorted()&&{asc:(0,o.jsx)(w.ChevronUp,{className:"h-4 w-4"}),desc:(0,o.jsx)(w.ChevronDown,{className:"h-4 w-4"})}[n.column.getIsSorted()]}),n.isPlaceholder?null:(0,k.flexRender)(n.column.columnDef.header,n.getContext()),Y&&ne!=="right"&&n.column.getIsSorted()&&(0,o.jsx)("span",{className:"ml-1 order-2",children:n.column.getIsSorted()&&{asc:(0,o.jsx)(w.ChevronUp,{className:"h-4 w-4"}),desc:(0,o.jsx)(w.ChevronDown,{className:"h-4 w-4"})}[n.column.getIsSorted()]})]}),(Y||Ue&&!ct)&&(0,o.jsxs)(U,{children:[(0,o.jsx)(j,{asChild:!0,className:a("absolute",ne==="left"&&"right-1",ne==="center"&&"right-1",ne==="right"&&"left-1"),children:(0,o.jsx)(Tt,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:(0,o.jsx)(w.MoreHorizontal,{className:"h-4 w-4"})})}),(0,o.jsxs)(W,{align:"end",className:"w-48",children:[Y&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(A,{children:"Sorting"}),(0,o.jsxs)(T,{onClick:()=>n.column.toggleSorting(!1),children:[(0,o.jsx)(w.ChevronUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),(0,o.jsxs)(T,{onClick:()=>n.column.toggleSorting(!0),children:[(0,o.jsx)(w.ChevronDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),(0,o.jsxs)(T,{onClick:()=>n.column.clearSorting(),disabled:!n.column.getIsSorted(),children:[(0,o.jsx)(w.ChevronsUpDown,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),(0,o.jsx)(L,{})]}),Ue&&!ct&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(A,{children:"Pin Column"}),(0,o.jsxs)(T,{onClick:()=>lt(n.column.id,"right"),disabled:n.column.getIsPinned()==="right",children:[(0,o.jsx)(w.MoveRightIcon,{}),"Pin Right"]}),(0,o.jsxs)(T,{onClick:()=>lt(n.column.id,!1),disabled:!n.column.getIsPinned(),children:[(0,o.jsx)(w.PinOffIcon,{}),"Unpin"]})]})]})]})]}),st&&n.column.getCanResize()&&!l&&n.colSpan===1&&(0,o.jsx)("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))}),dt=f=>{if(!z)return;let P=0,n=N.getLeftHeaderGroups()[0]?.headers||[],g=[...J?["serialNumber"]:[],..._?["select"]:[]];for(let l of n){if(l.id===f.id)break;if(g.includes(l.id)){let D=N.getColumn(l.id);D&&(P+=D.getSize())}}return P},mt=f=>{if(!z)return;let P=N.getState().columnPinning.right||[],n=P.indexOf(f.id);if(n===-1)return;let g=0;for(let l=n+1;l<P.length;l++){let D=N.getColumn(P[l]);D&&(g+=D.getSize())}return g};return X?(0,o.jsx)(we,{className:"w-full rounded-xl shadow-sm",children:(0,o.jsx)(ye,{className:"flex items-center justify-center",children:(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:X}),oe&&(0,o.jsxs)(b,{variant:"outline",size:"sm",onClick:oe,className:"rounded-lg",children:[(0,o.jsx)(w.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,o.jsx)(ce,{children:(0,o.jsxs)("div",{className:a("w-full space-y-2 flex flex-col h-full",V),children:[p&&(0,o.jsx)(we,{className:"rounded-2xl py-2 sticky top-0 z-20",children:(0,o.jsx)(ye,{className:"px-2",children:p})}),ro&&(0,o.jsx)(Re,{table:N,filters:i,globalFilter:at,onGlobalFilterChange:Ae,enableGlobalFilter:nt,onExport:le,onRefresh:oe,loading:te,enableColumnVisibility:Oe,enableColumnPinning:z,data:e,onClearSorting:co,onClearFilters:po}),(0,o.jsx)(we,{className:a("shadow-sm overflow-auto py-0",lo&&"flex-1"),children:(0,o.jsx)(ye,{className:"p-0 h-full",children:(0,o.jsxs)("div",{className:"relative flex flex-col h-full justify-between",children:[te&&(0,o.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,o.jsx)(w.Loader2,{className:"size-5 animate-spin text-primary"}),(0,o.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),(0,o.jsx)("div",{className:"relative rounded-t-xl overflow-auto border-b",children:(0,o.jsxs)(We,{className:"border-collapse w-full",children:[!mo&&uo(),(0,o.jsx)(ht,{children:N.getRowModel().rows?.length?N.getRowModel().rows.map((f,P)=>(0,o.jsx)(me,{"data-state":f.getIsSelected()&&"selected",className:a(so&&"hover:bg-muted/50",io&&P%2===0&&"bg-muted/20",f.getIsSelected()&&"bg-muted","border-b last:border-b-0"),children:f.getVisibleCells().map((n,g)=>{let l=z&&(n.column.getIsPinned()==="left"||n.column.id==="serialNumber"||n.column.id==="select"&&_),D=z&&n.column.getIsPinned()==="right",Q=n.column.id==="serialNumber",Y=n.column.id==="select",Ue=Q||Y&&ve;return(0,o.jsx)(he,{className:a(rt?"py-2":"py-4",it&&g<f.getVisibleCells().length&&"border-r",l&&"sticky left-0 z-10 bg-sidebar/97",D&&"sticky right-0 z-10 bg-sidebar/97",Q&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:n.column.getSize()!==150?n.column.getSize():"auto",minWidth:n.column.getSize()!==150?n.column.getSize():"auto",...l&&{left:Q?0:Y?J&&N.getColumn("serialNumber")?.getSize()||0:dt(n.column)},...D&&{right:mt(n.column)},...Q&&{left:0}},children:(0,k.flexRender)(n.column.columnDef.cell,n.getContext())},n.id)})},f.id)):(0,o.jsx)(me,{children:(0,o.jsx)(he,{colSpan:Ee.length,className:"h-32 text-center border-0",children:(0,o.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,o.jsx)("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),(0,o.jsx)("p",{className:"text-muted-foreground font-medium",children:ie})]})})})})]})}),I&&(0,o.jsx)("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:(0,o.jsx)(We,{children:(0,o.jsx)(wt,{children:(0,o.jsx)(me,{className:"bg-sidebar",children:(0,o.jsx)(he,{colSpan:Ee.length,className:"p-2",children:I})})})})})]})})}),(0,o.jsx)(ke,{table:N,config:d}),de&&de(N)]})})}var zt=require("radix-ui");var Mt=require("react/jsx-runtime");function Me({className:e,orientation:t="horizontal",decorative:i=!0,...d}){return(0,Mt.jsx)(zt.Separator.Root,{"data-slot":"separator-root",decorative:i,orientation:t,className:a("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),...d})}var Ie=require("lucide-react"),Ve=require("framer-motion"),$=ut(require("react"),1),It=ut(require("react-dom"),1),C=require("react/jsx-runtime");function Vt({table:e,visible:t,container:i,children:d,className:c,...p}){let[I,V]=$.useState(!1);$.useLayoutEffect(()=>{V(!0)},[]),$.useEffect(()=>{function X(ie){ie.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[e]);let re=i??(I?globalThis.document?.body:null);if(!re||!e)return null;let te=t??e.getFilteredSelectedRowModel().rows.length>0;return It.createPortal((0,C.jsx)(Ve.AnimatePresence,{children:te&&(0,C.jsx)(Ve.motion.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:a("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",c),...p,children:(0,C.jsxs)(ce,{children:["1",d]})})}),re)}function _t({size:e="sm",tooltip:t,isPending:i,disabled:d,className:c,children:p,...I}){let V=(0,C.jsx)(b,{variant:"secondary",size:e,className:a("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",c),disabled:d||i,...I,children:i?(0,C.jsx)(Ie.Loader,{className:"animate-spin"}):p});return t?(0,C.jsxs)(qe,{children:[(0,C.jsx)(Ke,{asChild:!0,children:V}),(0,C.jsx)(Xe,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,C.jsx)("p",{children:t})})]}):V}function Ft({table:e}){let t=$.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,C.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,C.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,C.jsx)(Me,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,C.jsxs)(qe,{children:[(0,C.jsx)(Ke,{asChild:!0,children:(0,C.jsx)(b,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,C.jsx)(Ie.X,{className:"size-3.5"})})}),(0,C.jsxs)(Xe,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[(0,C.jsx)("p",{children:"Clear selection"}),(0,C.jsx)("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:(0,C.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var q=require("lucide-react");var y=require("react/jsx-runtime");function Bt({column:e,title:t,className:i}){return e.getCanSort()?(0,y.jsx)("div",{className:a("flex items-center space-x-2",i),children:(0,y.jsxs)(U,{children:[(0,y.jsx)(j,{asChild:!0,children:(0,y.jsxs)(b,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[(0,y.jsx)("span",{children:t}),e.getIsSorted()==="desc"?(0,y.jsx)(q.ArrowUpDown,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?(0,y.jsx)(q.ArrowUpDown,{className:"ml-2 h-4 w-4"}):(0,y.jsx)(q.ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),(0,y.jsxs)(W,{align:"start",className:"rounded-lg",children:[(0,y.jsxs)(T,{onClick:()=>e.toggleSorting(!1),children:[(0,y.jsx)(q.ArrowUpDown,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),(0,y.jsxs)(T,{onClick:()=>e.toggleSorting(!0),children:[(0,y.jsx)(q.ArrowUpDown,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),(0,y.jsx)(L,{}),(0,y.jsxs)(T,{onClick:()=>e.toggleVisibility(!1),children:[(0,y.jsx)(q.EyeOff,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):(0,y.jsx)("div",{className:a(i),children:t})}var _e=require("lucide-react");var G=require("react/jsx-runtime");function At({table:e}){return(0,G.jsxs)(U,{children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(b,{variant:"outline",size:"sm",className:"rounded-lg",children:[(0,G.jsx)(_e.Eye,{className:"mr-2 h-4 w-4"}),"Columns ",(0,G.jsx)(_e.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),(0,G.jsxs)(W,{align:"end",className:"w-[200px] rounded-lg",children:[(0,G.jsx)(A,{children:"Toggle Columns"}),(0,G.jsx)(L,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>(0,G.jsx)(ue,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:i=>t.toggleVisibility(!!i),children:t.id},t.id))]})]})}var Lt=require("radix-ui"),Gt=require("class-variance-authority");var Ht=require("react/jsx-runtime"),To=(0,Gt.cva)("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 Fe({className:e,variant:t,asChild:i=!1,...d}){let c=i?Lt.Slot.Slot:"span";return(0,Ht.jsx)(c,{"data-slot":"badge",className:a(To({variant:t}),e),...d})}var K=require("cmdk"),Et=require("lucide-react");var So=require("radix-ui"),Ro=require("lucide-react");var Ot=require("react/jsx-runtime");var H=require("react/jsx-runtime");function Ut({className:e,...t}){return(0,H.jsx)(K.Command,{"data-slot":"command",className:a("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function jt({className:e,...t}){return(0,H.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,H.jsx)(Et.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),(0,H.jsx)(K.Command.Input,{"data-slot":"command-input",className:a("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(0,H.jsx)(K.Command.List,{"data-slot":"command-list",className:a("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function $t({...e}){return(0,H.jsx)(K.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function et({className:e,...t}){return(0,H.jsx)(K.Command.Group,{"data-slot":"command-group",className:a("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 qt({className:e,...t}){return(0,H.jsx)(K.Command.Separator,{"data-slot":"command-separator",className:a("bg-border -mx-1 h-px",e),...t})}function tt({className:e,...t}){return(0,H.jsx)(K.Command.Item,{"data-slot":"command-item",className:a("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})}var ge=require("radix-ui");var fe=require("react/jsx-runtime");function Kt({...e}){return(0,fe.jsx)(ge.Popover.Root,{"data-slot":"popover",...e})}function Xt({...e}){return(0,fe.jsx)(ge.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function Jt({className:e,align:t="center",sideOffset:i=4,...d}){return(0,fe.jsx)(ge.Popover.Portal,{children:(0,fe.jsx)(ge.Popover.Content,{"data-slot":"popover-content",align:t,sideOffset:i,className:a("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),...d})})}var Be=require("lucide-react"),u=require("react/jsx-runtime");function Qt({column:e,title:t,options:i}){let d=e?.getFacetedUniqueValues(),c=new Set(e?.getFilterValue());return(0,u.jsxs)(Kt,{children:[(0,u.jsx)(Xt,{asChild:!0,children:(0,u.jsxs)(b,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[(0,u.jsx)(Be.PlusCircleIcon,{className:"mr-2 h-4 w-4"}),t,c?.size>0&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Me,{orientation:"vertical",className:"mx-2 h-4"}),(0,u.jsx)(Fe,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:c.size}),(0,u.jsx)("div",{className:"hidden space-x-1 lg:flex",children:c.size>2?(0,u.jsxs)(Fe,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):i.filter(p=>c.has(p.value)).map(p=>(0,u.jsx)(Fe,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:p.label},p.value))})]})]})}),(0,u.jsx)(Jt,{className:"w-[200px] p-0 rounded-lg",align:"start",children:(0,u.jsxs)(Ut,{className:"rounded-lg",children:[(0,u.jsx)(jt,{placeholder:t}),(0,u.jsxs)(Wt,{children:[(0,u.jsx)($t,{children:"No results found."}),(0,u.jsx)(et,{children:i.map(p=>{let I=c.has(p.value);return(0,u.jsxs)(tt,{onSelect:()=>{I?c.delete(p.value):c.add(p.value);let V=Array.from(c);e?.setFilterValue(V.length?V:void 0)},children:[(0,u.jsx)("div",{className:a("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",I?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,u.jsx)(Be.CheckIcon,{className:a("h-4 w-4")})}),p.icon&&(0,u.jsx)(p.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),(0,u.jsx)("span",{children:p.label}),d?.get(p.value)&&(0,u.jsx)("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:d.get(p.value)})]},p.value)})}),c.size>0&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(qt,{}),(0,u.jsx)(et,{children:(0,u.jsx)(tt,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}0&&(module.exports={DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTableColumnHeader,DataTableFacetedFilter,DataTablePagination,DataTableToolbar,DataTableViewOptions});
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|