UNPKG

@accounter/client

Version:

2 lines (1 loc) 1.2 kB
import{v as o,j as e,m as a,bZ as c,b_ as h,B as p,c0 as x,dU as n,dT as l}from"./index-DRqooPz9.js";import{E as g}from"./eye-off-DtXkBVx1.js";const j=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],d=o("arrow-down",j);const w=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],i=o("arrow-up",w);const m=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],u=o("chevrons-up-down",m);function k({column:s,title:r,className:t}){return s.getCanSort()?e.jsx("div",{className:a("flex items-center gap-2",t),children:e.jsxs(c,{children:[e.jsx(h,{asChild:!0,children:e.jsxs(p,{variant:"ghost",size:"sm",className:"data-[state=open]:bg-accent -ml-3 h-8",children:[e.jsx("span",{children:r}),s.getIsSorted()==="desc"?e.jsx(d,{}):s.getIsSorted()==="asc"?e.jsx(i,{}):e.jsx(u,{})]})}),e.jsxs(x,{align:"start",children:[e.jsxs(n,{onClick:()=>s.toggleSorting(!1),children:[e.jsx(i,{}),"Asc"]}),e.jsxs(n,{onClick:()=>s.toggleSorting(!0),children:[e.jsx(d,{}),"Desc"]}),e.jsx(l,{}),e.jsxs(n,{onClick:()=>s.toggleVisibility(!1),children:[e.jsx(g,{}),"Hide"]})]})]})}):e.jsx("div",{className:a(t),children:r})}export{k as D};