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