import{r as l,j as e,v as y,m as b}from"./app-BGey7YPf.js";import{I as j}from"./input-CGSIKYsG.js";import{S as w,a as N,b as T,c as v,d as i}from"./select-BqSuhmAT.js";import{a as o}from"./button-D5r5edT8.js";const k=({children:a,className:r})=>e.jsx("div",{className:o("w-full bg-white dark:border-gray-900 border rounded-md overflow-x-auto scrollbar-hide dark:bg-gray-950",r),children:a});k.displayName="TableCard";const C=({url:a,placeholder:r,withFilterPage:s=!1,currentPage:g,perPage:p})=>{const{data:t,setData:m}=y({search:"",page:g,perPage:p});l.useCallback(d=>{const c=parseInt(d.target.value);m("page",c);const n={page:c,per_page:t.perPage,search:t.search};b.get(a,n,{preserveState:!0,replace:!0})},[t.perPage]);const u=l.useCallback(d=>{const c=parseInt(d);m("perPage",c);const n={per_page:c,page:1,search:t.search};b.get(a,n,{replace:!0,preserveState:!0})},[t.perPage,t.search]),f=l.useCallback(d=>{const c=d.target.value;m("search",c);const n={per_page:t.perPage,page:t.page,search:c};b.get(a,n,{preserveState:!0,replace:!0})},[t.perPage]);return e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex flex-col gap-6",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s&&e.jsxs(w,{onValueChange:u,children:[e.jsx(N,{className:"w-[70px] focus:ring-0",children:e.jsx(T,{placeholder:p})}),e.jsxs(v,{children:[e.jsx(i,{value:"10",children:"10"}),e.jsx(i,{value:"25",children:"25"}),e.jsx(i,{value:"50",children:"50"}),e.jsx(i,{value:"100",children:"100"})]})]}),e.jsx(j,{className:"w-full",type:"text",value:t.search,onChange:f,name:"search",placeholder:r})]})})})};C.displayName="TableFilter";const R=l.forwardRef(({className:a,icon:r,title:s,subtitle:g,...p},t)=>e.jsx("table",{ref:t,className:o("w-full caption-bottom text-sm",a),...p}));R.displayName="Table";const P=l.forwardRef(({className:a,...r},s)=>e.jsx("thead",{ref:s,className:o("[&_tr]:border-b bg-white dark:border-gray-900 dark:bg-gray-950",a),...r}));P.displayName="TableHeader";const S=l.forwardRef(({className:a,...r},s)=>e.jsx("tbody",{ref:s,className:o("[&_tr:last-child]:border-0",a),...r}));S.displayName="TableBody";const F=l.forwardRef(({className:a,...r},s)=>e.jsx("tfoot",{ref:s,className:o("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...r}));F.displayName="TableFooter";const x=l.forwardRef(({className:a,...r},s)=>e.jsx("tr",{ref:s,className:o("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted divide-x",a),...r}));x.displayName="TableRow";const I=l.forwardRef(({className:a,...r},s)=>e.jsx("th",{ref:s,className:o("p-3 whitespace-nowrap text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-gray-700 dark:text-gray-400",a),...r}));I.displayName="TableHead";const h=l.forwardRef(({className:a,...r},s)=>e.jsx("td",{ref:s,className:o("p-2 text-gray-700 dark:text-gray-400 whitespace-nowrap align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...r}));h.displayName="TableCell";const _=l.forwardRef(({className:a,...r},s)=>e.jsx("caption",{ref:s,className:o("mt-4 text-sm text-muted-foreground",a),...r}));_.displayName="TableCaption";const E=({colSpan:a,message:r})=>e.jsx(x,{children:e.jsxs(h,{colSpan:a,align:"center",children:[r," tidak ditemukan."]})});E.displayName="TableEmpty";export{C as T,k as a,R as b,P as c,x as d,I as e,S as f,E as g,h};
