@tirth_jasoliya/ui 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/data-table/data-table-action-bar.cjs +1 -1
- package/dist/components/data/data-table/data-table-action-bar.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-action-bar.js +1 -1
- package/dist/components/data/data-table/data-table-action-bar.js.map +1 -1
- package/dist/components/data/data-table/data-table-pagination.cjs +1 -1
- package/dist/components/data/data-table/data-table-pagination.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-pagination.js +1 -1
- package/dist/components/data/data-table/data-table-pagination.js.map +1 -1
- package/dist/components/data/data-table/data-table-toolbar.cjs +1 -1
- package/dist/components/data/data-table/data-table-toolbar.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-toolbar.d.cts +6 -2
- package/dist/components/data/data-table/data-table-toolbar.d.ts +6 -2
- package/dist/components/data/data-table/data-table-toolbar.js +1 -1
- package/dist/components/data/data-table/data-table-toolbar.js.map +1 -1
- package/dist/components/data/data-table/data-table-types.cjs +1 -1
- package/dist/components/data/data-table/data-table-types.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-types.d.cts +48 -2
- package/dist/components/data/data-table/data-table-types.d.ts +48 -2
- package/dist/components/data/data-table/data-table.cjs +1 -1
- package/dist/components/data/data-table/data-table.cjs.map +1 -1
- package/dist/components/data/data-table/data-table.d.cts +1 -1
- package/dist/components/data/data-table/data-table.d.ts +1 -1
- package/dist/components/data/data-table/data-table.js +1 -1
- package/dist/components/data/data-table/data-table.js.map +1 -1
- package/dist/components/data/data-table/index.cjs +1 -1
- package/dist/components/data/data-table/index.cjs.map +1 -1
- package/dist/components/data/data-table/index.js +1 -1
- package/dist/components/data/data-table/index.js.map +1 -1
- package/dist/components/date-helper.cjs +3 -0
- package/dist/components/date-helper.cjs.map +1 -0
- package/dist/components/date-helper.d.cts +27 -0
- package/dist/components/date-helper.d.ts +27 -0
- package/dist/components/date-helper.js +3 -0
- package/dist/components/date-helper.js.map +1 -0
- package/dist/components/helper/date-filter.cjs +3 -0
- package/dist/components/helper/date-filter.cjs.map +1 -0
- package/dist/components/helper/date-filter.d.cts +14 -0
- package/dist/components/helper/date-filter.d.ts +14 -0
- package/dist/components/helper/date-filter.js +3 -0
- package/dist/components/helper/date-filter.js.map +1 -0
- package/dist/components/layouts/app-content.cjs +1 -1
- package/dist/components/layouts/app-content.cjs.map +1 -1
- package/dist/components/layouts/app-content.d.cts +2 -2
- package/dist/components/layouts/app-content.d.ts +2 -2
- package/dist/components/layouts/app-content.js +1 -1
- package/dist/components/layouts/app-content.js.map +1 -1
- package/dist/components/layouts/factories.cjs +1 -1
- package/dist/components/layouts/factories.cjs.map +1 -1
- package/dist/components/layouts/factories.js +1 -1
- package/dist/components/layouts/factories.js.map +1 -1
- package/dist/components/layouts/index.cjs +1 -1
- package/dist/components/layouts/index.cjs.map +1 -1
- package/dist/components/layouts/index.js +1 -1
- package/dist/components/layouts/index.js.map +1 -1
- package/dist/components/ui/calendar.cjs +3 -0
- package/dist/components/ui/calendar.cjs.map +1 -0
- package/dist/components/ui/calendar.d.cts +13 -0
- package/dist/components/ui/calendar.d.ts +13 -0
- package/dist/components/ui/calendar.js +3 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/table.cjs +1 -1
- package/dist/components/ui/table.cjs.map +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +28 -16
- package/dist/styles.css +0 -2
|
@@ -3,6 +3,6 @@ import { DataTableProps } from './data-table-types.cjs';
|
|
|
3
3
|
import '@tanstack/react-table';
|
|
4
4
|
import 'lucide-react';
|
|
5
5
|
|
|
6
|
-
declare function DataTable<T>({ data, columns: initialColumns, filters, pagination, settings, header, footer, className, maxHeight, loading, error, emptyMessage, onRowSelectionChange, onExport, onRefresh, onTableReady, children, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function DataTable<T>({ data, columns: initialColumns, filters, pagination, settings, header, footer, className, maxHeight, loading, error, emptyMessage, onRowSelectionChange, onExport, onRefresh, onTableReady, children, isRowDisabled, isRowSelectable, onExternalSearch, aggregations, onAggregationChange, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
|
8
8
|
export { DataTable };
|
|
@@ -3,6 +3,6 @@ import { DataTableProps } from './data-table-types.js';
|
|
|
3
3
|
import '@tanstack/react-table';
|
|
4
4
|
import 'lucide-react';
|
|
5
5
|
|
|
6
|
-
declare function DataTable<T>({ data, columns: initialColumns, filters, pagination, settings, header, footer, className, maxHeight, loading, error, emptyMessage, onRowSelectionChange, onExport, onRefresh, onTableReady, children, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function DataTable<T>({ data, columns: initialColumns, filters, pagination, settings, header, footer, className, maxHeight, loading, error, emptyMessage, onRowSelectionChange, onExport, onRefresh, onTableReady, children, isRowDisabled, isRowSelectable, onExternalSearch, aggregations, onAggregationChange, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
|
8
8
|
export { DataTable };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import{flexRender as Ne,getCoreRowModel as Et,getFilteredRowModel as qt,getPaginationRowModel as Jt,getSortedRowModel as Kt,useReactTable as Qt}from"@tanstack/react-table";import{Loader2 as Ye,ChevronUp as De,ChevronDown as Te,ChevronsUpDown as Xt,MoreHorizontal as Yt,MoveRightIcon as Zt,PinOffIcon as eo}from"lucide-react";import{Slot as wt}from"radix-ui";import{cva as ht}from"class-variance-authority";import{clsx as xt}from"clsx";import{twMerge as Ct}from"tailwind-merge";function i(...e){return Ct(xt(e))}import{jsx as yt}from"react/jsx-runtime";var Pt=ht("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 P({className:e,variant:o,size:d,asChild:p=!1,...D}){let C=p?wt.Slot:"button";return yt(C,{"data-slot":"button",className:i(Pt({variant:o,size:d,className:e}),"transition-none"),...D})}import{jsx as z}from"react/jsx-runtime";function xe({className:e,...o}){return z("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:z("table",{"data-slot":"table",className:i("w-full caption-bottom text-sm",e),...o})})}function Ae({className:e,...o}){return z("thead",{"data-slot":"table-header",className:i("[&_tr]:border-b",e),...o})}function He({className:e,...o}){return z("tbody",{"data-slot":"table-body",className:i("[&_tr:last-child]:border-0",e),...o})}function Oe({className:e,...o}){return z("tfoot",{"data-slot":"table-footer",className:i("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...o})}function $({className:e,...o}){return z("tr",{"data-slot":"table-row",className:i("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...o})}function je({className:e,...o}){return z("th",{"data-slot":"table-head",className:i("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...o})}function oe({className:e,...o}){return z("td",{"data-slot":"table-cell",className:i("p-2 align-middle whitespace-nowrap",e),...o})}import{jsx as Ue}from"react/jsx-runtime";function ne({className:e,...o}){return Ue("div",{"data-slot":"card",className:i("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...o})}function ae({className:e,...o}){return Ue("div",{"data-slot":"card-content",className:i("px-6",e),...o})}import{Tooltip as St}from"radix-ui";import{jsx as Nt,jsxs as wo}from"react/jsx-runtime";function We({delayDuration:e=0,...o}){return Nt(St.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...o})}import{Search as Vt,RefreshCw as Ft,Download as _t,Settings2 as Gt,Filter as Ee,ArrowUpDown as Lt,PinOff as Bt,Pin as qe,ChevronDown as At}from"lucide-react";import{jsx as Dt}from"react/jsx-runtime";function Ce({className:e,type:o,...d}){return Dt("input",{type:o,"data-slot":"input",className:i("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),...d})}import{Select as S}from"radix-ui";import{CheckIcon as Tt,ChevronDownIcon as $e,ChevronUpIcon as Rt}from"lucide-react";import{jsx as x,jsxs as we}from"react/jsx-runtime";function ie({...e}){return x(S.Root,{"data-slot":"select",...e})}function re({...e}){return x(S.Value,{"data-slot":"select-value",...e})}function se({className:e,size:o="default",children:d,...p}){return we(S.Trigger,{"data-slot":"select-trigger","data-size":o,className:i("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),...p,children:[d,x(S.Icon,{asChild:!0,children:x($e,{className:"size-4 opacity-50"})})]})}function le({className:e,children:o,position:d="popper",...p}){return x(S.Portal,{children:we(S.Content,{"data-slot":"select-content",className:i("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",d==="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:d,...p,children:[x(kt,{}),x(S.Viewport,{className:i("p-1",d==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),x(Mt,{})]})})}function E({className:e,children:o,...d}){return we(S.Item,{"data-slot":"select-item",className:i("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),...d,children:[x("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:x(S.ItemIndicator,{children:x(Tt,{className:"size-4"})})}),x(S.ItemText,{children:o})]})}function kt({className:e,...o}){return x(S.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:i("flex cursor-default items-center justify-center py-1",e),...o,children:x(Rt,{className:"size-4"})})}function Mt({className:e,...o}){return x(S.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:i("flex cursor-default items-center justify-center py-1",e),...o,children:x($e,{className:"size-4"})})}import{DropdownMenu as k}from"radix-ui";import{CheckIcon as zt,ChevronRightIcon as Io,CircleIcon as Vo}from"lucide-react";import{jsx as R,jsxs as It}from"react/jsx-runtime";function q({...e}){return R(k.Root,{"data-slot":"dropdown-menu",...e})}function J({...e}){return R(k.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function K({className:e,sideOffset:o=4,...d}){return R(k.Portal,{children:R(k.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:i("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),...d})})}function he({...e}){return R(k.Group,{"data-slot":"dropdown-menu-group",...e})}function N({className:e,inset:o,variant:d="default",...p}){return R(k.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":d,className:i("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),...p})}function Pe({className:e,children:o,checked:d,...p}){return It(k.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:i("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:d,...p,children:[R("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:R(k.ItemIndicator,{children:R(zt,{className:"size-4"})})}),o]})}function M({className:e,inset:o,...d}){return R(k.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...d})}function _({className:e,...o}){return R(k.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",e),...o})}import{Fragment as Ht,jsx as r,jsxs as u}from"react/jsx-runtime";function Je({table:e,filters:o=[],globalFilter:d,onGlobalFilterChange:p,enableGlobalFilter:D=!0,onExport:C,onRefresh:O,loading:Q=!1,enableColumnVisibility:Re=!0,data:X,onClearSorting:Y,onClearFilters:de,enableColumnPinning:j=!1}){let U=()=>e.getAllLeafColumns().filter(a=>a.getCanHide?.()!==!1),L=()=>e.getAllColumns().filter(a=>!e.getAllLeafColumns().includes(a)&&a.columns?.length&&a.columns.some(l=>l.getCanHide?.()!==!1)),B=()=>{let a=new Set(L().flatMap(l=>l.columns?.filter(T=>T.getCanHide?.()!==!1).map(T=>T.id)||[]));return U().filter(l=>!a.has(l.id))},W=(a,l)=>l&&a.startsWith(`${l}.`)?a.replace(`${l}.`,"").split("_").map(Z=>Z.slice(1)).join(" "):a.split("_").map(T=>T.charAt(0).toUpperCase()+T.slice(1)).join(" ");return r("div",{className:"rounded-xl",children:r("div",{className:"px-2",children:r("div",{className:"flex flex-col gap-6",children:u("div",{className:"flex items-center justify-between",children:[r("div",{className:"flex items-center gap-3",children:o.length>0&&u("div",{className:"flex items-center gap-3 flex-wrap",children:[r("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:r(Ee,{className:"h-4 w-4"})}),o.map(a=>r("div",{className:i("relative min-w-[150px]",a.width),children:a.type==="select"?u(ie,{value:e.getColumn(a.key)?.getFilterValue()??"",onValueChange:l=>e.getColumn(a.key)?.setFilterValue(l==="all"?"":l),children:[a.icon&&r("span",{children:r(a.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),r(se,{className:i("h-9 rounded-lg w-full",a.icon&&"pl-9"),children:r(re,{placeholder:a.placeholder})}),u(le,{className:"rounded-lg",children:[r(E,{value:"all",children:"All"}),a.options?.map(l=>r(E,{value:l.value,children:l.label},l.label))]})]}):u("div",{className:"relative",children:[a.icon&&r("span",{children:r(a.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),r(Ce,{placeholder:a.placeholder,value:e.getColumn(a.key)?.getFilterValue()??"",onChange:l=>e.getColumn(a.key)?.setFilterValue(l.target.value),className:i("h-9 rounded-lg",a.icon&&"pl-9"),type:a.type==="number"?"number":a.type==="date"?"date":"text"})]})},a.key))]})}),u("div",{className:"flex items-center gap-2",children:[D&&u("div",{className:"relative",children:[r(Vt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r(Ce,{placeholder:"Global search...",value:d??"",onChange:a=>p(a.target.value),className:"pl-9 max-w-max"})]}),C&&u(P,{variant:"outline",size:"sm",onClick:()=>C(X),className:"rounded-lg",children:[r(_t,{className:"mr-2 h-4 w-4"}),"Export"]}),Re&&u(q,{children:[r(J,{asChild:!0,children:u(P,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[r("span",{children:"Columns"}),r(At,{className:"h-4 w-4 opacity-50"})]})}),u(K,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[r(M,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),r(_,{}),B().length>0&&u(he,{children:[r(M,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),B().map(a=>r(Pe,{className:"text-sm",checked:a.getIsVisible(),onCheckedChange:l=>a.toggleVisibility(!!l),children:W(a.id)},a.id))]}),L().map(a=>u(he,{children:[r(_,{}),r(M,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:a.id}),a.columns?.filter(l=>l.getCanHide?.()!==!1).map(l=>r(Pe,{className:"text-sm",checked:l.getIsVisible(),onCheckedChange:T=>l.toggleVisibility(!!T),children:W(l.id,a.id)},l.id))]},a.id))]})]}),u(q,{children:[r(J,{asChild:!0,children:r(P,{variant:"outline",size:"sm",className:"rounded-lg",children:r(Gt,{className:"h-4 w-4"})})}),u(K,{align:"end",className:"w-[200px] rounded-lg",children:[r(M,{children:"Table Settings"}),r(_,{}),u(N,{onClick:Y,children:[r(Lt,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),u(N,{onClick:de,children:[r(Ee,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),j&&u(Ht,{children:[r(_,{}),r(M,{children:"Column Pinning"}),u(N,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[r(Bt,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),u(N,{onClick:()=>{let a=U().filter(l=>l.getCanPin?.()!==!1).map(l=>l.id);e.setColumnPinning({left:a,right:[]})},children:[r(qe,{className:"mr-2 h-4 w-4 rotate-90"}),"Pin All Left"]}),u(N,{onClick:()=>{let a=U().filter(l=>l.getCanPin?.()!==!1).map(l=>l.id);e.setColumnPinning({left:[],right:a})},children:[r(qe,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),O&&r(P,{variant:"outline",size:"sm",onClick:O,disabled:Q,className:"rounded-lg",children:r(Ft,{className:i("h-4 w-4",Q&&"animate-spin")})})]})]})})})})}import{jsx as w,jsxs as H}from"react/jsx-runtime";function Ke({table:e,config:o}){return o.enabled?w("div",{className:"rounded-xl",children:w("div",{children:H("div",{className:"flex items-center justify-between",children:[w("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:o.showInfo!==!1&&H("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"]})}),H("div",{className:"flex items-center gap-4",children:[o.pageSizeOptions&&H("div",{className:"flex items-center gap-2",children:[w("span",{className:"text-sm font-medium",children:"Rows per page:"}),H(ie,{value:`${e.getState().pagination.pageSize}`,onValueChange:d=>e.setPageSize(Number(d)),children:[w(se,{className:"h-9 w-[70px] rounded-lg",children:w(re,{})}),w(le,{side:"top",className:"rounded-lg",children:o.pageSizeOptions.map(d=>w(E,{value:`${d}`,children:d},d))})]})]}),H("div",{className:"flex items-center gap-2",children:[w(P,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),w(P,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),o.showPageNumbers&&w("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(d,p)=>{let D=e.getState().pagination.pageIndex,C=D-2+p+1;return C<1||C>e.getPageCount()?null:w(P,{variant:C===D+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(C-1),children:C},C)})}),w(P,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),w(P,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Ot}from"radix-ui";import{cva as jt}from"class-variance-authority";import{jsx as Wt}from"react/jsx-runtime";var Ut=jt("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 Qe({className:e,variant:o,size:d,noBg:p,...D}){return Wt(Ot.Root,{"data-slot":"toggle",className:i(Ut({className:e,variant:o,size:d,bg:p?"disabled":"enabled"})),...D})}import{Checkbox as Xe}from"radix-ui";import{CheckIcon as $t}from"lucide-react";import{jsx as ye}from"react/jsx-runtime";function Se({className:e,...o}){return ye(Xe.Root,{"data-slot":"checkbox",className:i("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),...o,children:ye(Xe.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:ye($t,{className:"size-3.5"})})})}import{useCallback as Ze,useEffect as et,useMemo as to,useState as G}from"react";import{Fragment as tt,jsx as n,jsxs as g}from"react/jsx-runtime";function Cn({data:e,columns:o,filters:d=[],pagination:p={enabled:!1},settings:D={},header:C,footer:O,className:Q="",maxHeight:Re="600px",loading:X=!1,error:Y,emptyMessage:de="No data available",onRowSelectionChange:j,onExport:U,onRefresh:L,onTableReady:B,children:W}){let[a,l]=G([]),[T,Z]=G([]),[ot,nt]=G({}),[ke,at]=G({}),[Me,ce]=G(""),[it,rt]=G([]),[me,st]=G(D.enableColumnPinning?{left:[],right:[]}:{}),{enableSorting:ue=!0,enableFiltering:pe=!0,enableGlobalFilter:ze=!0,enableColumnVisibility:ge=!0,enableRowSelection:y=!0,stickyHeader:lt=!0,toolbar:dt=!1,showSerialNumbers:I=!0,fixedCheckboxColumn:ee=!0,striped:ct=!0,hoverable:mt=!0,compact:Ie=!0,bordered:Ve=!0,fullHeight:ut=!1,enableColumnResizing:Fe=!1,enableColumnPinning:h=!0,hideHeader:pt=!1}=D,fe=to(()=>{let m=[...o],f=c=>c.map(s=>{if(s.id==="select"||s.id==="serialNumber")return s;let b={...s,enablePinning:!0};return s.columns&&(b.columns=f(s.columns)),b}),t=f(m);if(y){let c={id:"select",header:({table:s})=>n(Se,{checked:s.getIsAllPageRowsSelected()||s.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:b=>s.toggleAllPageRowsSelected(!!b),"aria-label":"Select all"}),cell:({row:s})=>n("div",{className:i("flex items-center justify-center"),children:n(Se,{checked:s.getIsSelected(),onCheckedChange:b=>s.toggleSelected(!!b),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:10};t.unshift(c)}if(I){let c={id:"serialNumber",header:"No.",cell:({row:s})=>n("div",{className:"text-center font-medium text-muted-foreground",children:s.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};t.unshift(c)}return t},[o,I,y,ee]),v=Qt({data:e,columns:fe,onSortingChange:ue?l:void 0,onColumnFiltersChange:pe?Z:void 0,onGlobalFilterChange:ze?ce:void 0,getCoreRowModel:Et(),getPaginationRowModel:p.enabled?Jt():void 0,getSortedRowModel:ue?Kt():void 0,getFilteredRowModel:pe?qt():void 0,onColumnVisibilityChange:ge?nt:void 0,onRowSelectionChange:y?at:void 0,onColumnOrderChange:rt,onColumnPinningChange:h?st:void 0,state:{sorting:ue?a:void 0,columnFilters:pe?T:void 0,columnVisibility:ge?ot:void 0,rowSelection:y?ke:{},globalFilter:Me,columnOrder:it,columnPinning:h?me:{}},initialState:{pagination:p.enabled?{pageSize:p.pageSize||10}:void 0,columnPinning:h?{left:[...I?["serialNumber"]:[],...y?["select"]:[]],right:[]}:void 0},enableRowSelection:y,enableColumnResizing:Fe,enableColumnPinning:h,columnResizeMode:"onChange"});et(()=>{B&&B(v)},[v,B]),et(()=>{if(y&&j){let m=v.getFilteredSelectedRowModel().rows.map(f=>f.original);j(m)}},[ke,y,j,v]);let gt=Ze(()=>{l([])},[]),ft=Ze(()=>{Z([]),ce("")},[]),_e=(m,f)=>{if(!h)return;let t=[...I?["serialNumber"]:[],...y&&ee?["select"]:[]],c={left:[...(me.left??[]).filter(s=>t.includes(s))],right:[...me.right??[]]};f===!1?(c.left=c.left.filter(s=>s!==m),c.right=c.right.filter(s=>s!==m)):f==="right"?(c.left=c.left.filter(s=>s!==m),c.right.includes(m)||c.right.push(m)):f==="left"&&(c.right=c.right.filter(s=>s!==m),!c.left.includes(m)&&!t.includes(m)&&c.left.push(m)),v.setColumnPinning(c)},bt=()=>n(Ae,{className:i(lt&&"sticky top-0 bg-sidebar z-20"),children:v.getHeaderGroups().map((m,f)=>n($,{className:"hover:bg-transparent",children:m.headers.map((t,c)=>{let s=t.depth===0&&t.colSpan>1,b=h&&(t.column.getIsPinned()==="left"||t.column.id==="serialNumber"||t.column.id==="select"&&y),V=h&&t.column.getIsPinned()==="right",F=t.column.getCanSort(),be=h&&t.column.columnDef.enablePinning!==!1,te=t.column.id==="serialNumber",ve=t.column.id==="select",Be=te||ve&&ee,A=t.column.columnDef.headerAlign||"left",vt={left:"justify-start",center:"justify-center",right:"justify-end"}[A];return g(je,{colSpan:t.colSpan,className:i("font-semibold text-foreground bg-sidebar group px-0",!Ie&&"py-2",Ve&&c<m.headers.length-1&&"border-r","relative",b&&"sticky left-0 z-15 bg-sidebar",V&&"sticky right-0 z-15 bg-sidebar",(te||ve)&&"sticky left-0 z-15 bg-sidebar",s?"text-center":"text-left"),style:{width:t.getSize()!==150?t.getSize():"auto",minWidth:t.getSize()!==150?t.getSize():"auto",...b&&{left:te?0:ve?I&&v.getColumn("serialNumber")?.getSize()||0:Ge(t.column)},...V&&{right:Le(t.column)},...te&&{left:0}},children:[s?n("div",{className:"flex items-center justify-center",children:Ne(t.column.columnDef.header,t.getContext())}):g("div",{className:i("relative flex items-center w-full px-2",vt),children:[g("div",{className:"flex items-center gap-1",children:[F&&A==="right"&&n("span",{className:"ml-1 order-2",children:t.column.getIsSorted()&&{asc:n(De,{className:"h-4 w-4"}),desc:n(Te,{className:"h-4 w-4"})}[t.column.getIsSorted()]}),t.isPlaceholder?null:Ne(t.column.columnDef.header,t.getContext()),F&&A!=="right"&&t.column.getIsSorted()&&n("span",{className:"ml-1 order-2",children:t.column.getIsSorted()&&{asc:n(De,{className:"h-4 w-4"}),desc:n(Te,{className:"h-4 w-4"})}[t.column.getIsSorted()]})]}),(F||be&&!Be)&&g(q,{children:[n(J,{asChild:!0,className:i("absolute",A==="left"&&"right-1",A==="center"&&"right-1",A==="right"&&"left-1"),children:n(Qe,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:n(Yt,{className:"h-4 w-4"})})}),g(K,{align:"end",className:"w-48",children:[F&&g(tt,{children:[n(M,{children:"Sorting"}),g(N,{onClick:()=>t.column.toggleSorting(!1),children:[n(De,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),g(N,{onClick:()=>t.column.toggleSorting(!0),children:[n(Te,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),g(N,{onClick:()=>t.column.clearSorting(),disabled:!t.column.getIsSorted(),children:[n(Xt,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),n(_,{})]}),be&&!Be&&g(tt,{children:[n(M,{children:"Pin Column"}),g(N,{onClick:()=>_e(t.column.id,"right"),disabled:t.column.getIsPinned()==="right",children:[n(Zt,{}),"Pin Right"]}),g(N,{onClick:()=>_e(t.column.id,!1),disabled:!t.column.getIsPinned(),children:[n(eo,{}),"Unpin"]})]})]})]})]}),Fe&&t.column.getCanResize()&&!s&&t.colSpan===1&&n("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:t.getResizeHandler()})]},t.id)})},m.id))}),Ge=m=>{if(!h)return;let f=0,t=v.getLeftHeaderGroups()[0]?.headers||[],c=[...I?["serialNumber"]:[],...y?["select"]:[]];for(let s of t){if(s.id===m.id)break;if(c.includes(s.id)){let b=v.getColumn(s.id);b&&(f+=b.getSize())}}return f},Le=m=>{if(!h)return;let f=v.getState().columnPinning.right||[],t=f.indexOf(m.id);if(t===-1)return;let c=0;for(let s=t+1;s<f.length;s++){let b=v.getColumn(f[s]);b&&(c+=b.getSize())}return c};return Y?n(ne,{className:"w-full rounded-xl shadow-sm",children:n(ae,{className:"flex items-center justify-center",children:g("div",{className:"text-center",children:[n("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),n("p",{className:"text-sm text-muted-foreground mb-4",children:Y}),L&&g(P,{variant:"outline",size:"sm",onClick:L,className:"rounded-lg",children:[n(Ye,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):n(We,{children:g("div",{className:i("w-full space-y-2 flex flex-col h-full",Q),children:[C&&n(ne,{className:"rounded-2xl py-2 sticky top-0 z-20",children:n(ae,{className:"px-2",children:C})}),dt&&n(Je,{table:v,filters:d,globalFilter:Me,onGlobalFilterChange:ce,enableGlobalFilter:ze,onExport:U,onRefresh:L,loading:X,enableColumnVisibility:ge,enableColumnPinning:h,data:e,onClearSorting:gt,onClearFilters:ft}),n(ne,{className:i("shadow-sm overflow-auto py-0",ut&&"flex-1"),children:n(ae,{className:"p-0 h-full",children:g("div",{className:"relative flex flex-col h-full justify-between",children:[X&&n("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:g("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[n(Ye,{className:"size-5 animate-spin text-primary"}),n("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),n("div",{className:"relative rounded-t-xl overflow-auto border-b",children:g(xe,{className:"border-collapse w-full",children:[!pt&&bt(),n(He,{children:v.getRowModel().rows?.length?v.getRowModel().rows.map((m,f)=>n($,{"data-state":m.getIsSelected()&&"selected",className:i(mt&&"hover:bg-muted/50",ct&&f%2===0&&"bg-muted/20",m.getIsSelected()&&"bg-muted","border-b last:border-b-0"),children:m.getVisibleCells().map((t,c)=>{let s=h&&(t.column.getIsPinned()==="left"||t.column.id==="serialNumber"||t.column.id==="select"&&y),b=h&&t.column.getIsPinned()==="right",V=t.column.id==="serialNumber",F=t.column.id==="select",be=V||F&ⅇreturn n(oe,{className:i(Ie?"py-2":"py-4",Ve&&c<m.getVisibleCells().length&&"border-r",s&&"sticky left-0 z-10 bg-sidebar/97",b&&"sticky right-0 z-10 bg-sidebar/97",V&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:t.column.getSize()!==150?t.column.getSize():"auto",minWidth:t.column.getSize()!==150?t.column.getSize():"auto",...s&&{left:V?0:F?I&&v.getColumn("serialNumber")?.getSize()||0:Ge(t.column)},...b&&{right:Le(t.column)},...V&&{left:0}},children:Ne(t.column.columnDef.cell,t.getContext())},t.id)})},m.id)):n($,{children:n(oe,{colSpan:fe.length,className:"h-32 text-center border-0",children:g("div",{className:"flex flex-col items-center gap-3",children:[n("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),n("p",{className:"text-muted-foreground font-medium",children:de})]})})})})]})}),O&&n("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:n(xe,{children:n(Oe,{children:n($,{className:"bg-sidebar",children:n(oe,{colSpan:fe.length,className:"p-2",children:O})})})})})]})})}),n(Ke,{table:v,config:p}),W&&W(v)]})})}export{Cn as DataTable};
|
|
2
|
+
import{flexRender as xt,getCoreRowModel as dn,getFilteredRowModel as cn,getPaginationRowModel as un,getSortedRowModel as mn,useReactTable as pn}from"@tanstack/react-table";import{Loader2 as to,ChevronUp as Ct,ChevronDown as yt,ChevronsUpDown as gn,MoreHorizontal as fn,MoveRightIcon as bn,PinOffIcon as vn,Calculator as oo}from"lucide-react";import{Slot as zo}from"radix-ui";import{cva as Io}from"class-variance-authority";import{clsx as Mo}from"clsx";import{twMerge as Ro}from"tailwind-merge";function o(...e){return Ro(Mo(e))}import{jsx as Fo}from"react/jsx-runtime";var Be=Io("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function N({className:e,variant:n,size:l,asChild:g=!1,...T}){let b=g?zo.Slot:"button";return Fo(b,{"data-slot":"button",className:o(Be({variant:n,size:l,className:e}),"transition-none"),...T})}import{jsx as ne}from"react/jsx-runtime";function dt({className:e,...n}){return ne("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:ne("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...n})})}function Rt({className:e,...n}){return ne("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...n})}function zt({className:e,...n}){return ne("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...n})}function ct({className:e,...n}){return ne("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...n})}function Y({className:e,...n}){return ne("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...n})}function It({className:e,...n}){return ne("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...n})}function ae({className:e,...n}){return ne("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...n})}import{jsx as Ft}from"react/jsx-runtime";function ut({className:e,...n}){return Ft("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...n})}function mt({className:e,...n}){return Ft("div",{"data-slot":"card-content",className:o("px-6",e),...n})}import{Tooltip as _o}from"radix-ui";import{jsx as Vo,jsxs as Hn}from"react/jsx-runtime";function _t({delayDuration:e=0,...n}){return Vo(_o.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...n})}import{Search as Wt,RefreshCw as Qo,Download as Yo,Settings2 as Zo,Filter as Jt,ArrowUpDown as en,PinOff as tn,Pin as on,ChevronDown as Xt,Calculator as ht}from"lucide-react";import{jsx as Ho}from"react/jsx-runtime";function pt({className:e,type:n,...l}){return Ho("input",{type:n,"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),...l})}import{Select as E}from"radix-ui";import{CheckIcon as Ao,ChevronDownIcon as Vt,ChevronUpIcon as Lo}from"lucide-react";import{jsx as R,jsxs as gt}from"react/jsx-runtime";function Oe({...e}){return R(E.Root,{"data-slot":"select",...e})}function Ge({...e}){return R(E.Value,{"data-slot":"select-value",...e})}function je({className:e,size:n="default",children:l,...g}){return gt(E.Trigger,{"data-slot":"select-trigger","data-size":n,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),...g,children:[l,R(E.Icon,{asChild:!0,children:R(Vt,{className:"size-4 opacity-50"})})]})}function Ee({className:e,children:n,position:l="popper",...g}){return R(E.Portal,{children:gt(E.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",l==="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:l,...g,children:[R(Bo,{}),R(E.Viewport,{className:o("p-1",l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),R(Oo,{})]})})}function Te({className:e,children:n,...l}){return gt(E.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),...l,children:[R("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:R(E.ItemIndicator,{children:R(Ao,{className:"size-4"})})}),R(E.ItemText,{children:n})]})}function Bo({className:e,...n}){return R(E.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...n,children:R(Lo,{className:"size-4"})})}function Oo({className:e,...n}){return R(E.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...n,children:R(Vt,{className:"size-4"})})}import{DropdownMenu as B}from"radix-ui";import{CheckIcon as Go,ChevronRightIcon as jo,CircleIcon as Jn}from"lucide-react";import{jsx as F,jsxs as Bt}from"react/jsx-runtime";function ge({...e}){return F(B.Root,{"data-slot":"dropdown-menu",...e})}function fe({...e}){return F(B.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function be({className:e,sideOffset:n=4,...l}){return F(B.Portal,{children:F(B.Content,{"data-slot":"dropdown-menu-content",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 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),...l})})}function ft({...e}){return F(B.Group,{"data-slot":"dropdown-menu-group",...e})}function U({className:e,inset:n,variant:l="default",...g}){return F(B.Item,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":l,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),...g})}function Ue({className:e,children:n,checked:l,...g}){return Bt(B.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:l,...g,children:[F("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:F(B.ItemIndicator,{children:F(Go,{className:"size-4"})})}),n]})}function J({className:e,inset:n,...l}){return F(B.Label,{"data-slot":"dropdown-menu-label","data-inset":n,className:o("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...l})}function re({className:e,...n}){return F(B.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...n})}function Ht({...e}){return F(B.Sub,{"data-slot":"dropdown-menu-sub",...e})}function At({className:e,inset:n,children:l,...g}){return Bt(B.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":n,className:o("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...g,children:[l,F(jo,{className:"ml-auto size-4"})]})}function Lt({className:e,...n}){return F(B.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...n})}import{useState as Kt}from"react";import{useEffect as Jo,useState as bt}from"react";import{Calendar as Xo}from"lucide-react";import{format as ke}from"date-fns";import{Popover as $e}from"radix-ui";import{jsx as qe}from"react/jsx-runtime";function Ot({...e}){return qe($e.Root,{"data-slot":"popover",...e})}function Gt({...e}){return qe($e.Trigger,{"data-slot":"popover-trigger",...e})}function jt({className:e,align:n="center",sideOffset:l=4,...g}){return qe($e.Portal,{children:qe($e.Content,{"data-slot":"popover-content",align:n,sideOffset:l,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),...g})})}import*as We from"react";import{ChevronDownIcon as Eo,ChevronLeftIcon as Uo,ChevronRightIcon as $o}from"lucide-react";import{DayPicker as qo,getDefaultClassNames as Et}from"react-day-picker";import{jsx as ie}from"react/jsx-runtime";function Ut({className:e,classNames:n,showOutsideDays:l=!0,captionLayout:g="label",buttonVariant:T="ghost",formatters:b,components:V,...Z}){let v=Et();return ie(qo,{showOutsideDays:l,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:g,formatters:{formatMonthDropdown:S=>S.toLocaleString("default",{month:"short"}),...b},classNames:{root:o("w-fit",v.root),months:o("flex gap-4 flex-col md:flex-row relative",v.months),month:o("flex flex-col w-full gap-4",v.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",v.nav),button_previous:o(Be({variant:T}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",v.button_previous),button_next:o(Be({variant:T}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",v.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",v.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",v.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",v.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",v.dropdown),caption_label:o("select-none font-medium",g==="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",v.caption_label),table:"w-full border-collapse",weekdays:o("flex",v.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",v.weekday),week:o("flex w-full mt-2",v.week),week_number_header:o("select-none w-(--cell-size)",v.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",v.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",v.day),range_start:o("rounded-l-md bg-accent",v.range_start),range_middle:o("rounded-none",v.range_middle),range_end:o("rounded-r-md bg-accent",v.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",v.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",v.outside),disabled:o("text-muted-foreground opacity-50",v.disabled),hidden:o("invisible",v.hidden),...n},components:{Root:({className:S,rootRef:M,...G})=>ie("div",{"data-slot":"calendar",ref:M,className:o(S),...G}),Chevron:({className:S,orientation:M,...G})=>M==="left"?ie(Uo,{className:o("size-4",S),...G}):M==="right"?ie($o,{className:o("size-4",S),...G}):ie(Eo,{className:o("size-4",S),...G}),DayButton:Wo,WeekNumber:({children:S,...M})=>ie("td",{...M,children:ie("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:S})}),...V},...Z})}function Wo({className:e,day:n,modifiers:l,...g}){let T=Et(),b=We.useRef(null);return We.useEffect(()=>{l.focused&&b.current?.focus()},[l.focused]),ie(N,{ref:b,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":l.selected&&!l.range_start&&!l.range_end&&!l.range_middle,"data-range-start":l.range_start,"data-range-end":l.range_end,"data-range-middle":l.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",T.day,e),...g})}import{jsx as de,jsxs as De}from"react/jsx-runtime";function $t({value:e,onChange:n,placeholder:l,mode:g,externalSearch:T,onExternalChange:b,onlyExternal:V=!1}){let[Z,v]=bt(!1),[S,M]=bt(e),[G,$]=bt(e);Jo(()=>{V||$(e)},[e,V]);let ee=()=>{V||n(S),$(S),T&&b&&b(S),v(!1)},X=()=>{M(G),v(!1)},j=()=>{let x=g==="single"?null:{from:null,to:null};M(x),V||n(x),$(x),T&&b&&b(x),v(!1)},H=()=>{let x=V?G:e;return x?g==="single"?ke(x,"PPP"):x.from&&x.to?`${ke(x.from,"MMM dd")} - ${ke(x.to,"MMM dd, yyyy")}`:x.from?`From ${ke(x.from,"MMM dd, yyyy")}`:x.to?`To ${ke(x.to,"MMM dd, yyyy")}`:l:l},q=x=>{M(g==="single"?x:x||{from:null,to:null})};return De(Ot,{open:Z,onOpenChange:v,children:[de(Gt,{className:"h-8",asChild:!0,children:De(N,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!H()&&"text-muted-foreground"),children:[de(Xo,{className:"mr-2 h-4 w-4"}),H()]})}),De(jt,{className:"w-auto p-0",align:"start",children:[de("div",{className:"p-3",children:de(Ut,{mode:g,selected:S,onSelect:q,numberOfMonths:g==="range"?2:1,className:"rounded-md border",...g==="range"&&{required:!0}})}),De("div",{className:"flex items-center justify-between p-3 border-t",children:[de(N,{variant:"ghost",size:"sm",onClick:j,children:"Clear"}),De("div",{className:"flex gap-2",children:[de(N,{variant:"outline",size:"sm",onClick:X,children:"Cancel"}),de(N,{size:"sm",onClick:ee,disabled:g==="range"&&(!S?.from||!S?.to),children:"Apply"})]})]})]})]})}import{Checkbox as qt}from"radix-ui";import{CheckIcon as Ko}from"lucide-react";import{jsx as vt}from"react/jsx-runtime";function Me({className:e,...n}){return vt(qt.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),...n,children:vt(qt.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:vt(Ko,{className:"size-3.5"})})})}import{Fragment as nn,jsx as s,jsxs as h}from"react/jsx-runtime";var Qt=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function Yt({table:e,filters:n=[],globalFilter:l,onGlobalFilterChange:g,enableGlobalFilter:T=!0,onExport:b,onRefresh:V,loading:Z=!1,enableColumnVisibility:v=!0,data:S,onClearSorting:M,onClearFilters:G,enableColumnPinning:$=!1,onExternalSearch:ee,onCustomFilterChange:X,aggregations:j={},onAggregationChange:H}){let[q,x]=Kt({}),[he,K]=Kt({}),xe=()=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1),ze=()=>e.getAllColumns().filter(t=>!e.getAllLeafColumns().includes(t)&&t.columns?.length&&t.columns.some(d=>d.getCanHide?.()!==!1)),Ce=()=>{let t=new Set(ze().flatMap(d=>d.columns?.filter(m=>m.getCanHide?.()!==!1).map(m=>m.id)||[]));return xe().filter(d=>!t.has(d.id))},ye=(t,d)=>d&&t.startsWith(`${d}.`)?t.replace(`${d}.`,"").split("_").map(w=>w.slice(1)).join(" "):t.split("_").map(m=>m.charAt(0).toUpperCase()+m.slice(1)).join(" "),ce=(t,d)=>{let m={...q,[t]:d};x(m)},Qe=(t,d)=>{let m={...he,[t]:d};K(m),X&&X(t,d),n.find(w=>w.key===t)?.externalSearch&&ce(t,d)},Ye=()=>{ee&&ee(q)},Ie=()=>{x({}),K({}),G(),ee&&ee({}),X&&Object.keys(he).forEach(t=>{X(t,"")})},we=t=>n.find(m=>m.key===t)?.customFilter?he[t]??"":e.getColumn(t)?.getFilterValue(),ue=(t,d)=>{let m=n.find(w=>w.key===t);m?.customFilter?Qe(t,d):(e.getColumn(t)?.setFilterValue(d),m?.externalSearch&&ce(t,d))},Ne=t=>{if(H){let d=j[t],m={enabled:!d?.enabled,functions:d?.functions||["sum","average"]};H(t,m)}},Ze=(t,d)=>{if(H){let w=j[t]?.functions||[],D=w.includes(d)?w.filter(wt=>wt!==d):[...w,d];H(t,{enabled:D.length>0,functions:D})}},Fe=()=>{H&&Object.keys(j).forEach(t=>{let d=j[t];d&&H(t,{...d,enabled:!1,functions:[]})})},Pe=xe().filter(t=>t.id==="select"||t.id==="serialNumber"?!1:t.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(w=>{let D=w.getValue(t.id);return typeof D=="number"||typeof D=="string"&&!isNaN(parseFloat(String(D)))||typeof D=="object"&&D!==null&&"props"in D})),se=Object.values(j).some(t=>t?.enabled);return s("div",{className:"rounded-xl",children:s("div",{className:"px-2",children:s("div",{className:"flex flex-col gap-6",children:h("div",{className:"flex items-center justify-between",children:[s("div",{className:"flex items-center gap-3",children:n.length>0&&h("div",{className:"flex flex-wrap items-center gap-3",children:[s("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:s(Jt,{className:"size-4"})}),n.map(t=>!e.getColumn(t.key)&&!t.customFilter&&!t.externalSearch?null:s("div",{className:o("relative min-w-[150px]",t.width),children:t.type==="select"?h(Oe,{value:we(t.key)??"",onValueChange:m=>{ue(t.key,m==="all"?"":m)},children:[t.icon&&s("span",{children:s(t.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),s(je,{className:o("h-7 sm:h-7 rounded-lg w-full",t.icon&&"pl-9"),children:s(Ge,{placeholder:t.placeholder})}),h(Ee,{className:"rounded-lg",children:[s(Te,{value:"all",children:"All"}),t.options?.map(m=>s(Te,{value:m.value,children:m.label},m.label))]})]}):t.type==="date"?s($t,{value:we(t.key),onChange:m=>{t.onlyExternal||ue(t.key,m)},placeholder:t.placeholder,mode:t.dateMode||"single",externalSearch:t.externalSearch,onlyExternal:t.onlyExternal,onExternalChange:m=>ce(t.key,m)}):h("div",{className:"relative",children:[t.icon&&s("span",{children:s(t.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),s(pt,{placeholder:t.placeholder,value:we(t.key)??"",onChange:m=>{ue(t.key,m.target.value)},className:o("h-7 rounded-lg",t.icon&&"pl-9"),type:t.type==="number"?"number":"text"})]})},t.key)),(n.some(t=>t.externalSearch)||n.some(t=>t.customFilter))&&h(N,{variant:"default",size:"sm",onClick:Ye,className:"rounded-lg h-7",children:[s(Wt,{className:"size-4"}),n.find(t=>t.externalSearch||t.customFilter)?.searchButtonText||"Search"]})]})}),h("div",{className:"flex items-center gap-2",children:[T&&h("div",{className:"relative",children:[s(Wt,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),s(pt,{placeholder:"Global search...",value:l??"",onChange:t=>g(t.target.value),className:"pl-9 h-7 max-w-max"})]}),Pe.length>0&&H&&h(ge,{children:[s(fe,{asChild:!0,children:h(N,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",se&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[s(ht,{className:"size-4"}),s("span",{children:"Aggregations"}),s(Xt,{className:"opacity-50 size-4"})]})}),h(be,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[h(J,{className:"flex items-center justify-between px-4 py-2",children:[s("span",{className:"text-sm font-medium",children:"Column Aggregations"}),se&&s(N,{variant:"ghost",size:"sm",onClick:Fe,className:"h-6 px-2 text-xs",children:"Clear All"})]}),s(re,{}),Pe.map(t=>{let d=j[t.id],m=d?.enabled;return h(Ht,{children:[s(At,{className:"text-sm",children:h("div",{className:"flex items-center w-full gap-2",children:[s(Me,{checked:m,onCheckedChange:()=>Ne(t.id),className:"data-[state=checked]:bg-primary"}),s("span",{className:o("flex-1",m&&"font-medium text-primary"),children:ye(t.id)}),m&&h("div",{className:"flex items-center gap-1",children:[d?.functions?.slice(0,2).map(w=>s("div",{className:"w-2 h-2 rounded-full bg-primary",title:Qt.find(D=>D.value===w)?.label},w)),d?.functions&&d.functions.length>2&&h("div",{className:"text-xs text-muted-foreground",children:["+",d.functions.length-2]})]})]})}),h(Lt,{className:"w-48 rounded-lg",children:[s(J,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),Qt.map(w=>s(Ue,{checked:d?.functions?.includes(w.value)||!1,onCheckedChange:()=>Ze(t.id,w.value),className:"py-2 text-sm",children:h("div",{className:"flex flex-col",children:[s("span",{children:w.label}),s("span",{className:"text-xs text-muted-foreground",children:w.description})]})},w.value))]})]},t.id)}),Pe.length===0&&h("div",{className:"px-3 py-4 text-center",children:[s(ht,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),s("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),b&&h(N,{variant:"outline",size:"sm",onClick:()=>b(S),className:"rounded-lg",children:[s(Yo,{className:"size-4"}),"Export"]}),v&&h(ge,{children:[s(fe,{asChild:!0,className:"h-7",children:h(N,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[s("span",{children:"Columns"}),s(Xt,{className:"opacity-50 size-4"})]})}),h(be,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[s(J,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),s(re,{}),Ce().length>0&&h(ft,{children:[s(J,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),Ce().map(t=>s(Ue,{className:"text-sm",checked:t.getIsVisible(),onCheckedChange:d=>t.toggleVisibility(!!d),children:ye(t.id)},t.id))]}),ze().map(t=>h(ft,{children:[s(re,{}),s(J,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:t.id}),t.columns?.filter(d=>d.getCanHide?.()!==!1).map(d=>s(Ue,{className:"text-sm",checked:d.getIsVisible(),onCheckedChange:m=>d.toggleVisibility(!!m),children:ye(d.id,t.id)},d.id))]},t.id))]})]}),h(ge,{children:[s(fe,{asChild:!0,className:"h-7",children:s(N,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:s(Zo,{className:"size-4"})})}),h(be,{align:"end",className:"w-[200px] rounded-lg",children:[s(J,{children:"Table Settings"}),s(re,{}),h(U,{onClick:M,children:[s(en,{className:"size-4"}),"Clear All Sorting"]}),h(U,{onClick:Ie,children:[s(Jt,{className:"size-4"}),"Clear All Filters"]}),se&&h(U,{onClick:Fe,children:[s(ht,{className:"size-4"}),"Clear Aggregations"]}),$&&h(nn,{children:[s(re,{}),s(J,{children:"Column Pinning"}),h(U,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[s(tn,{className:"size-4"}),"Reset All Pinning"]}),h(U,{onClick:()=>{let t=xe().filter(d=>d.getCanPin?.()!==!1).map(d=>d.id);e.setColumnPinning({left:[],right:t})},children:[s(on,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),V&&s(N,{variant:"outline",size:"sm",onClick:V,disabled:Z,className:"rounded-lg",children:s(Qo,{className:o("h-4 w-4",Z&&"animate-spin")})})]})]})})})})}import{jsx as _,jsxs as ve}from"react/jsx-runtime";function Zt({table:e,config:n}){return n.enabled?_("div",{className:"rounded-xl",children:_("div",{children:ve("div",{className:"flex items-center justify-between",children:[_("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:n.showInfo!==!1&&ve("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"]})}),ve("div",{className:"flex items-center gap-4",children:[n.pageSizeOptions&&ve("div",{className:"flex items-center gap-2",children:[_("span",{className:"text-sm font-medium",children:"Rows per page:"}),ve(Oe,{value:`${e.getState().pagination.pageSize}`,onValueChange:l=>e.setPageSize(Number(l)),children:[_(je,{className:"h-9 w-[70px] rounded-lg",children:_(Ge,{})}),_(Ee,{side:"top",className:"rounded-lg",children:n.pageSizeOptions.map(l=>_(Te,{value:`${l}`,children:l},l))})]})]}),ve("div",{className:"flex items-center gap-2",children:[_(N,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),_(N,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),n.showPageNumbers&&_("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(l,g)=>{let T=e.getState().pagination.pageIndex,b=T+g;return b<1||b>e.getPageCount()?null:_(N,{variant:b===T+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(b-1),children:b},b)})}),_(N,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),_(N,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as an}from"radix-ui";import{cva as rn}from"class-variance-authority";import{jsx as ln}from"react/jsx-runtime";var sn=rn("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 eo({className:e,variant:n,size:l,noBg:g,...T}){return ln(an.Root,{"data-slot":"toggle",className:o(sn({className:e,variant:n,size:l,bg:g?"disabled":"enabled"})),...T})}import{useCallback as Je,useEffect as Xe,useMemo as Ke,useRef as Re,useState as O}from"react";import{Fragment as ao,jsx as i,jsxs as P}from"react/jsx-runtime";var no={sum:e=>e.reduce((n,l)=>n+l,0),average:e=>e.length>0?e.reduce((n,l)=>n+l,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let n=[...e].sort((g,T)=>g-T),l=Math.floor(n.length/2);return n.length%2===0?(n[l-1]+n[l])/2:n[l]}};function rr({data:e,columns:n,filters:l=[],pagination:g={enabled:!1},settings:T={},header:b,footer:V,className:Z="",maxHeight:v="100%",loading:S=!1,error:M,emptyMessage:G="No data available",onRowSelectionChange:$,onExport:ee,onRefresh:X,onTableReady:j,children:H,isRowDisabled:q,isRowSelectable:x,onExternalSearch:he,aggregations:K={},onAggregationChange:xe}){let[ze,Ce]=O([]),[ye,ce]=O([]),[Qe,Ye]=O({}),[Ie,we]=O({}),[ue,Ne]=O(""),[Ze,Fe]=O([]),[_e,Pe]=O(T.enableColumnPinning?{left:[],right:[]}:{}),[se,t]=O({}),d=Re(null),m=Re(null),w=Re(null),D=Re(null),[wt,ro]=O(0),[Nt,io]=O(0),[so,lo]=O(0),[Pt,co]=O(0),Ve=Re(null),[et,uo]=O(!1),{enableSorting:tt=!0,enableFiltering:ot=!0,enableGlobalFilter:St=!0,enableColumnVisibility:nt=!0,enableRowSelection:A=!0,stickyHeader:hn=!0,toolbar:Se=!1,toolbarPosition:le="default",showSerialNumbers:te=!0,fixedCheckboxColumn:He=!0,striped:mo=!0,hoverable:po=!0,compact:Ae=!0,bordered:Tt=!0,fullHeight:go=!1,enableColumnResizing:kt=!1,enableColumnPinning:z=!0,hideHeader:fo=!1,selectionMode:oe="multiple",showCheckBox:bo=!0,checkboxColumnPosition:Dt=0}=T;Xe(()=>{let r=()=>{Ve.current&&uo(Ve.current.scrollTop>0)},u=Ve.current;if(u)return u.addEventListener("scroll",r),()=>u.removeEventListener("scroll",r)},[]),Xe(()=>{let r=()=>{d.current&&ro(d.current.offsetHeight+16),m.current&&io(m.current.offsetHeight+16),w.current&&lo(w.current.offsetHeight+16),D.current&&co(D.current.offsetHeight+16)};r();let u=new ResizeObserver(()=>{setTimeout(r,50)});return d.current&&u.observe(d.current),m.current&&u.observe(m.current),w.current&&u.observe(w.current),D.current&&u.observe(D.current),()=>{u.disconnect()}},[Se,b,le]);let vo=(r,u)=>u.split(".").reduce((a,p)=>a&&a[p],r),at=Ke(()=>Object.keys(se).length===0?e:e.filter(r=>Object.entries(se).every(([u,a])=>{if(!a||a==="")return!0;let p=vo(r,u);return typeof a=="string"?String(p).toLowerCase().includes(a.toLowerCase()):p===a})),[e,se]),ho=Je((r,u)=>{t(a=>{let p={...a};return u===""||u===null||u===void 0?delete p[r]:p[r]=u,p})},[]),me=Ke(()=>{let r=[...n],u=c=>c.map(f=>{if(f.id==="select"||f.id==="serialNumber")return f;let C={...f,enablePinning:!0};return f.columns&&(C.columns=u(f.columns)),C}),a=u(r),p={id:"select",header:({table:c})=>{if(oe==="single")return null;let f=c.getRowModel().rows.filter(L=>!q?.(L.original)&&(x?x(L.original):!0)),C=f.length>0&&f.every(L=>L.getIsSelected()),k=f.some(L=>L.getIsSelected());return i(Me,{checked:C||k&&"indeterminate",onCheckedChange:L=>{f.forEach(I=>I.toggleSelected(!!L))},"aria-label":"Select all selectable rows"})},cell:({row:c})=>{let f=q?q(c.original):!1,C=x?x(c.original):!0;return i("div",{className:o("flex items-center justify-center",f&&"opacity-50"),children:oe==="multiple"?i(Me,{checked:c.getIsSelected(),onCheckedChange:k=>C&&c.toggleSelected(!!k),"aria-label":"Select row",disabled:f||!C}):bo?i("input",{type:"radio",checked:c.getIsSelected(),onChange:()=>C&&c.toggleSelected(!0),disabled:f||!C,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:oe==="multiple"?40:30};if(A){let c=Dt;c<0&&(c=a.length+c+1),c=Math.max(0,Math.min(c,a.length)),a.splice(c,0,p)}if(te){let c={id:"serialNumber",header:"No.",cell:({row:f})=>i("div",{className:"font-medium text-center text-muted-foreground",children:f.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};a.unshift(c)}return a},[n,te,A,He,q,x,oe,Dt]),y=pn({data:at,columns:me,onSortingChange:tt?Ce:void 0,onColumnFiltersChange:ot?ce:void 0,onGlobalFilterChange:St?Ne:void 0,getCoreRowModel:dn(),getPaginationRowModel:g.enabled?un():void 0,getSortedRowModel:tt?mn():void 0,getFilteredRowModel:ot?cn():void 0,onColumnVisibilityChange:nt?Ye:void 0,onRowSelectionChange:A?we:void 0,onColumnOrderChange:Fe,onColumnPinningChange:z?Pe:void 0,state:{sorting:tt?ze:void 0,columnFilters:ot?ye:void 0,columnVisibility:nt?Qe:void 0,rowSelection:A?Ie:{},globalFilter:ue,columnOrder:Ze,columnPinning:z?_e:{}},initialState:{pagination:g.enabled?{pageSize:g.pageSize||10}:void 0,columnPinning:z?{left:[...te?["serialNumber"]:[],...A?["select"]:[]],right:[]}:void 0},enableRowSelection:A,enableColumnResizing:kt,enableColumnPinning:z,columnResizeMode:"onChange"}),xo=Ke(()=>{if(!K||Object.keys(K).length===0)return{};let r={},u=y.getFilteredRowModel().rows;return Object.entries(K).forEach(([a,p])=>{if(!p?.enabled)return;let c=u.map(C=>{if(p.accessor)return p.accessor(C.original);{let k=C.getValue(a);return typeof k=="number"?k:parseFloat(String(k))||0}}).filter(C=>C!==null&&!isNaN(C)),f={};p.functions?.forEach(C=>{no[C]&&(f[C]=no[C](c))}),Object.keys(f).length>0&&(r[a]=f)}),r},[at,K,y?.getFilteredRowModel().rows]);Xe(()=>{if(A&&$){let r=y.getFilteredSelectedRowModel().rows.filter(u=>!q?.(u.original)&&(x?x(u.original):!0)).map(u=>u.original);$(r)}},[Ie,A,$,y,q,x]);let Co=Je(r=>{oe==="single"?(y.resetRowSelection(),r.toggleSelected(!0)):r.toggleSelected()},[oe,y]);Xe(()=>{j&&j(y)},[y,j]);let yo=Je(()=>{Ce([])},[]),wo=Je(()=>{ce([]),Ne("")},[]),Mt=(r,u)=>{if(!z)return;let a=[...te?["serialNumber"]:[],...A&&He?["select"]:[]],p={left:[...(_e.left??[]).filter(c=>a.includes(c))],right:[..._e.right??[]]};u===!1?(p.left=p.left.filter(c=>c!==r),p.right=p.right.filter(c=>c!==r)):u==="right"?(p.left=p.left.filter(c=>c!==r),p.right.includes(r)||p.right.push(r)):u==="left"&&(p.right=p.right.filter(c=>c!==r),!p.left.includes(r)&&!a.includes(r)&&p.left.push(r)),y.setColumnPinning(p)},No=()=>i(ct,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:i(Y,{className:"hover:bg-transparent bg-sidebar",children:y.getHeaderGroups()[0]?.headers.map((r,u)=>{let a=r.column.id,p=xo[a],c=z&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&A),f=z&&r.column.getIsPinned()==="right",C=r.column.id==="serialNumber",k=r.column.id==="select",I=r.column.columnDef.customFooter;return i(ae,{className:o("font-semibold text-sm py-2 px-2 border-r",Ae&&"py-1",c&&"sticky left-0 z-30 bg-sidebar/95",f&&"sticky right-0 z-30 bg-sidebar/95",(C||k)&&"sticky left-0 z-30 bg-sidebar/95",I?.className),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...c&&{left:C?0:k?te&&y.getColumn("serialNumber")?.getSize()||0:rt(r.column)},...f&&{right:it(r.column)},...C&&{left:0}},children:(()=>{if(I?.content){let Q=typeof I.content=="function"?I.content(y):I.content;return i("div",{className:o("w-full h-full",I.align==="center"&&"text-center",I.align==="right"&&"text-right",I.align==="left"&&"text-left"),children:Q})}return p?i("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(p).map(([Q,Le])=>P("div",{className:"flex items-center justify-between text-muted-foreground",children:[P("span",{className:"text-xs capitalize",children:[Q,":"]}),i("span",{className:"font-medium text-foreground",children:Po(Q,Le)})]},Q))}):a==="serialNumber"?P("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",y.getFilteredRowModel().rows.length]}):null})()},`agg-${r.id}`)})})}),Po=(r,u)=>typeof u=="number"?r==="count"||r==="unique"?u.toLocaleString():u.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):u,So=()=>y.getHeaderGroups().map((r,u)=>i(Y,{className:"hover:bg-transparent",children:r.headers.map((a,p)=>{let c=a.depth===0&&a.colSpan>1,f=z&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&A),C=z&&a.column.getIsPinned()==="right",k=a.column.getCanSort(),L=z&&a.column.columnDef.enablePinning!==!1,I=a.column.id==="serialNumber",Q=a.column.id==="select",Le=I||Q&&He,pe=a.column.columnDef.headerAlign||"left",lt=K&&K[a.column.id]?.enabled,Do={left:"justify-start",center:"justify-center",right:"justify-end"}[pe];return P(It,{colSpan:a.colSpan,className:o("font-semibold text-foreground bg-sidebar group px-0",!Ae&&"py-2",Tt&&p<r.headers.length-1&&"border-r","relative",f&&"sticky left-0 z-25 bg-sidebar",C&&"sticky right-0 z-25 bg-sidebar",(I||Q)&&"sticky left-0 z-25 bg-sidebar",c?"text-center":"text-left",lt&&"border-b-2 border-primary/30"),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...f&&{left:I?0:Q?te&&y.getColumn("serialNumber")?.getSize()||0:rt(a.column)},...C&&{right:it(a.column)},...I&&{left:0}},children:[c?P("div",{className:"flex items-center justify-center",children:[xt(a.column.columnDef.header,a.getContext()),lt&&i(oo,{className:"w-3 h-3 ml-1 text-primary"})]}):P("div",{className:o("relative flex items-center w-full px-2",Do),children:[P("div",{className:"flex items-center gap-1",children:[lt&&i(oo,{className:"w-3 h-3 mr-1 text-primary"}),k&&pe==="right"&&i("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:i(Ct,{className:"w-4 h-4"}),desc:i(yt,{className:"w-4 h-4"})}[a.column.getIsSorted()]}),a.isPlaceholder?null:xt(a.column.columnDef.header,a.getContext()),k&&pe!=="right"&&a.column.getIsSorted()&&i("span",{className:"order-2 ml-1",children:a.column.getIsSorted()&&{asc:i(Ct,{className:"w-4 h-4"}),desc:i(yt,{className:"w-4 h-4"})}[a.column.getIsSorted()]})]}),(k||L&&!Le)&&P(ge,{children:[i(fe,{asChild:!0,className:o("absolute",pe==="left"&&"right-1",pe==="center"&&"right-1",pe==="right"&&"left-1"),children:i(eo,{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(fn,{className:"w-4 h-4"})})}),P(be,{align:"end",className:"w-48",children:[k&&P(ao,{children:[i(J,{children:"Sorting"}),P(U,{onClick:()=>a.column.toggleSorting(!1),children:[i(Ct,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),P(U,{onClick:()=>a.column.toggleSorting(!0),children:[i(yt,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),P(U,{onClick:()=>a.column.clearSorting(),disabled:!a.column.getIsSorted(),children:[i(gn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),i(re,{})]}),L&&!Le&&P(ao,{children:[i(J,{children:"Pin Column"}),P(U,{onClick:()=>Mt(a.column.id,"right"),disabled:a.column.getIsPinned()==="right",children:[i(bn,{}),"Pin Right"]}),P(U,{onClick:()=>Mt(a.column.id,!1),disabled:!a.column.getIsPinned(),children:[i(vn,{}),"Unpin"]})]})]})]})]}),kt&&a.column.getCanResize()&&!c&&a.colSpan===1&&i("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:a.getResizeHandler()})]},a.id)})},r.id)),rt=r=>{if(!z)return;let u=0,a=y.getLeftHeaderGroups()[0]?.headers||[],p=[...te?["serialNumber"]:[],...A?["select"]:[]];for(let c of a){if(c.id===r.id)break;if(p.includes(c.id)){let f=y.getColumn(c.id);f&&(u+=f.getSize())}}return u},it=r=>{if(!z)return;let u=y.getState().columnPinning.right||[],a=u.indexOf(r.id);if(a===-1)return;let p=0;for(let c=a+1;c<u.length;c++){let f=y.getColumn(u[c]);f&&(p+=f.getSize())}return p};if(M)return i(ut,{className:"w-full shadow-sm rounded-xl",children:i(mt,{className:"flex items-center justify-center",children:P("div",{className:"text-center",children:[i("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),i("p",{className:"mb-4 text-sm text-muted-foreground",children:M}),X&&P(N,{variant:"outline",size:"sm",onClick:X,className:"rounded-lg",children:[i(to,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let To=r=>r&&typeof r=="object"&&"content"in r,W=Ke(()=>b?To(b)?{content:b.content,align:b.align||"left",className:b.className||"",sticky:b.sticky!==void 0?b.sticky:!0,showOnEmpty:b.showOnEmpty!==void 0?b.showOnEmpty:!0}:{content:b,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[b]),st=()=>Se?i(Yt,{table:y,filters:l,globalFilter:ue,onGlobalFilterChange:Ne,enableGlobalFilter:St,onExport:ee,onRefresh:X,loading:S,enableColumnVisibility:nt,enableColumnPinning:z,data:at,onClearSorting:yo,onClearFilters:wo,onExternalSearch:he,onCustomFilterChange:ho,aggregations:K,onAggregationChange:xe}):null,ko=()=>{let r=0;return le==="above-header"&&(r+=Nt),W&&(r+=Pt),le==="below-header"&&(r+=so),r};return i(_t,{children:P("div",{className:o("w-full space-y-2 flex flex-col h-full",Z),children:[Se&&le==="default"&&i("div",{ref:d,className:"relative z-40",children:st()}),i(ut,{className:o("shadow-sm overflow-hidden py-0",go&&"flex-1"),children:i(mt,{className:"h-full p-0",children:P("div",{className:"relative flex flex-col justify-between h-full",children:[S&&i("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:P("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[i(to,{className:"size-5 animate-spin text-primary"}),i("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),i("div",{ref:Ve,className:o("relative overflow-auto border-b rounded-t-xl",y.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:v},children:P(dt,{className:o("w-full border-collapse relative",y.getRowModel().rows?.length===0&&"h-full"),children:[Se&&le==="above-header"&&i("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:i(Y,{className:"hover:bg-transparent",children:i(ae,{colSpan:me.length,className:"p-2 bg-sidebar border-b shadow-sm",children:i("div",{ref:m,children:st()})})})}),W&&(W.showOnEmpty||y.getRowModel().rows?.length>0)&&i("thead",{className:o("sticky bg-sidebar border-b",et&&"shadow-sm"),style:{top:le==="above-header"?`${Nt}px`:"0px",zIndex:35},children:i(Y,{className:"hover:bg-transparent",children:i(ae,{colSpan:me.length,className:o("p-2 font-semibold text-foreground bg-sidebar",Ae?"py-2":"py-4",W.className),children:i("div",{ref:D,className:o("flex items-center w-full",W.align==="center"&&"justify-center",W.align==="right"&&"justify-end",W.align==="left"&&"justify-start"),children:typeof W.content=="string"?i("span",{className:"text-lg font-bold tracking-tight text-foreground",children:W.content}):W.content})})})}),Se&&le==="below-header"&&i("thead",{className:o("sticky bg-sidebar border-b",et&&"shadow-sm"),style:{top:W?`${Pt}px`:"0px",zIndex:35},children:i(Y,{className:"hover:bg-transparent",children:i(ae,{colSpan:me.length,className:"p-2 bg-sidebar",children:i("div",{ref:w,children:st()})})})}),!fo&&i(Rt,{className:o("sticky bg-sidebar",et&&"shadow-sm"),style:{top:`${ko()}px`,zIndex:30},children:So()}),i(zt,{children:y.getRowModel().rows?.length?y.getRowModel().rows.map((r,u)=>i(Y,{"data-state":r.getIsSelected()&&"selected",className:o(po&&"hover:bg-muted/50",mo&&u%2===0&&"bg-muted/20",r.getIsSelected()&&"bg-muted","border-b last:border-b-0",oe==="single"&&"cursor-pointer"),onClick:()=>{oe==="single"&&Co(r)},children:r.getVisibleCells().map((a,p)=>{let c=z&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&A),f=z&&a.column.getIsPinned()==="right",C=a.column.id==="serialNumber",k=a.column.id==="select",L=C||k&&He;return i(ae,{className:o(Ae?"py-2":"py-4",Tt&&p<r.getVisibleCells().length&&"border-r",c&&"sticky left-0 z-20 bg-sidebar/95",f&&"sticky right-0 z-20 bg-sidebar/95",C&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:a.column.getSize()!==150?a.column.getSize():"auto",minWidth:a.column.getSize()!==150?a.column.getSize():"auto",...c&&{left:C?0:k?te&&y.getColumn("serialNumber")?.getSize()||0:rt(a.column)},...f&&{right:it(a.column)},...C&&{left:0}},children:xt(a.column.columnDef.cell,a.getContext())},a.id)})},r.id)):i(Y,{children:i(ae,{colSpan:me.length,className:"h-32 text-center border-0",children:P("div",{className:"flex flex-col items-center gap-3",children:[i("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),i("p",{className:"font-medium text-muted-foreground",children:G})]})})})}),No()]})}),V&&i("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:i(dt,{children:i(ct,{children:i(Y,{className:"bg-sidebar",children:i(ae,{colSpan:me.length,className:"p-2",children:V})})})})})]})})}),i(Zt,{table:y,config:g}),H&&H(y)]})})}export{rr as DataTable};
|
|
3
3
|
//# sourceMappingURL=data-table.js.map
|