2 lines
3.9 KiB
JavaScript
2 lines
3.9 KiB
JavaScript
import{j as e}from"./chunk-UIGDSWPH-BhuNDbxn.js";const m=()=>e.jsx("svg",{className:"fill-current",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.58203 9.99868C2.58174 10.1909 2.6549 10.3833 2.80152 10.53L7.79818 15.5301C8.09097 15.8231 8.56584 15.8233 8.85883 15.5305C9.15183 15.2377 9.152 14.7629 8.85921 14.4699L5.13911 10.7472L16.6665 10.7472C17.0807 10.7472 17.4165 10.4114 17.4165 9.99715C17.4165 9.58294 17.0807 9.24715 16.6665 9.24715L5.14456 9.24715L8.85919 5.53016C9.15199 5.23717 9.15184 4.7623 8.85885 4.4695C8.56587 4.1767 8.09099 4.17685 7.79819 4.46984L2.84069 9.43049C2.68224 9.568 2.58203 9.77087 2.58203 9.99715C2.58203 9.99766 2.58203 9.99817 2.58203 9.99868Z",fill:""})}),p=()=>e.jsx("svg",{className:"fill-current",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4165 9.9986C17.4168 10.1909 17.3437 10.3832 17.197 10.53L12.2004 15.5301C11.9076 15.8231 11.4327 15.8233 11.1397 15.5305C10.8467 15.2377 10.8465 14.7629 11.1393 14.4699L14.8594 10.7472L3.33203 10.7472C2.91782 10.7472 2.58203 10.4114 2.58203 9.99715C2.58203 9.58294 2.91782 9.24715 3.33203 9.24715L14.854 9.24715L11.1393 5.53016C10.8465 5.23717 10.8467 4.7623 11.1397 4.4695C11.4327 4.1767 11.9075 4.17685 12.2003 4.46984L17.1578 9.43049C17.3163 9.568 17.4165 9.77087 17.4165 9.99715C17.4165 9.99763 17.4165 9.99812 17.4165 9.9986Z",fill:""})}),w=({currentPage:n,totalPages:l,onPageChange:d,variant:i="text",className:u="",showPageInfo:a=!0})=>{const f=(()=>{const t=[];if(l<=7)for(let s=1;s<=l;s++)t.push(s);else if(n<=3){for(let s=1;s<=5;s++)t.push(s);t.push("..."),t.push(l)}else if(n>=l-2){t.push(1),t.push("...");for(let s=l-4;s<=l;s++)t.push(s)}else{t.push(1),t.push("...");for(let s=n-1;s<=n+1;s++)t.push(s);t.push("..."),t.push(l)}return t})(),x=n===1,r=n===l,c="rounded-lg border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-700 shadow-theme-xs hover:bg-gray-50 hover:text-gray-800 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03] dark:hover:text-gray-200 sm:px-3.5 sm:py-2.5 disabled:opacity-50 disabled:cursor-not-allowed",h=i==="icon"?`${c} flex items-center gap-2 p-2 sm:p-2.5`:`${c} flex items-center gap-2`,b=h;return e.jsxs("div",{className:`flex items-center justify-between gap-2 px-6 py-4 sm:justify-normal ${u}`,children:[e.jsxs("button",{className:h,onClick:()=>!x&&d(n-1),disabled:x,type:"button",children:[(i==="text"||i==="text-icon")&&e.jsx("span",{className:"inline sm:hidden",children:e.jsx(m,{})}),(i==="text-icon"||i==="icon")&&e.jsx(m,{}),(i==="text"||i==="text-icon")&&e.jsx("span",{className:"hidden sm:inline",children:i==="text-icon"?" Previous ":"Previous"})]}),a&&e.jsxs("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-400 sm:hidden",children:["Page ",n," of ",l]}),e.jsx("ul",{className:"hidden items-center gap-0.5 sm:flex",children:f.map((t,s)=>{if(t==="...")return e.jsx("li",{children:e.jsx("span",{className:"flex items-center justify-center w-10 h-10 text-sm font-medium text-gray-700 dark:text-gray-400",children:"..."})},`ellipsis-${s}`);const o=t,j=o===n;return e.jsx("li",{children:e.jsx("button",{className:`flex items-center justify-center w-10 h-10 text-sm font-medium rounded-lg ${j?"text-white bg-brand-500 hover:bg-brand-600":"text-gray-700 hover:bg-brand-500 hover:text-white dark:text-gray-400 dark:hover:text-white"}`,onClick:()=>d(o),type:"button",children:o})},o)})}),e.jsxs("button",{className:b,onClick:()=>!r&&d(n+1),disabled:r,type:"button",children:[(i==="text"||i==="text-icon")&&e.jsx("span",{className:"hidden sm:inline",children:i==="text-icon"?" Next ":"Next"}),(i==="text-icon"||i==="icon")&&e.jsx(p,{}),(i==="text"||i==="text-icon")&&e.jsx("span",{className:"inline sm:hidden",children:e.jsx(p,{})})]})]})};export{w as P};
|