import{j as t,R as f,K as b,C as y,dq as g,cu as j,a2 as N,ap as T,ek as v}from"./app-BgLa5dit.js";import{C as S}from"./CTg_3F42.chunk.js";function C(e){return t.jsx("div",{className:"py-5 text-center",children:e.emptyStateText??"No data available."})}const w="_filterButton_14zrq_1",M="_hideCaret_14zrq_4",D="_baseWidth_14zrq_7",m={filterButton:w,hideCaret:M,baseWidth:D};function _(e){var i;const l=e.type==="dropdown",[o,r]=f.useState(!1);function d(n){r(n)}const c=`${m.filterButton} mx-1 btn`,u=l?"":m.hideCaret;return t.jsxs(b,{onToggle:d,show:o,children:[t.jsx(b.Toggle,{id:e.name,className:`${c} ${u} ${e.extraClasses??""}`,variant:l?"outline-dark":"dark",disabled:e.disabled,children:e.name}),t.jsx(b.Menu,{children:t.jsx("div",{className:`${e.columnGroups?"":"py-1 "} ${(i=e.columnGroups)!=null&&i.length?"d-flex flex-row":""} px-3`,children:!e.columnGroups||!e.columnGroups.length?t.jsx("div",{className:`px-2 ${m.baseWidth}`,children:e.columns.map((n,s)=>t.jsx(y,{label:n.name,name:n.name,id:n.id,onChange:()=>e.onToggleVisibility(n,!n.visible),checked:n.visible,className:"my-2"},s))}):e.columnGroups.map((n,s)=>t.jsxs("div",{className:`px-2 ${m.baseWidth}`,children:[t.jsx("h5",{className:"my-2",children:n}),e.columns.filter(a=>a.type===n).map((a,x)=>t.jsx(y,{label:a.name,name:a.name,id:a.id,onChange:()=>e.onToggleVisibility(a,!a.visible),checked:a.visible,className:"my-2"},x))]},s))})})]})}function G(e){var i,n;const[l,o]=f.useState(e.columns),r=f.useMemo(()=>g({columns:e.columns,columnData:e.columnData}),[e.columnData.extraData]),d=(s,a)=>{o(x=>x.map(h=>h.id===s.id?{...h,visible:a}:h))},c=l.filter(s=>!s.visible).map(s=>s.id),u=l.filter(s=>s.name!==j.Actions);return!((i=e.members)!=null&&i.length)&&!e.onlyHideTableOnEmpty?t.jsx(C,{emptyStateText:e.emptyStateText}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:N("pt-2 pb-3 d-flex",(n=e.classNames)==null?void 0:n.filterContainer),children:[t.jsxs("div",{className:"d-inline-flex",children:[t.jsx(_,{name:"Edit Columns",type:"dropdown",columnGroups:e.columnGroups,columns:u,onToggleVisibility:d}),t.jsxs("span",{className:"px-2 text-secondary align-self-center",children:[e.members.length," items"]})]}),e.children]}),t.jsx(T,{columns:r,data:e.members,theme:S,globalFilter:e.searchQuery,hiddenColumns:c,autoResetSortBy:!1,autoResetHiddenColumns:!1,emptyState:t.jsx(C,{emptyStateText:e.emptyStateText}),enableSort:!0}),(e.hasMoreMembers||e.isFetching)&&t.jsx(v,{isFetching:e.isFetching,fetchNext:e.fetchNext,nextCursor:e.nextCursor})]})}export{G as M};
//# sourceMappingURL=CJkmdwb7.chunk.js.map
