Files
klz-cables.com/.pnpm-store/v10/files/96/7b6f0856bfece653f2ebd57791ddfaf3c0b7c8e17679b8ec60d554b3d8bf257055ec623315b1803478fe3021a178b2c934705b2e28681c99ca1652c39d16eb
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
6.2 KiB
Plaintext

{"version":3,"file":"index.js","names":["React","ClickableArrow","Page","Separator","nodeTypes","baseClass","Pagination","props","hasNextPage","hasPrevPage","nextPage","numberOfNeighbors","onChange","page","currentPage","prevPage","totalPages","updatePage","pages","Array","from","length","_","index","rangeStartIndex","rangeEndIndex","nodes","slice","unshift","type","isFirstPage","push","isLastPage","direction","isDisabled","Math","max","_jsx","className","map","node","i","isCurrent","NodeType"],"sources":["../../../src/elements/Pagination/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { ClickableArrow } from './ClickableArrow/index.js'\nimport './index.scss'\nimport { Page } from './Page/index.js'\nimport { Separator } from './Separator/index.js'\n\nconst nodeTypes = {\n ClickableArrow,\n Page,\n Separator,\n}\n\nconst baseClass = 'paginator'\n\nexport type PaginationProps = {\n hasNextPage?: boolean\n hasPrevPage?: boolean\n limit?: number\n nextPage?: number\n numberOfNeighbors?: number\n onChange?: (page: number) => void\n page?: number\n prevPage?: number\n totalPages?: number\n}\n\nexport type Node =\n | {\n props?: {\n direction?: 'left' | 'right'\n isDisabled?: boolean\n isFirstPage?: boolean\n isLastPage?: boolean\n page?: number\n updatePage: (page?: number) => void\n }\n type: 'ClickableArrow' | 'Page' | 'Separator'\n }\n | number\n\nexport const Pagination: React.FC<PaginationProps> = (props) => {\n const {\n hasNextPage = false,\n hasPrevPage = false,\n nextPage = null,\n numberOfNeighbors = 1,\n onChange,\n page: currentPage,\n prevPage = null,\n totalPages = null,\n } = props\n\n if (!hasPrevPage && !hasNextPage) {\n return null\n }\n\n const updatePage = (page) => {\n if (typeof onChange === 'function') {\n onChange(page)\n }\n }\n\n // Create array of integers for each page\n const pages = Array.from({ length: totalPages }, (_, index) => index + 1)\n\n // Assign indices for start and end of the range of pages that should be shown in paginator\n let rangeStartIndex = currentPage - 1 - numberOfNeighbors\n\n // Sanitize rangeStartIndex in case it is less than zero for safe split\n if (rangeStartIndex <= 0) {\n rangeStartIndex = 0\n }\n\n const rangeEndIndex = currentPage - 1 + numberOfNeighbors + 1\n\n // Slice out the range of pages that we want to render\n const nodes: Node[] = pages.slice(rangeStartIndex, rangeEndIndex)\n\n // Add prev separator if necessary\n if (currentPage - numberOfNeighbors - 1 >= 2) {\n nodes.unshift({ type: 'Separator' })\n }\n\n // Add first page if necessary\n if (currentPage > numberOfNeighbors + 1) {\n nodes.unshift({\n type: 'Page',\n props: {\n isFirstPage: true,\n page: 1,\n updatePage,\n },\n })\n }\n\n // Add next separator if necessary\n if (currentPage + numberOfNeighbors + 1 < totalPages) {\n nodes.push({ type: 'Separator' })\n }\n\n // Add last page if necessary\n if (rangeEndIndex < totalPages) {\n nodes.push({\n type: 'Page',\n props: {\n isLastPage: true,\n page: totalPages,\n updatePage,\n },\n })\n }\n\n // Add prev and next arrows based on necessity\n nodes.unshift({\n type: 'ClickableArrow',\n props: {\n direction: 'right',\n isDisabled: !hasNextPage,\n updatePage: () => updatePage(nextPage ?? currentPage + 1),\n },\n })\n\n nodes.unshift({\n type: 'ClickableArrow',\n props: {\n direction: 'left',\n isDisabled: !hasPrevPage,\n updatePage: () => updatePage(prevPage ?? Math.max(1, currentPage - 1)),\n },\n })\n\n return (\n <div className={baseClass}>\n {nodes.map((node, i) => {\n if (typeof node === 'number') {\n return (\n <Page isCurrent={currentPage === node} key={i} page={node} updatePage={updatePage} />\n )\n }\n\n const NodeType = nodeTypes[node.type]\n\n return <NodeType key={i} {...node.props} />\n })}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,OAAO;AACP,SAASC,IAAI,QAAQ;AACrB,SAASC,SAAS,QAAQ;AAE1B,MAAMC,SAAA,GAAY;EAChBH,cAAA;EACAC,IAAA;EACAC;AACF;AAEA,MAAME,SAAA,GAAY;AA4BlB,OAAO,MAAMC,UAAA,GAAyCC,KAAA;EACpD,MAAM;IACJC,WAAA,GAAc,KAAK;IACnBC,WAAA,GAAc,KAAK;IACnBC,QAAA,GAAW,IAAI;IACfC,iBAAA,GAAoB,CAAC;IACrBC,QAAQ;IACRC,IAAA,EAAMC,WAAW;IACjBC,QAAA,GAAW,IAAI;IACfC,UAAA,GAAa;EAAI,CAClB,GAAGT,KAAA;EAEJ,IAAI,CAACE,WAAA,IAAe,CAACD,WAAA,EAAa;IAChC,OAAO;EACT;EAEA,MAAMS,UAAA,GAAcJ,IAAA;IAClB,IAAI,OAAOD,QAAA,KAAa,YAAY;MAClCA,QAAA,CAASC,IAAA;IACX;EACF;EAEA;EACA,MAAMK,KAAA,GAAQC,KAAA,CAAMC,IAAI,CAAC;IAAEC,MAAA,EAAQL;EAAW,GAAG,CAACM,CAAA,EAAGC,KAAA,KAAUA,KAAA,GAAQ;EAEvE;EACA,IAAIC,eAAA,GAAkBV,WAAA,GAAc,IAAIH,iBAAA;EAExC;EACA,IAAIa,eAAA,IAAmB,GAAG;IACxBA,eAAA,GAAkB;EACpB;EAEA,MAAMC,aAAA,GAAgBX,WAAA,GAAc,IAAIH,iBAAA,GAAoB;EAE5D;EACA,MAAMe,KAAA,GAAgBR,KAAA,CAAMS,KAAK,CAACH,eAAA,EAAiBC,aAAA;EAEnD;EACA,IAAIX,WAAA,GAAcH,iBAAA,GAAoB,KAAK,GAAG;IAC5Ce,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