import{r as x,j as e,f as r,I as i}from"./index-f9c70843.js";import{S as N,f as u,g as p,h as v,j as g}from"./table-ef59afbe.js";function C({pageSize:m=12,pageIndex:s=1,rowsCount:d=[12,24,48,96],totalRowsCount:t=0,paginate:l,storeComponent:h=!1}){const[c,j]=x.useState(m),[n,o]=x.useState(Math.ceil(t/m));return x.useEffect(()=>{o(Math.ceil(t/c))},[t]),e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center justify-between px-2",children:[e.jsx("div",{className:"flex-1 text-sm text-muted-foreground"}),e.jsxs("div",{className:h?"flex items-center lg:space-x-8 ":"flex items-center space-x-6 lg:space-x-8 ",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),e.jsxs(N,{onValueChange:a=>{j(Number(a)),o(Math.ceil(t/Number(a))),l(Number(a),1)},value:m.toString(),children:[e.jsx(u,{className:"w-[100px]",children:e.jsx(p,{placeholder:"10"})}),e.jsx(v,{children:d.map((a,f)=>e.jsx(g,{value:a.toString(),children:a},f))})]})]}),e.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",s,!h&&e.jsxs(e.Fragment,{children:[" of ",n]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(r,{disabled:s<=1,variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>{l(c,1)},children:[e.jsx("span",{className:"sr-only",children:"Go to first page"}),e.jsx(i,{name:"ChevronsLeft",className:"h-4 w-4"})]}),e.jsxs(r,{disabled:s<=1,onClick:()=>{s>0&&l(c,s-1)},variant:"outline",className:"h-8 w-8 p-0",children:[e.jsx("span",{className:"sr-only",children:"Go to previous page"}),e.jsx(i,{name:"ChevronLeft",className:"h-4 w-4"})]}),e.jsxs(r,{disabled:s===n,onClick:()=>{l(c,s+1)},variant:"outline",className:"h-8 w-8 p-0",children:[e.jsx("span",{className:"sr-only",children:"Go to next page"}),e.jsx(i,{name:"ChevronRight",className:"h-4 w-4"})]}),e.jsxs(r,{disabled:s===n,variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>{l(c,n)},children:[e.jsx("span",{className:"sr-only",children:"Go to last page"}),e.jsx(i,{name:"ChevronsRight",className:"h-4 w-4"})]})]})]})]})})}export{C as P};
