UNPKG

@transkripid/flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS - Transkrip.id fork

3 lines (2 loc) 1.93 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),m=require("react-icons/hi"),o=require("tailwind-merge"),q=require("../../helpers/merge-deep.js"),w=require("../../theme-store/index.js"),l=require("./PaginationButton.js"),f=require("./helpers.js"),g=({className:p,currentPage:a,layout:c="pagination",nextLabel:x="Next",onPageChange:r,previousLabel:u="Previous",renderPaginationButton:j=e=>s.jsx(l.PaginationButton,{...e}),showIcons:n=!1,theme:b={},totalPages:t,...N})=>{const e=q.mergeDeep(w.getTheme().pagination,b),d=Math.min(Math.max(c==="pagination"?a+2:a+4,5),t),h=Math.max(1,d-4),v=()=>{r(Math.min(a+1,t))},M=()=>{r(Math.max(a-1,1))};return s.jsxs("nav",{className:o.twMerge(e.base,p),...N,children:[c==="table"&&s.jsxs("div",{className:e.layout.table.base,children:["Showing ",s.jsx("span",{className:e.layout.table.span,children:h})," to ",s.jsx("span",{className:e.layout.table.span,children:d})," of ",s.jsx("span",{className:e.layout.table.span,children:t})," Entries"]}),s.jsxs("ul",{className:e.pages.base,children:[s.jsx("li",{children:s.jsxs(l.PaginationNavigation,{className:o.twMerge(e.pages.previous.base,n&&e.pages.showIcon),onClick:M,disabled:a===1,children:[n&&s.jsx(m.HiChevronLeft,{"aria-hidden":!0,className:e.pages.previous.icon}),u]})}),c==="pagination"&&f.range(h,d).map(i=>s.jsx("li",{"aria-current":i===a?"page":void 0,children:j({className:o.twMerge(e.pages.selector.base,a===i&&e.pages.selector.active),active:i===a,onClick:()=>r(i),children:i})},i)),s.jsx("li",{children:s.jsxs(l.PaginationNavigation,{className:o.twMerge(e.pages.next.base,n&&e.pages.showIcon),onClick:v,disabled:a===t,children:[x,n&&s.jsx(m.HiChevronRight,{"aria-hidden":!0,className:e.pages.next.icon})]})})]})]})};g.displayName="Pagination";const y=Object.assign(g,{Button:l.PaginationButton});exports.Pagination=y; //# sourceMappingURL=Pagination.js.map