@akshar-technosoft/ui 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/components/ui/table.cjs +1 -1
- package/dist/components/ui/table.cjs.map +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
"use strict";var Yt=Object.create;var Se=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var eo=Object.getOwnPropertyNames;var to=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var no=(e,t)=>{for(var s in t)Se(e,s,{get:t[s],enumerable:!0})},ct=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let x of eo(t))!oo.call(e,x)&&x!==s&&Se(e,x,{get:()=>t[x],enumerable:!(c=Zt(t,x))||c.enumerable});return e};var ao=(e,t,s)=>(s=e!=null?Yt(to(e)):{},ct(t||!e||!e.__esModule?Se(s,"default",{value:e,enumerable:!0}):s,e)),ro=e=>ct(Se({},"__esModule",{value:!0}),e);var mo={};no(mo,{DataTable:()=>uo});module.exports=ro(mo);var V=require("@tanstack/react-table"),D=require("lucide-react");var pt=require("radix-ui"),gt=require("class-variance-authority");var ut=require("clsx"),mt=require("tailwind-merge");function n(...e){return(0,mt.twMerge)((0,ut.clsx)(e))}var ft=require("react/jsx-runtime"),ke=(0,gt.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 N({className:e,variant:t,size:s,asChild:c=!1,...x}){let h=c?pt.Slot.Slot:"button";return(0,ft.jsx)(h,{"data-slot":"button",className:n(ke({variant:t,size:s,className:e}),"transition-none"),...x})}var W=require("react/jsx-runtime");function $e({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:(0,W.jsx)("table",{"data-slot":"table",className:n("w-full caption-bottom text-sm",e),...t})})}function bt({className:e,...t}){return(0,W.jsx)("thead",{"data-slot":"table-header",className:n("[&_tr]:border-b",e),...t})}function vt({className:e,...t}){return(0,W.jsx)("tbody",{"data-slot":"table-body",className:n("[&_tr:last-child]:border-0",e),...t})}function xt({className:e,...t}){return(0,W.jsx)("tfoot",{"data-slot":"table-footer",className:n("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function pe({className:e,...t}){return(0,W.jsx)("tr",{"data-slot":"table-row",className:n("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function ht({className:e,...t}){return(0,W.jsx)("th",{"data-slot":"table-head",className:n("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function De({className:e,...t}){return(0,W.jsx)("td",{"data-slot":"table-cell",className:n("p-2 align-middle whitespace-nowrap",e),...t})}var We=require("react/jsx-runtime");function Te({className:e,...t}){return(0,We.jsx)("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function ze({className:e,...t}){return(0,We.jsx)("div",{"data-slot":"card-content",className:n("px-6",e),...t})}var Ct=require("radix-ui");var qe=require("react/jsx-runtime");function wt({delayDuration:e=0,...t}){return(0,qe.jsx)(Ct.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}var k=require("lucide-react");var yt=require("react/jsx-runtime");function Je({className:e,type:t,...s}){return(0,yt.jsx)("input",{type:t,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}var G=require("radix-ui"),te=require("lucide-react");var S=require("react/jsx-runtime");function Me({...e}){return(0,S.jsx)(G.Select.Root,{"data-slot":"select",...e})}function Re({...e}){return(0,S.jsx)(G.Select.Value,{"data-slot":"select-value",...e})}function Ie({className:e,size:t="default",children:s,...c}){return(0,S.jsxs)(G.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...c,children:[s,(0,S.jsx)(G.Select.Icon,{asChild:!0,children:(0,S.jsx)(te.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function _e({className:e,children:t,position:s="popper",...c}){return(0,S.jsx)(G.Select.Portal,{children:(0,S.jsxs)(G.Select.Content,{"data-slot":"select-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",s==="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:s,...c,children:[(0,S.jsx)(io,{}),(0,S.jsx)(G.Select.Viewport,{className:n("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,S.jsx)(so,{})]})})}function ge({className:e,children:t,...s}){return(0,S.jsxs)(G.Select.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[(0,S.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,S.jsx)(G.Select.ItemIndicator,{children:(0,S.jsx)(te.CheckIcon,{className:"size-4"})})}),(0,S.jsx)(G.Select.ItemText,{children:t})]})}function io({className:e,...t}){return(0,S.jsx)(G.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:(0,S.jsx)(te.ChevronUpIcon,{className:"size-4"})})}function so({className:e,...t}){return(0,S.jsx)(G.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:(0,S.jsx)(te.ChevronDownIcon,{className:"size-4"})})}var j=require("radix-ui"),Fe=require("lucide-react");var _=require("react/jsx-runtime");function fe({...e}){return(0,_.jsx)(j.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function be({...e}){return(0,_.jsx)(j.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ve({className:e,sideOffset:t=4,...s}){return(0,_.jsx)(j.DropdownMenu.Portal,{children:(0,_.jsx)(j.DropdownMenu.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...s})})}function Xe({...e}){return(0,_.jsx)(j.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function U({className:e,inset:t,variant:s="default",...c}){return(0,_.jsx)(j.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":s,className:n("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...c})}function Ke({className:e,children:t,checked:s,...c}){return(0,_.jsxs)(j.DropdownMenu.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:n("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:s,...c,children:[(0,_.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,_.jsx)(j.DropdownMenu.ItemIndicator,{children:(0,_.jsx)(Fe.CheckIcon,{className:"size-4"})})}),t]})}function q({className:e,inset:t,...s}){return(0,_.jsx)(j.DropdownMenu.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...s})}function oe({className:e,...t}){return(0,_.jsx)(j.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t})}var Qe=require("react");var ce=require("react"),Dt=require("lucide-react"),de=require("date-fns");var xe=require("radix-ui");var he=require("react/jsx-runtime");function Pt({...e}){return(0,he.jsx)(xe.Popover.Root,{"data-slot":"popover",...e})}function Nt({...e}){return(0,he.jsx)(xe.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function St({className:e,align:t="center",sideOffset:s=4,...c}){return(0,he.jsx)(xe.Popover.Portal,{children:(0,he.jsx)(xe.Popover.Content,{"data-slot":"popover-content",align:t,sideOffset:s,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...c})})}var Ve=ao(require("react"),1),le=require("lucide-react"),Ce=require("react-day-picker");var J=require("react/jsx-runtime");function kt({className:e,classNames:t,showOutsideDays:s=!0,captionLayout:c="label",buttonVariant:x="ghost",formatters:h,components:B,...X}){let b=(0,Ce.getDefaultClassNames)();return(0,J.jsx)(Ce.DayPicker,{showOutsideDays:s,className:n("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:c,formatters:{formatMonthDropdown:w=>w.toLocaleString("default",{month:"short"}),...h},classNames:{root:n("w-fit",b.root),months:n("flex gap-4 flex-col md:flex-row relative",b.months),month:n("flex flex-col w-full gap-4",b.month),nav:n("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",b.nav),button_previous:n(ke({variant:x}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",b.button_previous),button_next:n(ke({variant:x}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",b.button_next),month_caption:n("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",b.month_caption),dropdowns:n("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",b.dropdowns),dropdown_root:n("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",b.dropdown_root),dropdown:n("absolute bg-popover inset-0 opacity-0",b.dropdown),caption_label:n("select-none font-medium",c==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",b.caption_label),table:"w-full border-collapse",weekdays:n("flex",b.weekdays),weekday:n("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",b.weekday),week:n("flex w-full mt-2",b.week),week_number_header:n("select-none w-(--cell-size)",b.week_number_header),week_number:n("text-[0.8rem] select-none text-muted-foreground",b.week_number),day:n("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",b.day),range_start:n("rounded-l-md bg-accent",b.range_start),range_middle:n("rounded-none",b.range_middle),range_end:n("rounded-r-md bg-accent",b.range_end),today:n("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",b.today),outside:n("text-muted-foreground aria-selected:text-muted-foreground",b.outside),disabled:n("text-muted-foreground opacity-50",b.disabled),hidden:n("invisible",b.hidden),...t},components:{Root:({className:w,rootRef:M,...A})=>(0,J.jsx)("div",{"data-slot":"calendar",ref:M,className:n(w),...A}),Chevron:({className:w,orientation:M,...A})=>M==="left"?(0,J.jsx)(le.ChevronLeftIcon,{className:n("size-4",w),...A}):M==="right"?(0,J.jsx)(le.ChevronRightIcon,{className:n("size-4",w),...A}):(0,J.jsx)(le.ChevronDownIcon,{className:n("size-4",w),...A}),DayButton:lo,WeekNumber:({children:w,...M})=>(0,J.jsx)("td",{...M,children:(0,J.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:w})}),...B},...X})}function lo({className:e,day:t,modifiers:s,...c}){let x=(0,Ce.getDefaultClassNames)(),h=Ve.useRef(null);return Ve.useEffect(()=>{s.focused&&h.current?.focus()},[s.focused]),(0,J.jsx)(N,{ref:h,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":s.selected&&!s.range_start&&!s.range_end&&!s.range_middle,"data-range-start":s.range_start,"data-range-end":s.range_end,"data-range-middle":s.range_middle,className:n("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",x.day,e),...c})}var F=require("react/jsx-runtime");function Tt({value:e,onChange:t,placeholder:s,mode:c,externalSearch:x,onExternalChange:h,onlyExternal:B=!1}){let[X,b]=(0,ce.useState)(!1),[w,M]=(0,ce.useState)(e),[A,T]=(0,ce.useState)(e);(0,ce.useEffect)(()=>{B||T(e)},[e,B]);let K=()=>{B||t(w),T(w),x&&h&&h(w),b(!1)},E=()=>{M(A),b(!1)},Q=()=>{let p=c==="single"?null:{from:null,to:null};M(p),B||t(p),T(p),x&&h&&h(p),b(!1)},Y=()=>{let p=B?A:e;return p?c==="single"?(0,de.format)(p,"PPP"):p.from&&p.to?`${(0,de.format)(p.from,"MMM dd")} - ${(0,de.format)(p.to,"MMM dd, yyyy")}`:p.from?`From ${(0,de.format)(p.from,"MMM dd, yyyy")}`:p.to?`To ${(0,de.format)(p.to,"MMM dd, yyyy")}`:s:s},I=p=>{M(c==="single"?p:p||{from:null,to:null})};return(0,F.jsxs)(Pt,{open:X,onOpenChange:b,children:[(0,F.jsx)(Nt,{asChild:!0,children:(0,F.jsxs)(N,{variant:"outline",className:n("w-full justify-start text-left font-normal h-9",!Y()&&"text-muted-foreground"),children:[(0,F.jsx)(Dt.Calendar,{className:"mr-2 h-4 w-4"}),Y()]})}),(0,F.jsxs)(St,{className:"w-auto p-0",align:"start",children:[(0,F.jsx)("div",{className:"p-3",children:(0,F.jsx)(kt,{mode:c,selected:w,onSelect:I,numberOfMonths:c==="range"?2:1,className:"rounded-md border",...c==="range"&&{required:!0}})}),(0,F.jsxs)("div",{className:"flex items-center justify-between p-3 border-t",children:[(0,F.jsx)(N,{variant:"ghost",size:"sm",onClick:Q,children:"Clear"}),(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsx)(N,{variant:"outline",size:"sm",onClick:E,children:"Cancel"}),(0,F.jsx)(N,{size:"sm",onClick:K,disabled:c==="range"&&(!w?.from||!w?.to),children:"Apply"})]})]})]})]})}var i=require("react/jsx-runtime");function zt({table:e,filters:t=[],globalFilter:s,onGlobalFilterChange:c,enableGlobalFilter:x=!0,onExport:h,onRefresh:B,loading:X=!1,enableColumnVisibility:b=!0,data:w,onClearSorting:M,onClearFilters:A,enableColumnPinning:T=!1,onExternalSearch:K,onCustomFilterChange:E}){let[Q,Y]=(0,Qe.useState)({}),[I,p]=(0,Qe.useState)({}),we=()=>e.getAllLeafColumns().filter(o=>o.getCanHide?.()!==!1),ye=()=>e.getAllColumns().filter(o=>!e.getAllLeafColumns().includes(o)&&o.columns?.length&&o.columns.some(m=>m.getCanHide?.()!==!1)),ue=()=>{let o=new Set(ye().flatMap(m=>m.columns?.filter(g=>g.getCanHide?.()!==!1).map(g=>g.id)||[]));return we().filter(m=>!o.has(m.id))},Pe=(o,m)=>m&&o.startsWith(`${m}.`)?o.replace(`${m}.`,"").split("_").map($=>$.slice(1)).join(" "):o.split("_").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" "),ne=(o,m)=>{let g={...Q,[o]:m};Y(g)},Le=(o,m)=>{let g={...I,[o]:m};p(g),E&&E(o,m),t.find($=>$.key===o)?.externalSearch&&ne(o,m)},Ge=()=>{K&&K(Q)},ae=()=>{Y({}),p({}),A(),K&&K({}),E&&Object.keys(I).forEach(o=>{E(o,"")})},me=o=>t.find(g=>g.key===o)?.customFilter?I[o]??"":e.getColumn(o)?.getFilterValue(),re=(o,m)=>{let g=t.find($=>$.key===o);g?.customFilter?Le(o,m):(e.getColumn(o)?.setFilterValue(m),g?.externalSearch&&ne(o,m))};return(0,i.jsx)("div",{className:"rounded-xl",children:(0,i.jsx)("div",{className:"px-2",children:(0,i.jsx)("div",{className:"flex flex-col gap-6",children:(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,i.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,i.jsx)(k.Filter,{className:"h-4 w-4"})}),t.map(o=>!e.getColumn(o.key)&&!o.customFilter&&!o.externalSearch?null:(0,i.jsx)("div",{className:n("relative min-w-[150px]",o.width),children:o.type==="select"?(0,i.jsxs)(Me,{value:me(o.key)??"",onValueChange:g=>{re(o.key,g==="all"?"":g)},children:[o.icon&&(0,i.jsx)("span",{children:(0,i.jsx)(o.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,i.jsx)(Ie,{className:n("h-9 rounded-lg w-full",o.icon&&"pl-9"),children:(0,i.jsx)(Re,{placeholder:o.placeholder})}),(0,i.jsxs)(_e,{className:"rounded-lg",children:[(0,i.jsx)(ge,{value:"all",children:"All"}),o.options?.map(g=>(0,i.jsx)(ge,{value:g.value,children:g.label},g.label))]})]}):o.type==="date"?(0,i.jsx)(Tt,{value:me(o.key),onChange:g=>{o.onlyExternal||re(o.key,g)},placeholder:o.placeholder,mode:o.dateMode||"single",externalSearch:o.externalSearch,onlyExternal:o.onlyExternal,onExternalChange:g=>ne(o.key,g)}):(0,i.jsxs)("div",{className:"relative",children:[o.icon&&(0,i.jsx)("span",{children:(0,i.jsx)(o.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,i.jsx)(Je,{placeholder:o.placeholder,value:me(o.key)??"",onChange:g=>{re(o.key,g.target.value)},className:n("h-9 rounded-lg",o.icon&&"pl-9"),type:o.type==="number"?"number":"text"})]})},o.key)),(t.some(o=>o.externalSearch)||t.some(o=>o.customFilter))&&(0,i.jsxs)(N,{variant:"default",size:"sm",onClick:Ge,className:"rounded-lg",children:[(0,i.jsx)(k.Search,{className:"mr-2 h-4 w-4"}),t.find(o=>o.externalSearch||o.customFilter)?.searchButtonText||"Search"]})]})}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)(k.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,i.jsx)(Je,{placeholder:"Global search...",value:s??"",onChange:o=>c(o.target.value),className:"pl-9 max-w-max"})]}),h&&(0,i.jsxs)(N,{variant:"outline",size:"sm",onClick:()=>h(w),className:"rounded-lg",children:[(0,i.jsx)(k.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),b&&(0,i.jsxs)(fe,{children:[(0,i.jsx)(be,{asChild:!0,children:(0,i.jsxs)(N,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,i.jsx)("span",{children:"Columns"}),(0,i.jsx)(k.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,i.jsxs)(ve,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,i.jsx)(q,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,i.jsx)(oe,{}),ue().length>0&&(0,i.jsxs)(Xe,{children:[(0,i.jsx)(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),ue().map(o=>(0,i.jsx)(Ke,{className:"text-sm",checked:o.getIsVisible(),onCheckedChange:m=>o.toggleVisibility(!!m),children:Pe(o.id)},o.id))]}),ye().map(o=>(0,i.jsxs)(Xe,{children:[(0,i.jsx)(oe,{}),(0,i.jsx)(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:o.id}),o.columns?.filter(m=>m.getCanHide?.()!==!1).map(m=>(0,i.jsx)(Ke,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:g=>m.toggleVisibility(!!g),children:Pe(m.id,o.id)},m.id))]},o.id))]})]}),(0,i.jsxs)(fe,{children:[(0,i.jsx)(be,{asChild:!0,children:(0,i.jsx)(N,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,i.jsx)(k.Settings2,{className:"h-4 w-4"})})}),(0,i.jsxs)(ve,{align:"end",className:"w-[200px] rounded-lg",children:[(0,i.jsx)(q,{children:"Table Settings"}),(0,i.jsx)(oe,{}),(0,i.jsxs)(U,{onClick:M,children:[(0,i.jsx)(k.ArrowUpDown,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),(0,i.jsxs)(U,{onClick:ae,children:[(0,i.jsx)(k.Filter,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),T&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(oe,{}),(0,i.jsx)(q,{children:"Column Pinning"}),(0,i.jsxs)(U,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,i.jsx)(k.PinOff,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),(0,i.jsxs)(U,{onClick:()=>{let o=we().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:[],right:o})},children:[(0,i.jsx)(k.Pin,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),B&&(0,i.jsx)(N,{variant:"outline",size:"sm",onClick:B,disabled:X,className:"rounded-lg",children:(0,i.jsx)(k.RefreshCw,{className:n("h-4 w-4",X&&"animate-spin")})})]})]})})})})}var y=require("react/jsx-runtime");function Mt({table:e,config:t}){return t.enabled?(0,y.jsx)("div",{className:"rounded-xl",children:(0,y.jsx)("div",{children:(0,y.jsxs)("div",{className:"flex items-center justify-between",children:[(0,y.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,y.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,y.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,y.jsxs)(Me,{value:`${e.getState().pagination.pageSize}`,onValueChange:s=>e.setPageSize(Number(s)),children:[(0,y.jsx)(Ie,{className:"h-9 w-[70px] rounded-lg",children:(0,y.jsx)(Re,{})}),(0,y.jsx)(_e,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(s=>(0,y.jsx)(ge,{value:`${s}`,children:s},s))})]})]}),(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,y.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(s,c)=>{let x=e.getState().pagination.pageIndex,h=x+c;return h<1||h>e.getPageCount()?null:(0,y.jsx)(N,{variant:h===x+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(h-1),children:h},h)})}),(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Rt=require("radix-ui"),It=require("class-variance-authority");var Ft=require("react/jsx-runtime"),co=(0,It.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 _t({className:e,variant:t,size:s,noBg:c,...x}){return(0,Ft.jsx)(Rt.Toggle.Root,{"data-slot":"toggle",className:n(co({className:e,variant:t,size:s,bg:c?"disabled":"enabled"})),...x})}var Ye=require("radix-ui"),Vt=require("lucide-react");var Be=require("react/jsx-runtime");function Ze({className:e,...t}){return(0,Be.jsx)(Ye.Checkbox.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,Be.jsx)(Ye.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,Be.jsx)(Vt.CheckIcon,{className:"size-3.5"})})})}var P=require("react"),r=require("react/jsx-runtime");function uo({data:e,columns:t,filters:s=[],pagination:c={enabled:!1},settings:x={},header:h,footer:B,className:X="",maxHeight:b="600px",loading:w=!1,error:M,emptyMessage:A="No data available",onRowSelectionChange:T,onExport:K,onRefresh:E,onTableReady:Q,children:Y,isRowDisabled:I,isRowSelectable:p,onExternalSearch:we}){let[ye,ue]=(0,P.useState)([]),[Pe,ne]=(0,P.useState)([]),[Le,Ge]=(0,P.useState)({}),[ae,me]=(0,P.useState)({}),[re,o]=(0,P.useState)(""),[m,g]=(0,P.useState)([]),[$,Bt]=(0,P.useState)(x.enableColumnPinning?{left:[],right:[]}:{}),[Ae,Lt]=(0,P.useState)({}),et=(0,P.useMemo)(()=>Object.keys(Ae).length===0?e:e.filter(d=>Object.entries(Ae).every(([u,a])=>{if(!a||a==="")return!0;let f=$t(d,u);return typeof a=="string"?String(f).toLowerCase().includes(a.toLowerCase()):f===a})),[e,Ae]),{enableSorting:He=!0,enableFiltering:Oe=!0,enableGlobalFilter:tt=!0,enableColumnVisibility:je=!0,enableRowSelection:R=!0,stickyHeader:Gt=!0,toolbar:At=!1,showSerialNumbers:ee=!0,fixedCheckboxColumn:Ne=!0,striped:Ht=!0,hoverable:Ot=!0,compact:ot=!0,bordered:nt=!0,fullHeight:jt=!1,enableColumnResizing:at=!1,enableColumnPinning:L=!0,hideHeader:Ut=!1,selectionMode:Z="multiple",showCheckBox:Et=!0,checkboxColumnPosition:rt=0}=x,$t=(d,u)=>u.split(".").reduce((a,f)=>a&&a[f],d),Wt=(0,P.useCallback)((d,u)=>{Lt(a=>{let f={...a};return u===""||u===null||u===void 0?delete f[d]:f[d]=u,f})},[]),Ue=(0,P.useMemo)(()=>{let d=[...t],u=l=>l.map(v=>{if(v.id==="select"||v.id==="serialNumber")return v;let z={...v,enablePinning:!0};return v.columns&&(z.columns=u(v.columns)),z}),a=u(d),f={id:"select",header:({table:l})=>{if(Z==="single")return null;let v=l.getRowModel().rows.filter(H=>!I?.(H.original)&&(p?p(H.original):!0)),z=v.length>0&&v.every(H=>H.getIsSelected()),O=v.some(H=>H.getIsSelected());return(0,r.jsx)(Ze,{checked:z||O&&"indeterminate",onCheckedChange:H=>{v.forEach(ie=>ie.toggleSelected(!!H))},"aria-label":"Select all selectable rows"})},cell:({row:l})=>{let v=I?I(l.original):!1,z=p?p(l.original):!0;return(0,r.jsx)("div",{className:n("flex items-center justify-center",v&&"opacity-50"),children:Z==="multiple"?(0,r.jsx)(Ze,{checked:l.getIsSelected(),onCheckedChange:O=>z&&l.toggleSelected(!!O),"aria-label":"Select row",disabled:v||!z}):Et?(0,r.jsx)("input",{type:"radio",checked:l.getIsSelected(),onChange:()=>z&&l.toggleSelected(!0),disabled:v||!z,className:"h-4 w-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:Z==="multiple"?40:30};if(R){let l=rt;l<0&&(l=a.length+l+1),l=Math.max(0,Math.min(l,a.length)),a.splice(l,0,f)}if(ee){let l={id:"serialNumber",header:"No.",cell:({row:v})=>(0,r.jsx)("div",{className:"text-center font-medium text-muted-foreground",children:v.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};a.unshift(l)}return a},[t,ee,R,Ne,I,p,Z,rt]),C=(0,V.useReactTable)({data:et,columns:Ue,onSortingChange:He?ue:void 0,onColumnFiltersChange:Oe?ne:void 0,onGlobalFilterChange:tt?o:void 0,getCoreRowModel:(0,V.getCoreRowModel)(),getPaginationRowModel:c.enabled?(0,V.getPaginationRowModel)():void 0,getSortedRowModel:He?(0,V.getSortedRowModel)():void 0,getFilteredRowModel:Oe?(0,V.getFilteredRowModel)():void 0,onColumnVisibilityChange:je?Ge:void 0,onRowSelectionChange:R?me:void 0,onColumnOrderChange:g,onColumnPinningChange:L?Bt:void 0,state:{sorting:He?ye:void 0,columnFilters:Oe?Pe:void 0,columnVisibility:je?Le:void 0,rowSelection:R?ae:{},globalFilter:re,columnOrder:m,columnPinning:L?$:{}},initialState:{pagination:c.enabled?{pageSize:c.pageSize||10}:void 0,columnPinning:L?{left:[...ee?["serialNumber"]:[],...R?["select"]:[]],right:[]}:void 0},enableRowSelection:R,enableColumnResizing:at,enableColumnPinning:L,columnResizeMode:"onChange"});(0,P.useEffect)(()=>{if(R&&T){let d=C.getFilteredSelectedRowModel().rows.filter(u=>!I?.(u.original)&&(p?p(u.original):!0)).map(u=>u.original);T(d)}},[ae,R,T,C,I,p]);let qt=(0,P.useCallback)(d=>{Z==="single"?(C.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[Z,C]);(0,P.useEffect)(()=>{Q&&Q(C)},[C,Q]),(0,P.useEffect)(()=>{if(R&&T){let d=C.getFilteredSelectedRowModel().rows.map(u=>u.original);T(d)}},[ae,R,T,C]),(0,P.useEffect)(()=>{if(R&&T){let d=C.getFilteredSelectedRowModel().rows.filter(u=>!I?.(u.original)&&(p?p(u.original):!0)).map(u=>u.original);T(d)}},[ae,R,T,C,I,p]);let Jt=(0,P.useCallback)(()=>{ue([])},[]),Xt=(0,P.useCallback)(()=>{ne([]),o("")},[]),it=(d,u)=>{if(!L)return;let a=[...ee?["serialNumber"]:[],...R&&Ne?["select"]:[]],f={left:[...($.left??[]).filter(l=>a.includes(l))],right:[...$.right??[]]};u===!1?(f.left=f.left.filter(l=>l!==d),f.right=f.right.filter(l=>l!==d)):u==="right"?(f.left=f.left.filter(l=>l!==d),f.right.includes(d)||f.right.push(d)):u==="left"&&(f.right=f.right.filter(l=>l!==d),!f.left.includes(d)&&!a.includes(d)&&f.left.push(d)),C.setColumnPinning(f)},Kt=()=>(0,r.jsx)(bt,{className:n(Gt&&"sticky top-0 bg-sidebar z-20"),children:C.getHeaderGroups().map((d,u)=>(0,r.jsx)(pe,{className:"hover:bg-transparent",children:d.headers.map((a,f)=>{let l=a.depth===0&&a.colSpan>1,v=L&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&R),z=L&&a.column.getIsPinned()==="right",O=a.column.getCanSort(),H=L&&a.column.columnDef.enablePinning!==!1,ie=a.column.id==="serialNumber",Ee=a.column.id==="select",dt=ie||Ee&&Ne,se=a.column.columnDef.headerAlign||"left",Qt={left:"justify-start",center:"justify-center",right:"justify-end"}[se];return(0,r.jsxs)(ht,{colSpan:a.colSpan,className:n("font-semibold text-foreground bg-sidebar group px-0",!ot&&"py-2",nt&&f<d.headers.length-1&&"border-r","relative",v&&"sticky left-0 z-15 bg-sidebar",z&&"sticky right-0 z-15 bg-sidebar",(ie||Ee)&&"sticky left-0 z-15 bg-sidebar",l?"text-center":"text-left"),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...v&&{left:ie?0:Ee?ee&&C.getColumn("serialNumber")?.getSize()||0:st(a.column)},...z&&{right:lt(a.column)},...ie&&{left:0}},children:[l?(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,V.flexRender)(a.column.columnDef.header,a.getContext())}):(0,r.jsxs)("div",{className:n("relative flex items-center w-full px-2",Qt),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[O&&se==="right"&&(0,r.jsx)("span",{className:"ml-1 order-2",children:a.column.getIsSorted()&&{asc:(0,r.jsx)(D.ChevronUp,{className:"h-4 w-4"}),desc:(0,r.jsx)(D.ChevronDown,{className:"h-4 w-4"})}[a.column.getIsSorted()]}),a.isPlaceholder?null:(0,V.flexRender)(a.column.columnDef.header,a.getContext()),O&&se!=="right"&&a.column.getIsSorted()&&(0,r.jsx)("span",{className:"ml-1 order-2",children:a.column.getIsSorted()&&{asc:(0,r.jsx)(D.ChevronUp,{className:"h-4 w-4"}),desc:(0,r.jsx)(D.ChevronDown,{className:"h-4 w-4"})}[a.column.getIsSorted()]})]}),(O||H&&!dt)&&(0,r.jsxs)(fe,{children:[(0,r.jsx)(be,{asChild:!0,className:n("absolute",se==="left"&&"right-1",se==="center"&&"right-1",se==="right"&&"left-1"),children:(0,r.jsx)(_t,{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,r.jsx)(D.MoreHorizontal,{className:"h-4 w-4"})})}),(0,r.jsxs)(ve,{align:"end",className:"w-48",children:[O&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q,{children:"Sorting"}),(0,r.jsxs)(U,{onClick:()=>a.column.toggleSorting(!1),children:[(0,r.jsx)(D.ChevronUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),(0,r.jsxs)(U,{onClick:()=>a.column.toggleSorting(!0),children:[(0,r.jsx)(D.ChevronDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),(0,r.jsxs)(U,{onClick:()=>a.column.clearSorting(),disabled:!a.column.getIsSorted(),children:[(0,r.jsx)(D.ChevronsUpDown,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),(0,r.jsx)(oe,{})]}),H&&!dt&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q,{children:"Pin Column"}),(0,r.jsxs)(U,{onClick:()=>it(a.column.id,"right"),disabled:a.column.getIsPinned()==="right",children:[(0,r.jsx)(D.MoveRightIcon,{}),"Pin Right"]}),(0,r.jsxs)(U,{onClick:()=>it(a.column.id,!1),disabled:!a.column.getIsPinned(),children:[(0,r.jsx)(D.PinOffIcon,{}),"Unpin"]})]})]})]})]}),at&&a.column.getCanResize()&&!l&&a.colSpan===1&&(0,r.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:a.getResizeHandler()})]},a.id)})},d.id))}),st=d=>{if(!L)return;let u=0,a=C.getLeftHeaderGroups()[0]?.headers||[],f=[...ee?["serialNumber"]:[],...R?["select"]:[]];for(let l of a){if(l.id===d.id)break;if(f.includes(l.id)){let v=C.getColumn(l.id);v&&(u+=v.getSize())}}return u},lt=d=>{if(!L)return;let u=C.getState().columnPinning.right||[],a=u.indexOf(d.id);if(a===-1)return;let f=0;for(let l=a+1;l<u.length;l++){let v=C.getColumn(u[l]);v&&(f+=v.getSize())}return f};return M?(0,r.jsx)(Te,{className:"w-full rounded-xl shadow-sm",children:(0,r.jsx)(ze,{className:"flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:M}),E&&(0,r.jsxs)(N,{variant:"outline",size:"sm",onClick:E,className:"rounded-lg",children:[(0,r.jsx)(D.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,r.jsx)(wt,{children:(0,r.jsxs)("div",{className:n("w-full space-y-2 flex flex-col h-full",X),children:[h&&(0,r.jsx)(Te,{className:"rounded-2xl py-2 sticky top-0 z-20",children:(0,r.jsx)(ze,{className:"px-2",children:h})}),At&&(0,r.jsx)(zt,{table:C,filters:s,globalFilter:re,onGlobalFilterChange:o,enableGlobalFilter:tt,onExport:K,onRefresh:E,loading:w,enableColumnVisibility:je,enableColumnPinning:L,data:et,onClearSorting:Jt,onClearFilters:Xt,onExternalSearch:we,onCustomFilterChange:Wt}),(0,r.jsx)(Te,{className:n("shadow-sm overflow-auto py-0",jt&&"flex-1"),children:(0,r.jsx)(ze,{className:"p-0 h-full",children:(0,r.jsxs)("div",{className:"relative flex flex-col h-full justify-between",children:[w&&(0,r.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,r.jsx)(D.Loader2,{className:"size-5 animate-spin text-primary"}),(0,r.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),(0,r.jsx)("div",{className:"relative rounded-t-xl overflow-auto border-b",children:(0,r.jsxs)($e,{className:"border-collapse w-full",children:[!Ut&&Kt(),(0,r.jsx)(vt,{children:C.getRowModel().rows?.length?C.getRowModel().rows.map((d,u)=>(0,r.jsx)(pe,{"data-state":d.getIsSelected()&&"selected",className:n(Ot&&"hover:bg-muted/50",Ht&&u%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",Z==="single"&&"cursor-pointer"),onClick:()=>{Z==="single"&&qt(d)},children:d.getVisibleCells().map((a,f)=>{let l=L&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&R),v=L&&a.column.getIsPinned()==="right",z=a.column.id==="serialNumber",O=a.column.id==="select",H=z||O&&Ne;return(0,r.jsx)(De,{className:n(ot?"py-2":"py-4",nt&&f<d.getVisibleCells().length&&"border-r",l&&"sticky left-0 z-10 bg-sidebar/97",v&&"sticky right-0 z-10 bg-sidebar/97",z&&"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",...l&&{left:z?0:O?ee&&C.getColumn("serialNumber")?.getSize()||0:st(a.column)},...v&&{right:lt(a.column)},...z&&{left:0}},children:(0,V.flexRender)(a.column.columnDef.cell,a.getContext())},a.id)})},d.id)):(0,r.jsx)(pe,{children:(0,r.jsx)(De,{colSpan:Ue.length,className:"h-32 text-center border-0",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:A})]})})})})]})}),B&&(0,r.jsx)("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:(0,r.jsx)($e,{children:(0,r.jsx)(xt,{children:(0,r.jsx)(pe,{className:"bg-sidebar",children:(0,r.jsx)(De,{colSpan:Ue.length,className:"p-2",children:B})})})})})]})})}),(0,r.jsx)(Mt,{table:C,config:c}),Y&&Y(C)]})})}0&&(module.exports={DataTable});
|
|
2
|
+
"use strict";var Yt=Object.create;var Se=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var eo=Object.getOwnPropertyNames;var to=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var no=(e,t)=>{for(var s in t)Se(e,s,{get:t[s],enumerable:!0})},ct=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let h of eo(t))!oo.call(e,h)&&h!==s&&Se(e,h,{get:()=>t[h],enumerable:!(c=Zt(t,h))||c.enumerable});return e};var ao=(e,t,s)=>(s=e!=null?Yt(to(e)):{},ct(t||!e||!e.__esModule?Se(s,"default",{value:e,enumerable:!0}):s,e)),ro=e=>ct(Se({},"__esModule",{value:!0}),e);var mo={};no(mo,{DataTable:()=>uo});module.exports=ro(mo);var V=require("@tanstack/react-table"),D=require("lucide-react");var pt=require("radix-ui"),gt=require("class-variance-authority");var ut=require("clsx"),mt=require("tailwind-merge");function o(...e){return(0,mt.twMerge)((0,ut.clsx)(e))}var ft=require("react/jsx-runtime"),ke=(0,gt.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 N({className:e,variant:t,size:s,asChild:c=!1,...h}){let C=c?pt.Slot.Slot:"button";return(0,ft.jsx)(C,{"data-slot":"button",className:o(ke({variant:t,size:s,className:e}),"transition-none"),...h})}var W=require("react/jsx-runtime");function $e({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:(0,W.jsx)("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function bt({className:e,...t}){return(0,W.jsx)("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function vt({className:e,...t}){return(0,W.jsx)("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function ht({className:e,...t}){return(0,W.jsx)("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(0,W.jsx)("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function xt({className:e,...t}){return(0,W.jsx)("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function De({className:e,...t}){return(0,W.jsx)("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}var We=require("react/jsx-runtime");function Te({className:e,...t}){return(0,We.jsx)("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 ze({className:e,...t}){return(0,We.jsx)("div",{"data-slot":"card-content",className:o("px-6",e),...t})}var Ct=require("radix-ui");var qe=require("react/jsx-runtime");function wt({delayDuration:e=0,...t}){return(0,qe.jsx)(Ct.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}var k=require("lucide-react");var yt=require("react/jsx-runtime");function Je({className:e,type:t,...s}){return(0,yt.jsx)("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),...s})}var G=require("radix-ui"),te=require("lucide-react");var S=require("react/jsx-runtime");function Me({...e}){return(0,S.jsx)(G.Select.Root,{"data-slot":"select",...e})}function Re({...e}){return(0,S.jsx)(G.Select.Value,{"data-slot":"select-value",...e})}function Ie({className:e,size:t="default",children:s,...c}){return(0,S.jsxs)(G.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:o("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...c,children:[s,(0,S.jsx)(G.Select.Icon,{asChild:!0,children:(0,S.jsx)(te.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function _e({className:e,children:t,position:s="popper",...c}){return(0,S.jsx)(G.Select.Portal,{children:(0,S.jsxs)(G.Select.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",s==="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:s,...c,children:[(0,S.jsx)(io,{}),(0,S.jsx)(G.Select.Viewport,{className:o("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,S.jsx)(so,{})]})})}function ge({className:e,children:t,...s}){return(0,S.jsxs)(G.Select.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),...s,children:[(0,S.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,S.jsx)(G.Select.ItemIndicator,{children:(0,S.jsx)(te.CheckIcon,{className:"size-4"})})}),(0,S.jsx)(G.Select.ItemText,{children:t})]})}function io({className:e,...t}){return(0,S.jsx)(G.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:(0,S.jsx)(te.ChevronUpIcon,{className:"size-4"})})}function so({className:e,...t}){return(0,S.jsx)(G.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:(0,S.jsx)(te.ChevronDownIcon,{className:"size-4"})})}var j=require("radix-ui"),Fe=require("lucide-react");var _=require("react/jsx-runtime");function fe({...e}){return(0,_.jsx)(j.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function be({...e}){return(0,_.jsx)(j.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ve({className:e,sideOffset:t=4,...s}){return(0,_.jsx)(j.DropdownMenu.Portal,{children:(0,_.jsx)(j.DropdownMenu.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),...s})})}function Xe({...e}){return(0,_.jsx)(j.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function U({className:e,inset:t,variant:s="default",...c}){return(0,_.jsx)(j.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":s,className:o("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...c})}function Ke({className:e,children:t,checked:s,...c}){return(0,_.jsxs)(j.DropdownMenu.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:s,...c,children:[(0,_.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,_.jsx)(j.DropdownMenu.ItemIndicator,{children:(0,_.jsx)(Fe.CheckIcon,{className:"size-4"})})}),t]})}function q({className:e,inset:t,...s}){return(0,_.jsx)(j.DropdownMenu.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),...s})}function oe({className:e,...t}){return(0,_.jsx)(j.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}var Qe=require("react");var ce=require("react"),Dt=require("lucide-react"),de=require("date-fns");var he=require("radix-ui");var xe=require("react/jsx-runtime");function Pt({...e}){return(0,xe.jsx)(he.Popover.Root,{"data-slot":"popover",...e})}function Nt({...e}){return(0,xe.jsx)(he.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function St({className:e,align:t="center",sideOffset:s=4,...c}){return(0,xe.jsx)(he.Popover.Portal,{children:(0,xe.jsx)(he.Popover.Content,{"data-slot":"popover-content",align:t,sideOffset:s,className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...c})})}var Ve=ao(require("react"),1),le=require("lucide-react"),Ce=require("react-day-picker");var J=require("react/jsx-runtime");function kt({className:e,classNames:t,showOutsideDays:s=!0,captionLayout:c="label",buttonVariant:h="ghost",formatters:C,components:B,...X}){let b=(0,Ce.getDefaultClassNames)();return(0,J.jsx)(Ce.DayPicker,{showOutsideDays:s,className:o("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:c,formatters:{formatMonthDropdown:w=>w.toLocaleString("default",{month:"short"}),...C},classNames:{root:o("w-fit",b.root),months:o("flex gap-4 flex-col md:flex-row relative",b.months),month:o("flex flex-col w-full gap-4",b.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",b.nav),button_previous:o(ke({variant:h}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",b.button_previous),button_next:o(ke({variant:h}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",b.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",b.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",b.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",b.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",b.dropdown),caption_label:o("select-none font-medium",c==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",b.caption_label),table:"w-full border-collapse",weekdays:o("flex",b.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",b.weekday),week:o("flex w-full mt-2",b.week),week_number_header:o("select-none w-(--cell-size)",b.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",b.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",b.day),range_start:o("rounded-l-md bg-accent",b.range_start),range_middle:o("rounded-none",b.range_middle),range_end:o("rounded-r-md bg-accent",b.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",b.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",b.outside),disabled:o("text-muted-foreground opacity-50",b.disabled),hidden:o("invisible",b.hidden),...t},components:{Root:({className:w,rootRef:M,...A})=>(0,J.jsx)("div",{"data-slot":"calendar",ref:M,className:o(w),...A}),Chevron:({className:w,orientation:M,...A})=>M==="left"?(0,J.jsx)(le.ChevronLeftIcon,{className:o("size-4",w),...A}):M==="right"?(0,J.jsx)(le.ChevronRightIcon,{className:o("size-4",w),...A}):(0,J.jsx)(le.ChevronDownIcon,{className:o("size-4",w),...A}),DayButton:lo,WeekNumber:({children:w,...M})=>(0,J.jsx)("td",{...M,children:(0,J.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:w})}),...B},...X})}function lo({className:e,day:t,modifiers:s,...c}){let h=(0,Ce.getDefaultClassNames)(),C=Ve.useRef(null);return Ve.useEffect(()=>{s.focused&&C.current?.focus()},[s.focused]),(0,J.jsx)(N,{ref:C,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":s.selected&&!s.range_start&&!s.range_end&&!s.range_middle,"data-range-start":s.range_start,"data-range-end":s.range_end,"data-range-middle":s.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",h.day,e),...c})}var F=require("react/jsx-runtime");function Tt({value:e,onChange:t,placeholder:s,mode:c,externalSearch:h,onExternalChange:C,onlyExternal:B=!1}){let[X,b]=(0,ce.useState)(!1),[w,M]=(0,ce.useState)(e),[A,T]=(0,ce.useState)(e);(0,ce.useEffect)(()=>{B||T(e)},[e,B]);let K=()=>{B||t(w),T(w),h&&C&&C(w),b(!1)},E=()=>{M(A),b(!1)},Q=()=>{let p=c==="single"?null:{from:null,to:null};M(p),B||t(p),T(p),h&&C&&C(p),b(!1)},Y=()=>{let p=B?A:e;return p?c==="single"?(0,de.format)(p,"PPP"):p.from&&p.to?`${(0,de.format)(p.from,"MMM dd")} - ${(0,de.format)(p.to,"MMM dd, yyyy")}`:p.from?`From ${(0,de.format)(p.from,"MMM dd, yyyy")}`:p.to?`To ${(0,de.format)(p.to,"MMM dd, yyyy")}`:s:s},I=p=>{M(c==="single"?p:p||{from:null,to:null})};return(0,F.jsxs)(Pt,{open:X,onOpenChange:b,children:[(0,F.jsx)(Nt,{asChild:!0,children:(0,F.jsxs)(N,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!Y()&&"text-muted-foreground"),children:[(0,F.jsx)(Dt.Calendar,{className:"mr-2 h-4 w-4"}),Y()]})}),(0,F.jsxs)(St,{className:"w-auto p-0",align:"start",children:[(0,F.jsx)("div",{className:"p-3",children:(0,F.jsx)(kt,{mode:c,selected:w,onSelect:I,numberOfMonths:c==="range"?2:1,className:"rounded-md border",...c==="range"&&{required:!0}})}),(0,F.jsxs)("div",{className:"flex items-center justify-between p-3 border-t",children:[(0,F.jsx)(N,{variant:"ghost",size:"sm",onClick:Q,children:"Clear"}),(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsx)(N,{variant:"outline",size:"sm",onClick:E,children:"Cancel"}),(0,F.jsx)(N,{size:"sm",onClick:K,disabled:c==="range"&&(!w?.from||!w?.to),children:"Apply"})]})]})]})]})}var i=require("react/jsx-runtime");function zt({table:e,filters:t=[],globalFilter:s,onGlobalFilterChange:c,enableGlobalFilter:h=!0,onExport:C,onRefresh:B,loading:X=!1,enableColumnVisibility:b=!0,data:w,onClearSorting:M,onClearFilters:A,enableColumnPinning:T=!1,onExternalSearch:K,onCustomFilterChange:E}){let[Q,Y]=(0,Qe.useState)({}),[I,p]=(0,Qe.useState)({}),we=()=>e.getAllLeafColumns().filter(n=>n.getCanHide?.()!==!1),ye=()=>e.getAllColumns().filter(n=>!e.getAllLeafColumns().includes(n)&&n.columns?.length&&n.columns.some(m=>m.getCanHide?.()!==!1)),ue=()=>{let n=new Set(ye().flatMap(m=>m.columns?.filter(g=>g.getCanHide?.()!==!1).map(g=>g.id)||[]));return we().filter(m=>!n.has(m.id))},Pe=(n,m)=>m&&n.startsWith(`${m}.`)?n.replace(`${m}.`,"").split("_").map($=>$.slice(1)).join(" "):n.split("_").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" "),ne=(n,m)=>{let g={...Q,[n]:m};Y(g)},Le=(n,m)=>{let g={...I,[n]:m};p(g),E&&E(n,m),t.find($=>$.key===n)?.externalSearch&&ne(n,m)},Ge=()=>{K&&K(Q)},ae=()=>{Y({}),p({}),A(),K&&K({}),E&&Object.keys(I).forEach(n=>{E(n,"")})},me=n=>t.find(g=>g.key===n)?.customFilter?I[n]??"":e.getColumn(n)?.getFilterValue(),re=(n,m)=>{let g=t.find($=>$.key===n);g?.customFilter?Le(n,m):(e.getColumn(n)?.setFilterValue(m),g?.externalSearch&&ne(n,m))};return(0,i.jsx)("div",{className:"rounded-xl",children:(0,i.jsx)("div",{className:"px-2",children:(0,i.jsx)("div",{className:"flex flex-col gap-6",children:(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,i.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,i.jsx)(k.Filter,{className:"h-4 w-4"})}),t.map(n=>!e.getColumn(n.key)&&!n.customFilter&&!n.externalSearch?null:(0,i.jsx)("div",{className:o("relative min-w-[150px]",n.width),children:n.type==="select"?(0,i.jsxs)(Me,{value:me(n.key)??"",onValueChange:g=>{re(n.key,g==="all"?"":g)},children:[n.icon&&(0,i.jsx)("span",{children:(0,i.jsx)(n.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,i.jsx)(Ie,{className:o("h-9 rounded-lg w-full",n.icon&&"pl-9"),children:(0,i.jsx)(Re,{placeholder:n.placeholder})}),(0,i.jsxs)(_e,{className:"rounded-lg",children:[(0,i.jsx)(ge,{value:"all",children:"All"}),n.options?.map(g=>(0,i.jsx)(ge,{value:g.value,children:g.label},g.label))]})]}):n.type==="date"?(0,i.jsx)(Tt,{value:me(n.key),onChange:g=>{n.onlyExternal||re(n.key,g)},placeholder:n.placeholder,mode:n.dateMode||"single",externalSearch:n.externalSearch,onlyExternal:n.onlyExternal,onExternalChange:g=>ne(n.key,g)}):(0,i.jsxs)("div",{className:"relative",children:[n.icon&&(0,i.jsx)("span",{children:(0,i.jsx)(n.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,i.jsx)(Je,{placeholder:n.placeholder,value:me(n.key)??"",onChange:g=>{re(n.key,g.target.value)},className:o("h-9 rounded-lg",n.icon&&"pl-9"),type:n.type==="number"?"number":"text"})]})},n.key)),(t.some(n=>n.externalSearch)||t.some(n=>n.customFilter))&&(0,i.jsxs)(N,{variant:"default",size:"sm",onClick:Ge,className:"rounded-lg",children:[(0,i.jsx)(k.Search,{className:"mr-2 h-4 w-4"}),t.find(n=>n.externalSearch||n.customFilter)?.searchButtonText||"Search"]})]})}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[h&&(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)(k.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,i.jsx)(Je,{placeholder:"Global search...",value:s??"",onChange:n=>c(n.target.value),className:"pl-9 max-w-max"})]}),C&&(0,i.jsxs)(N,{variant:"outline",size:"sm",onClick:()=>C(w),className:"rounded-lg",children:[(0,i.jsx)(k.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),b&&(0,i.jsxs)(fe,{children:[(0,i.jsx)(be,{asChild:!0,children:(0,i.jsxs)(N,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,i.jsx)("span",{children:"Columns"}),(0,i.jsx)(k.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,i.jsxs)(ve,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,i.jsx)(q,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,i.jsx)(oe,{}),ue().length>0&&(0,i.jsxs)(Xe,{children:[(0,i.jsx)(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),ue().map(n=>(0,i.jsx)(Ke,{className:"text-sm",checked:n.getIsVisible(),onCheckedChange:m=>n.toggleVisibility(!!m),children:Pe(n.id)},n.id))]}),ye().map(n=>(0,i.jsxs)(Xe,{children:[(0,i.jsx)(oe,{}),(0,i.jsx)(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:n.id}),n.columns?.filter(m=>m.getCanHide?.()!==!1).map(m=>(0,i.jsx)(Ke,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:g=>m.toggleVisibility(!!g),children:Pe(m.id,n.id)},m.id))]},n.id))]})]}),(0,i.jsxs)(fe,{children:[(0,i.jsx)(be,{asChild:!0,children:(0,i.jsx)(N,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,i.jsx)(k.Settings2,{className:"h-4 w-4"})})}),(0,i.jsxs)(ve,{align:"end",className:"w-[200px] rounded-lg",children:[(0,i.jsx)(q,{children:"Table Settings"}),(0,i.jsx)(oe,{}),(0,i.jsxs)(U,{onClick:M,children:[(0,i.jsx)(k.ArrowUpDown,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),(0,i.jsxs)(U,{onClick:ae,children:[(0,i.jsx)(k.Filter,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),T&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(oe,{}),(0,i.jsx)(q,{children:"Column Pinning"}),(0,i.jsxs)(U,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,i.jsx)(k.PinOff,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),(0,i.jsxs)(U,{onClick:()=>{let n=we().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:[],right:n})},children:[(0,i.jsx)(k.Pin,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),B&&(0,i.jsx)(N,{variant:"outline",size:"sm",onClick:B,disabled:X,className:"rounded-lg",children:(0,i.jsx)(k.RefreshCw,{className:o("h-4 w-4",X&&"animate-spin")})})]})]})})})})}var y=require("react/jsx-runtime");function Mt({table:e,config:t}){return t.enabled?(0,y.jsx)("div",{className:"rounded-xl",children:(0,y.jsx)("div",{children:(0,y.jsxs)("div",{className:"flex items-center justify-between",children:[(0,y.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,y.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,y.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,y.jsxs)(Me,{value:`${e.getState().pagination.pageSize}`,onValueChange:s=>e.setPageSize(Number(s)),children:[(0,y.jsx)(Ie,{className:"h-9 w-[70px] rounded-lg",children:(0,y.jsx)(Re,{})}),(0,y.jsx)(_e,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(s=>(0,y.jsx)(ge,{value:`${s}`,children:s},s))})]})]}),(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,y.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(s,c)=>{let h=e.getState().pagination.pageIndex,C=h+c;return C<1||C>e.getPageCount()?null:(0,y.jsx)(N,{variant:C===h+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(C-1),children:C},C)})}),(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,y.jsx)(N,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Rt=require("radix-ui"),It=require("class-variance-authority");var Ft=require("react/jsx-runtime"),co=(0,It.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 _t({className:e,variant:t,size:s,noBg:c,...h}){return(0,Ft.jsx)(Rt.Toggle.Root,{"data-slot":"toggle",className:o(co({className:e,variant:t,size:s,bg:c?"disabled":"enabled"})),...h})}var Ye=require("radix-ui"),Vt=require("lucide-react");var Be=require("react/jsx-runtime");function Ze({className:e,...t}){return(0,Be.jsx)(Ye.Checkbox.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:(0,Be.jsx)(Ye.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,Be.jsx)(Vt.CheckIcon,{className:"size-3.5"})})})}var P=require("react"),r=require("react/jsx-runtime");function uo({data:e,columns:t,filters:s=[],pagination:c={enabled:!1},settings:h={},header:C,footer:B,className:X="",maxHeight:b="600px",loading:w=!1,error:M,emptyMessage:A="No data available",onRowSelectionChange:T,onExport:K,onRefresh:E,onTableReady:Q,children:Y,isRowDisabled:I,isRowSelectable:p,onExternalSearch:we}){let[ye,ue]=(0,P.useState)([]),[Pe,ne]=(0,P.useState)([]),[Le,Ge]=(0,P.useState)({}),[ae,me]=(0,P.useState)({}),[re,n]=(0,P.useState)(""),[m,g]=(0,P.useState)([]),[$,Bt]=(0,P.useState)(h.enableColumnPinning?{left:[],right:[]}:{}),[Ae,Lt]=(0,P.useState)({}),Gt=(d,u)=>u.split(".").reduce((a,f)=>a&&a[f],d),et=(0,P.useMemo)(()=>Object.keys(Ae).length===0?e:e.filter(d=>Object.entries(Ae).every(([u,a])=>{if(!a||a==="")return!0;let f=Gt(d,u);return typeof a=="string"?String(f).toLowerCase().includes(a.toLowerCase()):f===a})),[e,Ae]),{enableSorting:He=!0,enableFiltering:Oe=!0,enableGlobalFilter:tt=!0,enableColumnVisibility:je=!0,enableRowSelection:R=!0,stickyHeader:At=!0,toolbar:Ht=!1,showSerialNumbers:ee=!0,fixedCheckboxColumn:Ne=!0,striped:Ot=!0,hoverable:jt=!0,compact:ot=!0,bordered:nt=!0,fullHeight:Ut=!1,enableColumnResizing:at=!1,enableColumnPinning:L=!0,hideHeader:Et=!1,selectionMode:Z="multiple",showCheckBox:$t=!0,checkboxColumnPosition:rt=0}=h,Wt=(0,P.useCallback)((d,u)=>{Lt(a=>{let f={...a};return u===""||u===null||u===void 0?delete f[d]:f[d]=u,f})},[]),Ue=(0,P.useMemo)(()=>{let d=[...t],u=l=>l.map(v=>{if(v.id==="select"||v.id==="serialNumber")return v;let z={...v,enablePinning:!0};return v.columns&&(z.columns=u(v.columns)),z}),a=u(d),f={id:"select",header:({table:l})=>{if(Z==="single")return null;let v=l.getRowModel().rows.filter(H=>!I?.(H.original)&&(p?p(H.original):!0)),z=v.length>0&&v.every(H=>H.getIsSelected()),O=v.some(H=>H.getIsSelected());return(0,r.jsx)(Ze,{checked:z||O&&"indeterminate",onCheckedChange:H=>{v.forEach(ie=>ie.toggleSelected(!!H))},"aria-label":"Select all selectable rows"})},cell:({row:l})=>{let v=I?I(l.original):!1,z=p?p(l.original):!0;return(0,r.jsx)("div",{className:o("flex items-center justify-center",v&&"opacity-50"),children:Z==="multiple"?(0,r.jsx)(Ze,{checked:l.getIsSelected(),onCheckedChange:O=>z&&l.toggleSelected(!!O),"aria-label":"Select row",disabled:v||!z}):$t?(0,r.jsx)("input",{type:"radio",checked:l.getIsSelected(),onChange:()=>z&&l.toggleSelected(!0),disabled:v||!z,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:Z==="multiple"?40:30};if(R){let l=rt;l<0&&(l=a.length+l+1),l=Math.max(0,Math.min(l,a.length)),a.splice(l,0,f)}if(ee){let l={id:"serialNumber",header:"No.",cell:({row:v})=>(0,r.jsx)("div",{className:"font-medium text-center text-muted-foreground",children:v.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};a.unshift(l)}return a},[t,ee,R,Ne,I,p,Z,rt]),x=(0,V.useReactTable)({data:et,columns:Ue,onSortingChange:He?ue:void 0,onColumnFiltersChange:Oe?ne:void 0,onGlobalFilterChange:tt?n:void 0,getCoreRowModel:(0,V.getCoreRowModel)(),getPaginationRowModel:c.enabled?(0,V.getPaginationRowModel)():void 0,getSortedRowModel:He?(0,V.getSortedRowModel)():void 0,getFilteredRowModel:Oe?(0,V.getFilteredRowModel)():void 0,onColumnVisibilityChange:je?Ge:void 0,onRowSelectionChange:R?me:void 0,onColumnOrderChange:g,onColumnPinningChange:L?Bt:void 0,state:{sorting:He?ye:void 0,columnFilters:Oe?Pe:void 0,columnVisibility:je?Le:void 0,rowSelection:R?ae:{},globalFilter:re,columnOrder:m,columnPinning:L?$:{}},initialState:{pagination:c.enabled?{pageSize:c.pageSize||10}:void 0,columnPinning:L?{left:[...ee?["serialNumber"]:[],...R?["select"]:[]],right:[]}:void 0},enableRowSelection:R,enableColumnResizing:at,enableColumnPinning:L,columnResizeMode:"onChange"});(0,P.useEffect)(()=>{if(R&&T){let d=x.getFilteredSelectedRowModel().rows.filter(u=>!I?.(u.original)&&(p?p(u.original):!0)).map(u=>u.original);T(d)}},[ae,R,T,x,I,p]);let qt=(0,P.useCallback)(d=>{Z==="single"?(x.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[Z,x]);(0,P.useEffect)(()=>{Q&&Q(x)},[x,Q]),(0,P.useEffect)(()=>{if(R&&T){let d=x.getFilteredSelectedRowModel().rows.map(u=>u.original);T(d)}},[ae,R,T,x]),(0,P.useEffect)(()=>{if(R&&T){let d=x.getFilteredSelectedRowModel().rows.filter(u=>!I?.(u.original)&&(p?p(u.original):!0)).map(u=>u.original);T(d)}},[ae,R,T,x,I,p]);let Jt=(0,P.useCallback)(()=>{ue([])},[]),Xt=(0,P.useCallback)(()=>{ne([]),n("")},[]),it=(d,u)=>{if(!L)return;let a=[...ee?["serialNumber"]:[],...R&&Ne?["select"]:[]],f={left:[...($.left??[]).filter(l=>a.includes(l))],right:[...$.right??[]]};u===!1?(f.left=f.left.filter(l=>l!==d),f.right=f.right.filter(l=>l!==d)):u==="right"?(f.left=f.left.filter(l=>l!==d),f.right.includes(d)||f.right.push(d)):u==="left"&&(f.right=f.right.filter(l=>l!==d),!f.left.includes(d)&&!a.includes(d)&&f.left.push(d)),x.setColumnPinning(f)},Kt=()=>(0,r.jsx)(bt,{className:o(At&&"sticky top-0 bg-sidebar z-20"),children:x.getHeaderGroups().map((d,u)=>(0,r.jsx)(pe,{className:"hover:bg-transparent",children:d.headers.map((a,f)=>{let l=a.depth===0&&a.colSpan>1,v=L&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&R),z=L&&a.column.getIsPinned()==="right",O=a.column.getCanSort(),H=L&&a.column.columnDef.enablePinning!==!1,ie=a.column.id==="serialNumber",Ee=a.column.id==="select",dt=ie||Ee&&Ne,se=a.column.columnDef.headerAlign||"left",Qt={left:"justify-start",center:"justify-center",right:"justify-end"}[se];return(0,r.jsxs)(xt,{colSpan:a.colSpan,className:o("font-semibold text-foreground bg-sidebar group px-0",!ot&&"py-2",nt&&f<d.headers.length-1&&"border-r","relative",v&&"sticky left-0 z-15 bg-sidebar",z&&"sticky right-0 z-15 bg-sidebar",(ie||Ee)&&"sticky left-0 z-15 bg-sidebar",l?"text-center":"text-left"),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...v&&{left:ie?0:Ee?ee&&x.getColumn("serialNumber")?.getSize()||0:st(a.column)},...z&&{right:lt(a.column)},...ie&&{left:0}},children:[l?(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,V.flexRender)(a.column.columnDef.header,a.getContext())}):(0,r.jsxs)("div",{className:o("relative flex items-center w-full px-2",Qt),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[O&&se==="right"&&(0,r.jsx)("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:(0,r.jsx)(D.ChevronUp,{className:"w-4 h-4"}),desc:(0,r.jsx)(D.ChevronDown,{className:"w-4 h-4"})}[a.column.getIsSorted()]}),a.isPlaceholder?null:(0,V.flexRender)(a.column.columnDef.header,a.getContext()),O&&se!=="right"&&a.column.getIsSorted()&&(0,r.jsx)("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:(0,r.jsx)(D.ChevronUp,{className:"w-4 h-4"}),desc:(0,r.jsx)(D.ChevronDown,{className:"w-4 h-4"})}[a.column.getIsSorted()]})]}),(O||H&&!dt)&&(0,r.jsxs)(fe,{children:[(0,r.jsx)(be,{asChild:!0,className:o("absolute",se==="left"&&"right-1",se==="center"&&"right-1",se==="right"&&"left-1"),children:(0,r.jsx)(_t,{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,r.jsx)(D.MoreHorizontal,{className:"w-4 h-4"})})}),(0,r.jsxs)(ve,{align:"end",className:"w-48",children:[O&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q,{children:"Sorting"}),(0,r.jsxs)(U,{onClick:()=>a.column.toggleSorting(!1),children:[(0,r.jsx)(D.ChevronUp,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),(0,r.jsxs)(U,{onClick:()=>a.column.toggleSorting(!0),children:[(0,r.jsx)(D.ChevronDown,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),(0,r.jsxs)(U,{onClick:()=>a.column.clearSorting(),disabled:!a.column.getIsSorted(),children:[(0,r.jsx)(D.ChevronsUpDown,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),(0,r.jsx)(oe,{})]}),H&&!dt&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q,{children:"Pin Column"}),(0,r.jsxs)(U,{onClick:()=>it(a.column.id,"right"),disabled:a.column.getIsPinned()==="right",children:[(0,r.jsx)(D.MoveRightIcon,{}),"Pin Right"]}),(0,r.jsxs)(U,{onClick:()=>it(a.column.id,!1),disabled:!a.column.getIsPinned(),children:[(0,r.jsx)(D.PinOffIcon,{}),"Unpin"]})]})]})]})]}),at&&a.column.getCanResize()&&!l&&a.colSpan===1&&(0,r.jsx)("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:a.getResizeHandler()})]},a.id)})},d.id))}),st=d=>{if(!L)return;let u=0,a=x.getLeftHeaderGroups()[0]?.headers||[],f=[...ee?["serialNumber"]:[],...R?["select"]:[]];for(let l of a){if(l.id===d.id)break;if(f.includes(l.id)){let v=x.getColumn(l.id);v&&(u+=v.getSize())}}return u},lt=d=>{if(!L)return;let u=x.getState().columnPinning.right||[],a=u.indexOf(d.id);if(a===-1)return;let f=0;for(let l=a+1;l<u.length;l++){let v=x.getColumn(u[l]);v&&(f+=v.getSize())}return f};return M?(0,r.jsx)(Te,{className:"w-full shadow-sm rounded-xl",children:(0,r.jsx)(ze,{className:"flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),(0,r.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:M}),E&&(0,r.jsxs)(N,{variant:"outline",size:"sm",onClick:E,className:"rounded-lg",children:[(0,r.jsx)(D.Loader2,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})}):(0,r.jsx)(wt,{children:(0,r.jsxs)("div",{className:o("w-full space-y-2 flex flex-col h-full",X),children:[C&&(0,r.jsx)(Te,{className:"sticky top-0 z-20 py-2 rounded-2xl",children:(0,r.jsx)(ze,{className:"px-2",children:C})}),Ht&&(0,r.jsx)(zt,{table:x,filters:s,globalFilter:re,onGlobalFilterChange:n,enableGlobalFilter:tt,onExport:K,onRefresh:E,loading:w,enableColumnVisibility:je,enableColumnPinning:L,data:et,onClearSorting:Jt,onClearFilters:Xt,onExternalSearch:we,onCustomFilterChange:Wt}),(0,r.jsx)(Te,{className:o("shadow-sm overflow-auto py-0",Ut&&"flex-1"),children:(0,r.jsx)(ze,{className:"h-full p-0",children:(0,r.jsxs)("div",{className:"relative flex flex-col justify-between h-full",children:[w&&(0,r.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[(0,r.jsx)(D.Loader2,{className:"size-5 animate-spin text-primary"}),(0,r.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),(0,r.jsx)("div",{className:o("relative overflow-auto border-b rounded-t-xl",x.getRowModel().rows?.length===0&&"h-full"),children:(0,r.jsxs)($e,{className:o("w-full border-collapse",x.getRowModel().rows?.length===0&&"h-full"),children:[!Et&&Kt(),(0,r.jsx)(vt,{children:x.getRowModel().rows?.length?x.getRowModel().rows.map((d,u)=>(0,r.jsx)(pe,{"data-state":d.getIsSelected()&&"selected",className:o(jt&&"hover:bg-muted/50",Ot&&u%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",Z==="single"&&"cursor-pointer"),onClick:()=>{Z==="single"&&qt(d)},children:d.getVisibleCells().map((a,f)=>{let l=L&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&R),v=L&&a.column.getIsPinned()==="right",z=a.column.id==="serialNumber",O=a.column.id==="select",H=z||O&&Ne;return(0,r.jsx)(De,{className:o(ot?"py-2":"py-4",nt&&f<d.getVisibleCells().length&&"border-r",l&&"sticky left-0 z-10 bg-sidebar/97",v&&"sticky right-0 z-10 bg-sidebar/97",z&&"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",...l&&{left:z?0:O?ee&&x.getColumn("serialNumber")?.getSize()||0:st(a.column)},...v&&{right:lt(a.column)},...z&&{left:0}},children:(0,V.flexRender)(a.column.columnDef.cell,a.getContext())},a.id)})},d.id)):(0,r.jsx)(pe,{children:(0,r.jsx)(De,{colSpan:Ue.length,className:"h-32 text-center border-0",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),(0,r.jsx)("p",{className:"font-medium text-muted-foreground",children:A})]})})})})]})}),B&&(0,r.jsx)("div",{className:"sticky bottom-0 z-20 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:(0,r.jsx)($e,{children:(0,r.jsx)(ht,{children:(0,r.jsx)(pe,{className:"bg-sidebar",children:(0,r.jsx)(De,{colSpan:Ue.length,className:"p-2",children:B})})})})})]})})}),(0,r.jsx)(Mt,{table:x,config:c}),Y&&Y(x)]})})}0&&(module.exports={DataTable});
|
|
3
3
|
//# sourceMappingURL=data-table.cjs.map
|