@instincthub/react-ui 0.1.38 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,3 +207,5 @@
207
207
  background-color: var(--DarkCyan);
208
208
  border-radius: 3px;
209
209
  }
210
+
211
+ /* Dark mode handled by CSS variable swap (--White / --Gunmetal / --Gray) */
@@ -368,20 +368,7 @@
368
368
  .ihub-toast-container:nth-child(4 of .ihub-toast-container) { top: 216px; }
369
369
  .ihub-toast-container:nth-child(5 of .ihub-toast-container) { top: 280px; }
370
370
 
371
- /* Dark mode */
372
- .DarkMode .ihub-toast {
373
- background-color: var(--Gunmetal, #2c3e50);
374
- color: var(--White, #fff);
375
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
376
- }
377
-
378
- .DarkMode .ihub-toast-close {
379
- color: var(--White, #fff);
380
- }
381
-
382
- .DarkMode .ihub-toast-close:hover {
383
- background-color: rgba(255, 255, 255, 0.1);
384
- }
371
+ /* Dark mode handled by CSS variable swap (--White / --Gunmetal) */
385
372
 
386
373
  /* Responsive */
387
374
  @media (max-width: 576px) {
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e,objectSpread2 as t,toConsumableArray as n,asyncToGenerator as r,regenerator as a}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i,jsxs as o}from"react/jsx-runtime";import c,{forwardRef as l,useRef as s,useState as u,useCallback as d,useImperativeHandle as h,useEffect as p}from"react";import b from"@mui/icons-material/FileDownloadOutlined";import m from"@mui/icons-material/RefreshOutlined";import f from"@mui/icons-material/InventoryOutlined";import g from"@mui/icons-material/ExpandMoreOutlined";import v from"@mui/icons-material/ExpandLessOutlined";import"../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js";import{getNestedValue as N,reqOptions as P,API_HOST_URL as x}from"../../lib/helpFunction.js";import"../../lib/utils.js";import{l as y}from"../../../../_virtual/lodash.js";var w=l(function(l,w){var k=l.token,C=l.columns,S=l.defaultData,E=l.endpointPath,j=l.initialParams,R=void 0===j?{}:j,O=l.searchParams,M=l.dataAdapter,A=l.title,F=l.emptyStateMessage,H=void 0===F?"No data available":F,L=l.emptyStateIcon,_=void 0===L?i(f,{}):L,D=l.actions,I=l.showSearch,T=void 0===I||I,U=l.searchPlaceholder,B=void 0===U?"Search...":U,G=l.searchDebounceMs,J=void 0===G?1e3:G,V=l.enableSorting,W=void 0===V||V,q=l.enableExport,z=void 0!==q&&q,K=l.exportOptions,Q=void 0===K?{csv:!0}:K,X=l.rowsPerPageOptions,Y=void 0===X?[10,25,50,100]:X,Z=l.defaultRowsPerPage,$=void 0===Z?10:Z,ee=l.onRowClick,te=l.onFetchError,ne=l.expandable,re=void 0!==ne&&ne,ae=l.renderExpandedRow,ie=l.keyExtractor,oe=void 0===ie?function(e){return JSON.stringify(e)}:ie,ce=l.stickyHeader,le=void 0!==ce&&ce,se=l.maxHeight,ue=l.hideHeaderOnMobile,de=void 0!==ue&&ue,he=l.showRowNumbers,pe=void 0!==he&&he,be=l.rowNumberStartFrom,me=void 0===be?1:be,fe=s(!0),ge=s(null),ve=u(S||[]),Ne=e(ve,2),Pe=Ne[0],xe=Ne[1],ye=u(!0),we=e(ye,2),ke=we[0],Ce=we[1],Se=u(null),Ee=e(Se,2),je=Ee[0],Re=Ee[1],Oe=u({totalCount:0,currentPage:1,perPage:$,totalPages:0}),Me=e(Oe,2),Ae=Me[0],Fe=Me[1],He=u(t({page:1,limit:$},R)),Le=e(He,2),_e=Le[0],De=Le[1],Ie=u([]),Te=e(Ie,2),Ue=Te[0],Be=Te[1],Ge=u(R.search||""),Je=e(Ge,2),Ve=Je[0],We=Je[1],qe=d(y.exports.debounce(function(e){De(function(n){return t(t({},n),{},{search:e,page:1})})},J),[]),ze=(S||[]).length,Ke={data:S||[],pagination:{totalCount:ze,currentPage:1,perPage:10,totalPages:Math.ceil(ze/10)||1},links:{next:null,previous:null}},Qe=d(function(){var t=r(a().m(function t(n){var r,i,o,c,l,s,u;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(Ce(!0),t.p=1,E){t.n=2;break}return t.a(2,Ke);case 2:return r=new URLSearchParams({limit:n.limit.toString(),offset:((n.page-1)*n.limit).toString()}),n.search&&r.append("search",n.search),n.sort&&(i="desc"===n.direction?"-":"",r.append("ordering","".concat(i).concat(n.sort))),O&&Object.entries(O).forEach(function(t){var n=e(t,2),a=n[0],i=n[1];null!=i&&""!==i&&r.append(a,String(i))}),o=P("GET",null,k),c="".concat(x).concat(E,"?").concat(r.toString()),t.n=3,fetch(c,o);case 3:return l=t.v,t.n=4,l.json();case 4:return s=t.v,t.a(2,{data:s.results,pagination:{totalCount:s.count,currentPage:Math.floor(parseInt(new URLSearchParams(s.next).get("offset")||"0")/n.limit),perPage:n.limit,totalPages:Math.ceil(s.count/n.limit)},links:{next:s.next,previous:s.previous}});case 5:throw t.p=5,u=t.v,console.error("Error fetching program courses:",u),u;case 6:return t.p=6,Ce(!1),t.f(6);case 7:return t.a(2)}},t,null,[[1,5,6,7]])}));return function(e){return t.apply(this,arguments)}}(),[O]),Xe=d(function(e){var t=e.target.value;We(t),qe(t)},[qe]),Ye=d(function(e){De(function(n){return t(t({},n),{},{page:e})})},[]),Ze=d(function(e){De(function(n){return t(t({},n),{},{page:1,limit:e})})},[]),$e=d(function(e){if(W&&e.sortable&&"string"==typeof e.accessor){var n=e.accessor;De(function(e){return e.sort===n?t(t({},e),{},{direction:"asc"===e.direction?"desc":"asc"}):t(t({},e),{},{sort:n,direction:"asc"})})}},[W]),et=d(function(){De(function(e){return t({},e)})},[]);h(w,function(){return{refresh:et}},[et]);var tt=d(function(){var e=r(a().m(function e(r){var i,o,c,l,s,u,d,h,p,b,m;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(z){e.n=1;break}return e.a(2);case 1:return e.p=1,Ce(!0),i=t(t({},_e),{},{page:1,limit:1e3,export:r}),e.n=2,Qe(i);case 2:(o=e.v)&&(c=M?M(o).data:o.data,l=Q.fileName||"table-export","csv"===r&&(s=[].concat(n(pe?["#"]:[]),n(C.filter(function(e){return"string"==typeof e.accessor}).map(function(e){return e.header}))),u=c.map(function(e,t){return[].concat(n(pe?[String(t+me)]:[]),n(C.filter(function(e){return"string"==typeof e.accessor}).map(function(t){var n,r=t.accessor;return String(null!==(n=e[r])&&void 0!==n?n:"")}))).join(",")}),d=[s.join(",")].concat(n(u)).join("\n"),h=new Blob([d],{type:"text/csv;charset=utf-8;"}),p=document.createElement("a"),b=URL.createObjectURL(h),p.setAttribute("href",b),p.setAttribute("download","".concat(l,".csv")),p.style.visibility="hidden",document.body.appendChild(p),p.click(),document.body.removeChild(p))),e.n=4;break;case 3:e.p=3,m=e.v,console.error("Export error:",m),te&&te(m);case 4:return e.p=4,Ce(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),[C,_e,z,Q,M,te]),nt=d(function(e,t){t.stopPropagation(),Be(function(t){return t.includes(e)?t.filter(function(t){return t!==e}):[].concat(n(t),[e])})},[]);return p(function(){var e=!0,t=function(){var t=r(a().m(function t(){var n,r,i;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,Ce(!0),t.n=1,Qe(_e);case 1:n=t.v,e&&(M?(r=M(n),xe(r.data),r.pagination&&Fe(r.pagination)):n&&(xe(n.data),n.pagination&&Fe(n.pagination)),Re(null)),t.n=3;break;case 2:t.p=2,i=t.v,console.error("Error fetching data:",i),e&&(Re(i),te&&te(i));case 3:return t.p=3,e&&(Ce(!1),fe.current=!1),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])}));return function(){return t.apply(this,arguments)}}();return t(),function(){e=!1}},[_e,M,te]),p(function(){O&&!fe.current&&De(function(e){return t({},e)})},[O]),ke&&fe.current?o("div",{className:"ihub-data-list-container",children:[A&&i("h2",{children:A}),i("div",{className:"ihub-loading-state",children:i("p",{children:"Loading data..."})})]}):je&&!ke&&0===(Pe||[]).length?o("div",{className:"ihub-data-list-container",children:[A&&i("h2",{children:A}),o("div",{className:"ihub-error-state",children:[i("p",{children:"Error loading data. Please try again."}),i("button",{className:"ihub-important-btn",onClick:et,children:"Retry"})]})]}):o("div",{className:"ihub-data-list-container",ref:ge,children:[(A||D||T||z)&&o("div",{className:"ihub-data-list-header ihub-table-header ihub-p-0",children:[i("div",{children:A&&i("h2",{children:A})}),o("div",{className:"ihub-table-controls",children:[T&&i("div",{className:"ihub-table-search",children:o("div",{className:"ihub-search-input-wrapper",children:[i("input",{type:"text",placeholder:B,value:Ve,onChange:Xe,className:"ihub-search-input"}),ke&&i("div",{className:"ihub-search-loading-indicator",children:i("span",{className:"ihub-loading-dot"})})]})}),z&&o("div",{className:"ihub-export-buttons",children:[Q.csv&&o("button",{className:"ihub-export-button ihub-export-csv",onClick:function(){return tt("csv")},disabled:ke,children:[i(b,{}),"CSV"]}),Q.excel&&o("button",{className:"ihub-export-button ihub-export-excel",onClick:function(){return tt("excel")},disabled:ke,children:[i(b,{}),"Excel"]}),Q.pdf&&o("button",{className:"ihub-export-button ihub-export-pdf",onClick:function(){return tt("pdf")},disabled:ke,children:[i(b,{}),"PDF"]})]}),o("button",{className:"ihub-refresh-button",onClick:et,disabled:ke,children:[i(m,{}),"Refresh"]}),D&&i("div",{className:"ihub-data-controls ihub-mb-0",children:D})]})]}),ke&&!fe.current&&i("div",{className:"ihub-table-loading-overlay",children:i("div",{className:"ihub-loading-spinner"})}),o("div",{className:"ihub-scroll-container ".concat(le?"ihub-sticky-header":""),style:se?{maxHeight:se}:void 0,children:[o("table",{className:"ihub-table ihub-scroll-container",children:[i("thead",{className:de?"ihub-hide-on-mobile":"",children:o("tr",{children:[pe&&i("th",{style:{width:"60px",textAlign:"center"},children:"#"}),re&&ae&&i("th",{style:{width:"40px"}}),C.map(function(e,t){return i("th",{className:"".concat(e.sortable&&W?"ihub-sortable-column":""," ").concat(_e.sort===e.accessor?"ihub-sorted-".concat(_e.direction):""),style:e.width?{width:e.width}:void 0,onClick:function(){return e.sortable&&W?$e(e):void 0},children:o("div",{className:"ihub-column-header",children:[i("span",{children:e.header}),e.sortable&&W&&i("span",{className:"ihub-sort-icon",children:_e.sort===e.accessor&&"asc"===_e.direction?"▲":_e.sort===e.accessor&&"desc"===_e.direction?"▼":"⇅"})]})},t)})]})}),ke||0!==(Pe||[]).length?i("tbody",{children:Pe.map(function(e,t){var n=oe(e),r=Ue.includes(n);return o(c.Fragment,{children:[o("tr",{onClick:function(){return ee&&ee(e)},className:ee?"ihub-clickable-row":"",children:[pe&&i("td",{style:{textAlign:"center",fontWeight:"500"},children:(Ae.currentPage-1)*Ae.perPage+t+me}),re&&ae&&i("td",{onClick:function(e){return nt(n,e)},children:i(r?v:g,{})}),C.map(function(t,n){return i("td",{"data-label":de?t.header:void 0,children:t.tooltip&&"string"==typeof t.accessor?i("div",{className:"ihub-cell-tooltip","data-tooltip":String(N(e,t.accessor)),children:t.cell?t.cell(e):N(e,t.accessor)}):t.cell?t.cell(e):"function"==typeof t.accessor?t.accessor(e):N(e,t.accessor)},n)})]}),re&&ae&&r&&i("tr",{className:"ihub-expanded-row",children:i("td",{colSpan:(C||[]).length+1+(pe?1:0),children:i("div",{className:"ihub-row-details",children:ae(e)})})})]},n)})}):""]}),ke||0!==(Pe||[]).length?"":o("div",{className:"ihub-data-list-container",children:[D&&i("div",{className:"ihub-data-controls ihub-mb-0",children:D}),i("div",{className:"ihub-empty-state",children:o("div",{children:[_,i("p",{children:H})]})})]})]}),Ae&&Ae.totalPages>1&&o("div",{className:"ihub-table-pagination",children:[o("div",{className:"ihub-pagination-info",children:["Showing ",(Ae.currentPage-1)*Ae.perPage+1," to"," ",Math.min(Ae.currentPage*Ae.perPage,Ae.totalCount)," ","of ",Ae.totalCount," entries"]}),o("div",{className:"ihub-pagination-controls",children:[i("button",{className:"ihub-pagination-button",disabled:1===Ae.currentPage||ke,onClick:function(){return Ye(1)},children:"«"}),i("button",{className:"ihub-pagination-button",disabled:1===Ae.currentPage||ke,onClick:function(){return Ye(Ae.currentPage-1)},children:"‹"}),Array.from({length:Math.min(5,Ae.totalPages)},function(e,t){var n;return n=Ae.totalPages<=5||Ae.currentPage<=3?t+1:Ae.currentPage>=Ae.totalPages-2?Ae.totalPages-4+t:Ae.currentPage-2+t,i("button",{className:"ihub-pagination-button ".concat(Ae.currentPage===n?"ihub-active":""),onClick:function(){return Ye(Number(n))},disabled:ke,children:n},n)}),i("button",{className:"ihub-pagination-button",disabled:Ae.currentPage===Ae.totalPages||ke,onClick:function(){return Ye(Ae.currentPage+1)},children:"›"}),i("button",{className:"ihub-pagination-button",disabled:Ae.currentPage===Ae.totalPages||ke,onClick:function(){return Ye(Ae.totalPages)},children:"»"})]}),o("div",{className:"ihub-rows-per-page",children:[i("span",{children:"Rows per page:"}),i("select",{value:Ae.perPage,onChange:function(e){return Ze(Number(e.target.value))},className:"ihub-rows-select",disabled:ke,children:Y.map(function(e){return i("option",{value:e,children:e},e)})})]})]})]})});w.displayName="IHubTableServer";export{w as IHubTableServer,w as default};
1
+ import{slicedToArray as e,objectSpread2 as t,toConsumableArray as n,asyncToGenerator as r,regenerator as a}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i,jsxs as o}from"react/jsx-runtime";import c,{forwardRef as l,useRef as s,useState as u,useCallback as d,useImperativeHandle as h,useEffect as p}from"react";import b from"@mui/icons-material/FileDownloadOutlined";import m from"@mui/icons-material/RefreshOutlined";import f from"@mui/icons-material/InventoryOutlined";import g from"@mui/icons-material/ExpandMoreOutlined";import v from"@mui/icons-material/ExpandLessOutlined";import"../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js";import{getNestedValue as N,reqOptions as P,API_HOST_URL as x}from"../../lib/helpFunction.js";import"../../lib/utils.js";import{l as y}from"../../../../_virtual/lodash.js";var w=l(function(l,w){var k=l.token,C=l.columns,S=l.defaultData,E=l.endpointPath,j=l.initialParams,O=void 0===j?{}:j,R=l.searchParams,A=l.dataAdapter,M=l.title,F=l.emptyStateMessage,H=void 0===F?"No data available":F,L=l.emptyStateIcon,_=void 0===L?i(f,{}):L,D=l.actions,T=l.showSearch,I=void 0===T||T,U=l.searchPlaceholder,B=void 0===U?"Search...":U,G=l.searchDebounceMs,J=void 0===G?1e3:G,V=l.enableSorting,W=void 0===V||V,q=l.enableExport,z=void 0!==q&&q,K=l.exportOptions,Q=void 0===K?{csv:!0}:K,X=l.rowsPerPageOptions,Y=void 0===X?[10,25,50,100]:X,Z=l.defaultRowsPerPage,$=void 0===Z?10:Z,ee=l.onRowClick,te=l.onFetchError,ne=l.expandable,re=void 0!==ne&&ne,ae=l.renderExpandedRow,ie=l.keyExtractor,oe=void 0===ie?function(e){return JSON.stringify(e)}:ie,ce=l.stickyHeader,le=void 0!==ce&&ce,se=l.maxHeight,ue=l.hideHeaderOnMobile,de=void 0!==ue&&ue,he=l.showRowNumbers,pe=void 0!==he&&he,be=l.rowNumberStartFrom,me=void 0===be?1:be,fe=s(!0),ge=s(null),ve=u(S||[]),Ne=e(ve,2),Pe=Ne[0],xe=Ne[1],ye=u(!0),we=e(ye,2),ke=we[0],Ce=we[1],Se=u(null),Ee=e(Se,2),je=Ee[0],Oe=Ee[1],Re=u({totalCount:0,currentPage:1,perPage:$,totalPages:0}),Ae=e(Re,2),Me=Ae[0],Fe=Ae[1],He=u(t({page:1,limit:$},O)),Le=e(He,2),_e=Le[0],De=Le[1],Te=u([]),Ie=e(Te,2),Ue=Ie[0],Be=Ie[1],Ge=u(O.search||""),Je=e(Ge,2),Ve=Je[0],We=Je[1],qe=d(y.exports.debounce(function(e){De(function(n){return t(t({},n),{},{search:e,page:1})})},J),[]),ze=(S||[]).length,Ke={data:S||[],pagination:{totalCount:ze,currentPage:1,perPage:10,totalPages:Math.ceil(ze/10)||1},links:{next:null,previous:null}},Qe=d(function(){var t=r(a().m(function t(n){var r,i,o,c,l,s,u;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(Ce(!0),t.p=1,E){t.n=2;break}return t.a(2,Ke);case 2:return r=new URLSearchParams({limit:n.limit.toString(),offset:((n.page-1)*n.limit).toString()}),n.search&&r.append("search",n.search),n.sort&&(i="desc"===n.direction?"-":"",r.append("ordering","".concat(i).concat(n.sort))),R&&Object.entries(R).forEach(function(t){var n=e(t,2),a=n[0],i=n[1];null!=i&&""!==i&&r.append(a,String(i))}),o=P("GET",null,k),c="".concat(x).concat(E,"?").concat(r.toString()),t.n=3,fetch(c,o);case 3:return l=t.v,t.n=4,l.json();case 4:return s=t.v,t.a(2,{data:s.results,pagination:{totalCount:s.count,currentPage:n.page,perPage:n.limit,totalPages:Math.ceil(s.count/n.limit)},links:{next:s.next,previous:s.previous}});case 5:throw t.p=5,u=t.v,console.error("Error fetching program courses:",u),u;case 6:return t.p=6,Ce(!1),t.f(6);case 7:return t.a(2)}},t,null,[[1,5,6,7]])}));return function(e){return t.apply(this,arguments)}}(),[R]),Xe=d(function(e){var t=e.target.value;We(t),qe(t)},[qe]),Ye=d(function(e){De(function(n){return t(t({},n),{},{page:e})})},[]),Ze=d(function(e){De(function(n){return t(t({},n),{},{page:1,limit:e})})},[]),$e=d(function(e){if(W&&e.sortable&&"string"==typeof e.accessor){var n=e.accessor;De(function(e){return e.sort===n?t(t({},e),{},{direction:"asc"===e.direction?"desc":"asc"}):t(t({},e),{},{sort:n,direction:"asc"})})}},[W]),et=d(function(){De(function(e){return t({},e)})},[]);h(w,function(){return{refresh:et}},[et]);var tt=d(function(){var e=r(a().m(function e(r){var i,o,c,l,s,u,d,h,p,b,m;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(z){e.n=1;break}return e.a(2);case 1:return e.p=1,Ce(!0),i=t(t({},_e),{},{page:1,limit:1e3,export:r}),e.n=2,Qe(i);case 2:(o=e.v)&&(c=A?A(o).data:o.data,l=Q.fileName||"table-export","csv"===r&&(s=[].concat(n(pe?["#"]:[]),n(C.filter(function(e){return"string"==typeof e.accessor}).map(function(e){return e.header}))),u=c.map(function(e,t){return[].concat(n(pe?[String(t+me)]:[]),n(C.filter(function(e){return"string"==typeof e.accessor}).map(function(t){var n,r=t.accessor;return String(null!==(n=e[r])&&void 0!==n?n:"")}))).join(",")}),d=[s.join(",")].concat(n(u)).join("\n"),h=new Blob([d],{type:"text/csv;charset=utf-8;"}),p=document.createElement("a"),b=URL.createObjectURL(h),p.setAttribute("href",b),p.setAttribute("download","".concat(l,".csv")),p.style.visibility="hidden",document.body.appendChild(p),p.click(),document.body.removeChild(p))),e.n=4;break;case 3:e.p=3,m=e.v,console.error("Export error:",m),te&&te(m);case 4:return e.p=4,Ce(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),[C,_e,z,Q,A,te]),nt=d(function(e,t){t.stopPropagation(),Be(function(t){return t.includes(e)?t.filter(function(t){return t!==e}):[].concat(n(t),[e])})},[]);return p(function(){var e=!0,t=function(){var t=r(a().m(function t(){var n,r,i;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,Ce(!0),t.n=1,Qe(_e);case 1:n=t.v,e&&(A?(r=A(n),xe(r.data),r.pagination&&Fe(r.pagination)):n&&(xe(n.data),n.pagination&&Fe(n.pagination)),Oe(null)),t.n=3;break;case 2:t.p=2,i=t.v,console.error("Error fetching data:",i),e&&(Oe(i),te&&te(i));case 3:return t.p=3,e&&(Ce(!1),fe.current=!1),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])}));return function(){return t.apply(this,arguments)}}();return t(),function(){e=!1}},[_e,A,te]),p(function(){R&&!fe.current&&De(function(e){return t({},e)})},[R]),ke&&fe.current?o("div",{className:"ihub-data-list-container",children:[M&&i("h2",{children:M}),i("div",{className:"ihub-loading-state",children:i("p",{children:"Loading data..."})})]}):je&&!ke&&0===(Pe||[]).length?o("div",{className:"ihub-data-list-container",children:[M&&i("h2",{children:M}),o("div",{className:"ihub-error-state",children:[i("p",{children:"Error loading data. Please try again."}),i("button",{className:"ihub-important-btn",onClick:et,children:"Retry"})]})]}):o("div",{className:"ihub-data-list-container",ref:ge,children:[(M||D||I||z)&&o("div",{className:"ihub-data-list-header ihub-table-header ihub-p-0",children:[i("div",{children:M&&i("h2",{children:M})}),o("div",{className:"ihub-table-controls",children:[I&&i("div",{className:"ihub-table-search",children:o("div",{className:"ihub-search-input-wrapper",children:[i("input",{type:"text",placeholder:B,value:Ve,onChange:Xe,className:"ihub-search-input"}),ke&&i("div",{className:"ihub-search-loading-indicator",children:i("span",{className:"ihub-loading-dot"})})]})}),z&&o("div",{className:"ihub-export-buttons",children:[Q.csv&&o("button",{className:"ihub-export-button ihub-export-csv",onClick:function(){return tt("csv")},disabled:ke,children:[i(b,{}),"CSV"]}),Q.excel&&o("button",{className:"ihub-export-button ihub-export-excel",onClick:function(){return tt("excel")},disabled:ke,children:[i(b,{}),"Excel"]}),Q.pdf&&o("button",{className:"ihub-export-button ihub-export-pdf",onClick:function(){return tt("pdf")},disabled:ke,children:[i(b,{}),"PDF"]})]}),o("button",{className:"ihub-refresh-button",onClick:et,disabled:ke,children:[i(m,{}),"Refresh"]}),D&&i("div",{className:"ihub-data-controls ihub-mb-0",children:D})]})]}),ke&&!fe.current&&i("div",{className:"ihub-table-loading-overlay",children:i("div",{className:"ihub-loading-spinner"})}),o("div",{className:"ihub-scroll-container ".concat(le?"ihub-sticky-header":""),style:se?{maxHeight:se}:void 0,children:[o("table",{className:"ihub-table ihub-scroll-container",children:[i("thead",{className:de?"ihub-hide-on-mobile":"",children:o("tr",{children:[pe&&i("th",{style:{width:"60px",textAlign:"center"},children:"#"}),re&&ae&&i("th",{style:{width:"40px"}}),C.map(function(e,t){return i("th",{className:"".concat(e.sortable&&W?"ihub-sortable-column":""," ").concat(_e.sort===e.accessor?"ihub-sorted-".concat(_e.direction):""),style:e.width?{width:e.width}:void 0,onClick:function(){return e.sortable&&W?$e(e):void 0},children:o("div",{className:"ihub-column-header",children:[i("span",{children:e.header}),e.sortable&&W&&i("span",{className:"ihub-sort-icon",children:_e.sort===e.accessor&&"asc"===_e.direction?"▲":_e.sort===e.accessor&&"desc"===_e.direction?"▼":"⇅"})]})},t)})]})}),ke||0!==(Pe||[]).length?i("tbody",{children:Pe.map(function(e,t){var n=oe(e),r=Ue.includes(n);return o(c.Fragment,{children:[o("tr",{onClick:function(){return ee&&ee(e)},className:ee?"ihub-clickable-row":"",children:[pe&&i("td",{style:{textAlign:"center",fontWeight:"500"},children:(Me.currentPage-1)*Me.perPage+t+me}),re&&ae&&i("td",{onClick:function(e){return nt(n,e)},children:i(r?v:g,{})}),C.map(function(t,n){return i("td",{"data-label":de?t.header:void 0,children:t.tooltip&&"string"==typeof t.accessor?i("div",{className:"ihub-cell-tooltip","data-tooltip":String(N(e,t.accessor)),children:t.cell?t.cell(e):N(e,t.accessor)}):t.cell?t.cell(e):"function"==typeof t.accessor?t.accessor(e):N(e,t.accessor)},n)})]}),re&&ae&&r&&i("tr",{className:"ihub-expanded-row",children:i("td",{colSpan:(C||[]).length+1+(pe?1:0),children:i("div",{className:"ihub-row-details",children:ae(e)})})})]},n)})}):""]}),ke||0!==(Pe||[]).length?"":o("div",{className:"ihub-data-list-container",children:[D&&i("div",{className:"ihub-data-controls ihub-mb-0",children:D}),i("div",{className:"ihub-empty-state",children:o("div",{children:[_,i("p",{children:H})]})})]})]}),Me&&Me.totalPages>1&&o("div",{className:"ihub-table-pagination",children:[o("div",{className:"ihub-pagination-info",children:["Showing ",(Me.currentPage-1)*Me.perPage+1," to"," ",Math.min(Me.currentPage*Me.perPage,Me.totalCount)," ","of ",Me.totalCount," entries"]}),o("div",{className:"ihub-pagination-controls",children:[i("button",{className:"ihub-pagination-button",disabled:1===Me.currentPage||ke,onClick:function(){return Ye(1)},children:"«"}),i("button",{className:"ihub-pagination-button",disabled:1===Me.currentPage||ke,onClick:function(){return Ye(Me.currentPage-1)},children:"‹"}),Array.from({length:Math.min(5,Me.totalPages)},function(e,t){var n;return n=Me.totalPages<=5||Me.currentPage<=3?t+1:Me.currentPage>=Me.totalPages-2?Me.totalPages-4+t:Me.currentPage-2+t,i("button",{className:"ihub-pagination-button ".concat(Me.currentPage===n?"ihub-active":""),onClick:function(){return Ye(Number(n))},disabled:ke,children:n},n)}),i("button",{className:"ihub-pagination-button",disabled:Me.currentPage===Me.totalPages||ke,onClick:function(){return Ye(Me.currentPage+1)},children:"›"}),i("button",{className:"ihub-pagination-button",disabled:Me.currentPage===Me.totalPages||ke,onClick:function(){return Ye(Me.totalPages)},children:"»"})]}),o("div",{className:"ihub-rows-per-page",children:[i("span",{children:"Rows per page:"}),i("select",{value:Me.perPage,onChange:function(e){return Ze(Number(e.target.value))},className:"ihub-rows-select",disabled:ke,children:Y.map(function(e){return i("option",{value:e,children:e},e)})})]})]})]})});w.displayName="IHubTableServer";export{w as IHubTableServer,w as default};
2
2
  //# sourceMappingURL=IHubTableServer.js.map