import{j as e}from"./vendor-query-B2UbickB.js";import{E as b}from"./EmptyState-BcsfPq9T.js";function j({active:s,direction:a}){return e.jsx("svg",{className:`w-3 h-3 shrink-0 transition-all duration-150 ${s?"text-accent opacity-100":"opacity-0 group-hover/sorthead:opacity-40 text-text-tertiary"} ${s&&a==="asc"?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function N({columns:s,data:a,keyFn:l,onRowClick:o,activeRowKey:d,rowClassName:x,isLoading:h,emptyMessage:p="No records found",sort:n,onSort:u,inline:m}){return h?e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:5}).map((r,t)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},t))}):a.length?e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b",children:s.map(r=>{const t=r.sortable&&u,i=(n==null?void 0:n.sort_by)===r.key;return e.jsx("th",{onClick:t?()=>u(r.key):void 0,className:`${m?"":"sticky top-[2.75rem] z-10 "}bg-surface px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary whitespace-nowrap ${r.className??""} ${t?"cursor-pointer select-none group/sorthead hover:text-text-secondary transition-colors":""}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.label,t&&e.jsx(j,{active:i,direction:i?n.order:"desc"})]})},r.key)})})}),e.jsx("tbody",{children:a.map((r,t)=>{const i=d!=null&&l(r)===d;return e.jsx("tr",{onClick:o?()=>o(r):void 0,className:`group/row border-b last:border-b-0 transition-colors duration-100 ${o?"cursor-pointer row-hover":""} ${i?"bg-accent/5 border-l-2 border-l-accent":""} ${x?x(r):""}`,children:s.map(c=>e.jsx("td",{className:`px-6 py-2.5 text-sm ${c.className??""}`,children:c.render(r,t)},c.key))},l(r))})})]}):p?e.jsx(b,{title:p}):null}export{N as D};
//# sourceMappingURL=DataTable-D9yuBv0w.js.map
