import{c as s,a as e,i as m,n as c,F as u,k as y,z as i,x as v,o as a,m as k,t as b}from"./app-DE5EohoY.js";const w={class:"w-full overflow-x-auto scrollbar-thin rounded-xl border border-slate-200"},B={class:"w-full border-collapse"},$=["onClick"],C={class:"flex items-center gap-2"},H={key:0,class:"w-4 h-4 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},V={key:0},j=["colspan"],M={key:1},z=["colspan"],A={class:"flex flex-col items-center justify-center gap-3"},N={key:0,class:"border-t border-slate-200 bg-white px-6 py-4"},T={__name:"ModernTable",props:{columns:{type:Array,required:!0},data:{type:Array,default:()=>[]},striped:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},stickyHeader:{type:Boolean,default:!0}},emits:["sort"],setup(l,{emit:f}){const p=l,h=f,x=r=>{r.sortable&&h("sort",r.key)},g=v(()=>!p.loading&&p.data.length===0);return(r,o)=>(a(),s("div",w,[e("table",B,[e("thead",{class:c(["bg-gradient-islamic text-white",l.stickyHeader&&"sticky top-0 z-10"])},[e("tr",null,[(a(!0),s(u,null,y(l.columns,t=>(a(),s("th",{key:t.key,class:c(["px-6 py-4 text-left text-sm font-semibold uppercase tracking-wider",t.sortable&&"cursor-pointer hover:bg-primary-700 transition-colors"]),onClick:d=>x(t)},[e("div",C,[i(r.$slots,`header-${t.key}`,{column:t},()=>[k(b(t.label),1)]),t.sortable?(a(),s("svg",H,[...o[0]||(o[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"},null,-1)])])):m("",!0)])],10,$))),128))])],2),e("tbody",null,[l.loading?(a(),s("tr",V,[e("td",{colspan:l.columns.length,class:"px-6 py-12"},[...o[1]||(o[1]=[e("div",{class:"flex flex-col items-center justify-center gap-3"},[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"}),e("p",{class:"text-sm text-slate-500"},"Memuat data...")],-1)])],8,j)])):g.value?(a(),s("tr",M,[e("td",{colspan:l.columns.length,class:"px-6 py-12"},[e("div",A,[i(r.$slots,"empty",{},()=>[o[2]||(o[2]=e("svg",{class:"w-16 h-16 text-slate-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})],-1)),o[3]||(o[3]=e("p",{class:"text-slate-600 font-medium"},"Tidak ada data",-1)),o[4]||(o[4]=e("p",{class:"text-sm text-slate-500"},"Data belum tersedia saat ini",-1))])])],8,z)])):(a(!0),s(u,{key:2},y(l.data,(t,d)=>(a(),s("tr",{key:d,class:c(["border-b border-slate-100 transition-colors duration-150",l.hoverable&&"hover:bg-slate-50",l.striped&&d%2===1&&"bg-slate-50/50"])},[(a(!0),s(u,null,y(l.columns,n=>(a(),s("td",{key:n.key,class:"px-6 py-4 text-sm text-slate-700"},[i(r.$slots,`cell-${n.key}`,{row:t,value:t[n.key]},()=>[k(b(t[n.key]),1)])]))),128))],2))),128))])]),r.$slots.pagination?(a(),s("div",N,[i(r.$slots,"pagination")])):m("",!0)]))}};export{T as _};
