@instincthub/react-ui 0.0.8 → 0.1.0

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.
@@ -1792,7 +1792,6 @@
1792
1792
  height: 20px;
1793
1793
  padding: 5px;
1794
1794
  margin: 0;
1795
- font-size: 1.2rem;
1796
1795
  pointer-events: initial;
1797
1796
  left: 5px;
1798
1797
  top: 15px;
@@ -242,7 +242,6 @@ li {
242
242
  @media (min-width: 1024px) {
243
243
  p,
244
244
  div,
245
- span,
246
245
  i,
247
246
  li {
248
247
  font-size: 1.1rem;
@@ -1,2 +1,2 @@
1
- import{slicedToArray as a,asyncToGenerator as n,regeneratorRuntime as i}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useState as o,useEffect as r}from"react";import l from"next/link";import{reqOptions as c,fetchAPI as s}from"../../lib/helpFunction.js";import"../../lib/utils.js";import{useSearchParams as u}from"next/navigation";var h=function(a){if(!a)return null;try{return new URL(a).searchParams.get("offset")}catch(a){return null}},d=function(d){var p=d.data,g=d.limit,f=d.urlPath,m=d.setData,b=d.token,v=void 0===b?null:b,w=d.tabsValues,x=void 0===w?"":w,N=d.searchValues,L=void 0===N?"":N,k=d.rangeLimit,y=void 0===k?5:k,P=d.className,G=void 0===P?"":P,I=d.showFirstLast,M=void 0===I||I,R=u(),j=R.get("offset")||"0",C=R.get("search")||"",S=o([]),U=a(S,2),B=U[0],F=U[1],T=o(0),A=a(T,2),V=A[0],Z=A[1],_=o(y||5),D=a(_,2),E=D[0],H=D[1],O=o(!1),q=a(O,2),z=q[0],J=q[1],K=Number(j),Q=Math.floor(K/g),W=h((null==p?void 0:p.next)||""),X=h((null==p?void 0:p.previous)||""),Y=function(){var a=n(i().mark((function a(n){var t,e,o,r,l;return i().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return J(!0),a.prev=1,t=c("GET",null,v),e=void 0!==n?"&offset=".concat(n):"",o=L||C?"&search=".concat(encodeURIComponent(L||C)):"",r=x?"&cat=".concat(encodeURIComponent(x)):"",l="".concat(f,"?limit=").concat(g).concat(e).concat(o).concat(r),console.log("searchOffset: ",n,l),a.next=10,s(m,l,t,!0);case 10:a.next=15;break;case 12:a.prev=12,a.t0=a.catch(1),console.error("Pagination fetch error:",a.t0);case 15:return a.prev=15,$(),J(!1),a.finish(15);case 19:case"end":return a.stop()}}),a,null,[[1,12,15,19]])})));return function(n){return a.apply(this,arguments)}}(),$=function(){console.log("updatePageRange called with currentPageIndex:",Q,y),Q+1>=y?(Z(Q-2),H(Q+3)):(Z(0),H(y))};if(r((function(){if(K>0||x||L||C?Y(K):Y(),null!=p&&p.count){var a=Math.ceil(p.count/g);F(Array.from({length:a},(function(a,n){return n})))}}),[j,null==p?void 0:p.count,x,g]),r((function(){if("undefined"!=typeof window){var a=new URLSearchParams(window.location.search);a.set("offset","0"),window.history.replaceState({},"","".concat(window.location.pathname,"?").concat(a.toString()))}}),[L,C]),!B.length&&!z)return null;var aa=B.length,na=0===Q,ia=Q===aa-1,ta=B.slice(V,E);return t("div",{className:"ihub-pagination-container ".concat(G),role:"navigation","aria-label":"Pagination",children:[z&&t("div",{className:"ihub-pagination-loading",children:[e("div",{className:"ihub-loading-spinner"}),e("span",{children:"Loading..."})]}),t("ul",{className:"ihub-pagination-list",children:[t("div",{className:"ihub-pagination-nav-group",children:[M&&e("li",{className:"ihub-pagination-item ".concat(na?"ihub-pagination-disabled":""),children:e(l,{href:"?offset=0",className:"ihub-pagination-link ihub-pagination-first","aria-label":"Go to first page",tabIndex:na?-1:0,children:"First"})}),e("li",{className:"ihub-pagination-item ".concat(na||null==p||!p.previous?"ihub-pagination-disabled":""),children:e(l,{href:"?offset=".concat(X||0),className:"ihub-pagination-link ihub-pagination-previous","aria-label":"Go to previous page",tabIndex:na||null==p||!p.previous?-1:0,children:e("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M7.66927 1.83333L3.08594 6.41667L7.66927 11L6.7526 12.8333L0.335938 6.41667L6.7526 0L7.66927 1.83333Z",fill:"currentColor"})})})})]}),e("div",{className:"ihub-pagination-pages",children:ta.map((function(a){var n=Q===a,i=a+1;return e("li",{className:"ihub-pagination-item ".concat(n?"ihub-pagination-active":""),"data-page":i,children:e(l,{href:"?offset=".concat(a*g),className:"ihub-pagination-link ihub-pagination-number","aria-label":"Go to page ".concat(i),"aria-current":n?"page":void 0,children:i})},a)}))}),t("div",{className:"ihub-pagination-nav-group ".concat(null!=p&&p.next?"":"ihub-pagination-disabled"),children:[e("li",{className:"ihub-pagination-item ".concat(ia||null==p||!p.next?"ihub-pagination-disabled":""),children:e(l,{href:"?offset=".concat(W||K),className:"ihub-pagination-link ihub-pagination-next","aria-label":"Go to next page",tabIndex:ia||null==p||!p.next?-1:0,children:e("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M0.330731 1.83333L4.91406 6.41667L0.330731 11L1.2474 12.8333L7.66406 6.41667L1.2474 0L0.330731 1.83333Z",fill:"currentColor"})})})}),M&&e("li",{className:"ihub-pagination-item ".concat(ia?"ihub-pagination-disabled":""),children:e(l,{href:"?offset=".concat((aa-1)*g),className:"ihub-pagination-link ihub-pagination-last","aria-label":"Go to last page",tabIndex:ia?-1:0,children:"Last"})})]})]}),e("div",{className:"ihub-pagination-info",children:t("span",{className:"ihub-pagination-summary",children:["Showing ",Math.min(K+1,(null==p?void 0:p.count)||0)," to"," ",Math.min(K+g,(null==p?void 0:p.count)||0)," of"," ",(null==p?void 0:p.count)||0," results"]})})]})};export{d as default};
1
+ import{slicedToArray as a,asyncToGenerator as n,regeneratorRuntime as i}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as l}from"react";import c from"next/link";import{reqOptions as s,fetchAPI as u}from"../../lib/helpFunction.js";import"../../lib/utils.js";import{useSearchParams as h}from"next/navigation";var d=function(a){if(!a)return null;try{return new URL(a).searchParams.get("offset")}catch(a){return null}},p=function(p){var g=p.data,f=p.limit,m=p.urlPath,b=p.setData,v=p.token,w=void 0===v?null:v,x=p.tabsValues,N=void 0===x?"":x,L=p.searchValues,k=void 0===L?"":L,y=p.rangeLimit,P=void 0===y?5:y,G=p.className,I=void 0===G?"":G,M=p.showFirstLast,R=void 0===M||M,j=h(),C=j.get("offset")||"0",S=j.get("search")||"",U=o([]),B=a(U,2),F=B[0],T=B[1],A=o(0),V=a(A,2),Z=V[0],_=V[1],D=o(P||5),E=a(D,2),H=E[0],q=E[1],z=o(!1),J=a(z,2),K=J[0],O=J[1],Q=r(!0),W=Number(C),X=Math.floor(W/f),Y=d((null==g?void 0:g.next)||""),$=d((null==g?void 0:g.previous)||""),aa=function(){var a=n(i().mark((function a(n){var t,e,o,r,l;return i().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return O(!0),a.prev=1,t=s("GET",null,w),e=void 0!==n?"&offset=".concat(n):"",o=k||S?"&search=".concat(encodeURIComponent(k||S)):"",r=N?"&cat=".concat(encodeURIComponent(N)):"",l="".concat(m,"?limit=").concat(f).concat(e).concat(o).concat(r),a.next=9,u(b,l,t,!0);case 9:a.next=14;break;case 11:a.prev=11,a.t0=a.catch(1),console.error("Pagination fetch error:",a.t0);case 14:return a.prev=14,na(),O(!1),a.finish(14);case 18:case"end":return a.stop()}}),a,null,[[1,11,14,18]])})));return function(n){return a.apply(this,arguments)}}(),na=function(){console.log("updatePageRange called with currentPageIndex:",X,P),X+1>=P?(_(X-2),q(X+3)):(_(0),q(P))};if(l((function(){if(W>0||N||k||S?aa(W):aa(),null!=g&&g.count){var a=Math.ceil(g.count/f);T(Array.from({length:a},(function(a,n){return n})))}}),[C,null==g?void 0:g.count,N,f]),l((function(){if(Q.current)Q.current=!1;else if("undefined"!=typeof window){var a=new URLSearchParams(window.location.search);a.set("offset","0"),window.history.replaceState({},"","".concat(window.location.pathname,"?").concat(a.toString()))}}),[k,S]),!F.length&&!K)return null;var ia=F.length,ta=0===X,ea=X===ia-1,oa=F.slice(Z,H);return t("div",{className:"ihub-pagination-container ".concat(I),role:"navigation","aria-label":"Pagination",children:[K&&t("div",{className:"ihub-pagination-loading",children:[e("div",{className:"ihub-loading-spinner"}),e("span",{children:"Loading..."})]}),t("ul",{className:"ihub-pagination-list",children:[t("div",{className:"ihub-pagination-nav-group",children:[R&&e("li",{className:"ihub-pagination-item ".concat(ta?"ihub-pagination-disabled":""),children:e(c,{href:"?offset=0",className:"ihub-pagination-link ihub-pagination-first","aria-label":"Go to first page",tabIndex:ta?-1:0,children:"First"})}),e("li",{className:"ihub-pagination-item ".concat(ta||null==g||!g.previous?"ihub-pagination-disabled":""),children:e(c,{href:"?offset=".concat($||0),className:"ihub-pagination-link ihub-pagination-previous","aria-label":"Go to previous page",tabIndex:ta||null==g||!g.previous?-1:0,children:e("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M7.66927 1.83333L3.08594 6.41667L7.66927 11L6.7526 12.8333L0.335938 6.41667L6.7526 0L7.66927 1.83333Z",fill:"currentColor"})})})})]}),e("div",{className:"ihub-pagination-pages",children:oa.map((function(a){var n=X===a,i=a+1;return e("li",{className:"ihub-pagination-item ".concat(n?"ihub-pagination-active":""),"data-page":i,children:e(c,{href:"?offset=".concat(a*f),className:"ihub-pagination-link ihub-pagination-number","aria-label":"Go to page ".concat(i),"aria-current":n?"page":void 0,children:i})},a)}))}),t("div",{className:"ihub-pagination-nav-group ".concat(null!=g&&g.next?"":"ihub-pagination-disabled"),children:[e("li",{className:"ihub-pagination-item ".concat(ea||null==g||!g.next?"ihub-pagination-disabled":""),children:e(c,{href:"?offset=".concat(Y||W),className:"ihub-pagination-link ihub-pagination-next","aria-label":"Go to next page",tabIndex:ea||null==g||!g.next?-1:0,children:e("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M0.330731 1.83333L4.91406 6.41667L0.330731 11L1.2474 12.8333L7.66406 6.41667L1.2474 0L0.330731 1.83333Z",fill:"currentColor"})})})}),R&&e("li",{className:"ihub-pagination-item ".concat(ea?"ihub-pagination-disabled":""),children:e(c,{href:"?offset=".concat((ia-1)*f),className:"ihub-pagination-link ihub-pagination-last","aria-label":"Go to last page",tabIndex:ea?-1:0,children:"Last"})})]})]}),e("div",{className:"ihub-pagination-info",children:t("span",{className:"ihub-pagination-summary",children:["Showing ",Math.min(W+1,(null==g?void 0:g.count)||0)," to"," ",Math.min(W+f,(null==g?void 0:g.count)||0)," of"," ",(null==g?void 0:g.count)||0," results"]})})]})};export{p as default};
2
2
  //# sourceMappingURL=Pagination.js.map
@@ -88,8 +88,8 @@ export type SearchParamsType = {
88
88
  [key: string]: string;
89
89
  };
90
90
  export interface SearchParamsPageProps {
91
- params: SearchParamsType;
92
- searchParams: SearchParamsType;
91
+ params: Promise<SearchParamsType>;
92
+ searchParams: Promise<SearchParamsType>;
93
93
  }
94
94
  /**
95
95
  * Response interface for S3 uploads