@atom-learning/components 2.66.8 → 2.66.9

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.
package/CHANGELOG.md CHANGED
@@ -1,13 +1,9 @@
1
- ## [2.66.8](https://github.com/Atom-Learning/components/compare/v2.66.7...v2.66.8) (2023-08-31)
1
+ ## [2.66.9](https://github.com/Atom-Learning/components/compare/v2.66.8...v2.66.9) (2023-09-01)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * initial work on improving pagination logic ([db84f1a](https://github.com/Atom-Learning/components/commit/db84f1a22d299808a805141b17aafb863a2fedd0))
7
- * more improvements, fix for rendering glitch ([5ece055](https://github.com/Atom-Learning/components/commit/5ece055b57b23132a56dac59a909ef1796a6e463))
8
- * revert no arrows change ([a7922cf](https://github.com/Atom-Learning/components/commit/a7922cf4e6d080040267c9c2abca60eeaca0a39d))
9
- * tests ([7dcb4c0](https://github.com/Atom-Learning/components/commit/7dcb4c0524d542aa5e6aec80ef32e0b55bffcf45))
10
- * types, paginationItems with more visible items ([57b3dc9](https://github.com/Atom-Learning/components/commit/57b3dc954c031f074f2f885af86d3f6f619fa4fc))
6
+ * truncation issue with higher pagesCount relative to visibleElementsCount ([7623ea6](https://github.com/Atom-Learning/components/commit/7623ea63ce69337a352ad072fdf8a46ded08936e))
11
7
 
12
8
  # [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
13
9
 
@@ -1,2 +1,2 @@
1
- import*as e from"react";import{Flex as l}from"../flex/Flex.js";import{TRUNCATED_THRESHOLD as p}from"./pagination.constants.js";import{PaginationItem as t}from"./PaginationItem.js";import{PaginationPopover as i}from"./PaginationPopover.js";import{usePagination as g}from"./usePagination.js";const u=()=>{const{pagesCount:n,paginationItems:a,paginationAlignment:r}=g(),m=n>p;return e.createElement(l,{gap:1},m&&r==="start"&&e.createElement(e.Fragment,null,e.createElement(t,{pageNumber:1}),e.createElement(i,null)),a==null?void 0:a.map(o=>e.createElement(t,{key:o,pageNumber:o})),m&&r==="end"&&e.createElement(e.Fragment,null,e.createElement(i,null),e.createElement(t,{pageNumber:n})))};export{u as PaginationPages};
1
+ import*as e from"react";import{Flex as i}from"../flex/Flex.js";import{PaginationItem as n}from"./PaginationItem.js";import{PaginationPopover as l}from"./PaginationPopover.js";import{usePagination as p}from"./usePagination.js";const g=()=>{const{pagesCount:a,paginationItems:t,paginationAlignment:m}=p(),r=a>t.length;return e.createElement(i,{gap:1},r&&m==="start"&&e.createElement(e.Fragment,null,e.createElement(n,{pageNumber:1}),e.createElement(l,null)),t==null?void 0:t.map(o=>e.createElement(n,{key:o,pageNumber:o})),r&&m==="end"&&e.createElement(e.Fragment,null,e.createElement(l,null),e.createElement(n,{pageNumber:a})))};export{g as PaginationPages};
2
2
  //# sourceMappingURL=PaginationPages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaginationPages.js","sources":["../../../src/components/pagination/PaginationPages.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Flex } from '../flex'\nimport { TRUNCATED_THRESHOLD } from './pagination.constants'\nimport { PaginationItem } from './PaginationItem'\nimport { PaginationPopover } from './PaginationPopover'\nimport { usePagination } from './usePagination'\n\nexport const PaginationPages = () => {\n const { pagesCount, paginationItems, paginationAlignment } = usePagination()\n\n const isTruncated = pagesCount > TRUNCATED_THRESHOLD\n\n return (\n <Flex gap={1}>\n {isTruncated && paginationAlignment === 'start' && (\n <>\n <PaginationItem pageNumber={1} />\n <PaginationPopover />\n </>\n )}\n {paginationItems?.map((pageNumber) => (\n <PaginationItem key={pageNumber} pageNumber={pageNumber} />\n ))}\n {isTruncated && paginationAlignment === 'end' && (\n <>\n <PaginationPopover />\n <PaginationItem pageNumber={pagesCount} />\n </>\n )}\n </Flex>\n )\n}\n"],"names":["PaginationPages","pagesCount","paginationItems","paginationAlignment","usePagination","isTruncated","TRUNCATED_THRESHOLD","React","Flex","PaginationItem","PaginationPopover","pageNumber"],"mappings":"kSAQa,MAAAA,EAAkB,IAAM,CACnC,KAAM,CAAE,WAAAC,EAAY,gBAAAC,EAAiB,oBAAAC,CAAoB,EAAIC,EAAc,EAErEC,EAAcJ,EAAaK,EAEjC,OACEC,EAAA,cAACC,EAAA,CAAK,IAAK,CACRH,EAAAA,GAAeF,IAAwB,SACtCI,EAAA,cAAAA,EAAA,cACEA,EAAA,cAACE,EAAA,CAAe,WAAY,CAAG,CAAA,EAC/BF,EAAA,cAACG,EAAA,IAAkB,CACrB,EAEDR,GAAA,KAAA,OAAAA,EAAiB,IAAKS,GACrBJ,EAAA,cAACE,EAAA,CAAe,IAAKE,EAAY,WAAYA,EAAY,CAE1DN,EAAAA,GAAeF,IAAwB,OACtCI,EAAA,cAAAA,EAAA,SACEA,KAAAA,EAAA,cAACG,EAAA,IAAkB,EACnBH,EAAA,cAACE,EAAA,CAAe,WAAYR,CAAAA,CAAY,CAC1C,CAEJ,CAEJ"}
1
+ {"version":3,"file":"PaginationPages.js","sources":["../../../src/components/pagination/PaginationPages.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Flex } from '../flex'\nimport { PaginationItem } from './PaginationItem'\nimport { PaginationPopover } from './PaginationPopover'\nimport { usePagination } from './usePagination'\n\nexport const PaginationPages = () => {\n const { pagesCount, paginationItems, paginationAlignment } = usePagination()\n\n const isTruncated = pagesCount > paginationItems.length\n\n return (\n <Flex gap={1}>\n {isTruncated && paginationAlignment === 'start' && (\n <>\n <PaginationItem pageNumber={1} />\n <PaginationPopover />\n </>\n )}\n {paginationItems?.map((pageNumber) => (\n <PaginationItem key={pageNumber} pageNumber={pageNumber} />\n ))}\n {isTruncated && paginationAlignment === 'end' && (\n <>\n <PaginationPopover />\n <PaginationItem pageNumber={pagesCount} />\n </>\n )}\n </Flex>\n )\n}\n"],"names":["PaginationPages","pagesCount","paginationItems","paginationAlignment","usePagination","isTruncated","React","Flex","PaginationItem","PaginationPopover","pageNumber"],"mappings":"kOAOO,MAAMA,EAAkB,IAAM,CACnC,KAAM,CAAE,WAAAC,EAAY,gBAAAC,EAAiB,oBAAAC,CAAoB,EAAIC,EAAAA,EAEvDC,EAAcJ,EAAaC,EAAgB,OAEjD,OACEI,EAAA,cAACC,EAAA,CAAK,IAAK,CACRF,EAAAA,GAAeF,IAAwB,SACtCG,EAAA,cAAAA,EAAA,SACEA,KAAAA,EAAA,cAACE,EAAA,CAAe,WAAY,CAAG,CAAA,EAC/BF,EAAA,cAACG,EAAA,IAAkB,CACrB,EAEDP,GAAA,KAAAA,OAAAA,EAAiB,IAAKQ,GACrBJ,EAAA,cAACE,EAAA,CAAe,IAAKE,EAAY,WAAYA,CAAAA,CAAY,GAE1DL,GAAeF,IAAwB,OACtCG,EAAA,cAAAA,EAAA,SAAA,KACEA,EAAA,cAACG,EAAA,IAAkB,EACnBH,EAAA,cAACE,EAAA,CAAe,WAAYP,CAAAA,CAAY,CAC1C,CAEJ,CAEJ"}
@@ -1,4 +1,3 @@
1
- export declare const TRUNCATED_THRESHOLD = 4;
2
1
  export declare enum VisibleElementsAmount {
3
2
  LESS = 6,
4
3
  MORE = 8
@@ -1,2 +1,2 @@
1
- const e=4;var S=(E=>(E[E.LESS=6]="LESS",E[E.MORE=8]="MORE",E))(S||{});export{e as TRUNCATED_THRESHOLD,S as VisibleElementsAmount};
1
+ var e=(E=>(E[E.LESS=6]="LESS",E[E.MORE=8]="MORE",E))(e||{});export{e as VisibleElementsAmount};
2
2
  //# sourceMappingURL=pagination.constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.constants.js","sources":["../../../src/components/pagination/pagination.constants.ts"],"sourcesContent":["export const TRUNCATED_THRESHOLD = 4\n\nexport enum VisibleElementsAmount {\n LESS = 6,\n MORE = 8\n}\n"],"names":["TRUNCATED_THRESHOLD","VisibleElementsAmount"],"mappings":"AAAO,MAAMA,EAAsB,EAEvB,IAAAC,GAAAA,IACVA,EAAAA,EAAA,KAAO,GAAP,OACAA,EAAAA,EAAA,KAAO,GAAP,OAFUA,IAAAA,GAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"pagination.constants.js","sources":["../../../src/components/pagination/pagination.constants.ts"],"sourcesContent":["export enum VisibleElementsAmount {\n LESS = 6,\n MORE = 8\n}\n"],"names":["VisibleElementsAmount","S"],"mappings":"AAAY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,KAAO,GAAP,OACAA,EAAAC,EAAA,KAAO,GAAP,OAFUD,IAAAA,GAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{TRUNCATED_THRESHOLD as a,VisibleElementsAmount as r}from"./pagination.constants.js";const o=e=>e===r.MORE?4:2,c=(e,i,t)=>e>i-o(t)?"start":"end",u=(e,i,t=r.LESS)=>{const n=o(t),l=Array.from({length:i},(m,s)=>s+1);return i<=a?l:(t===r.MORE?[1,2,3].includes(e):[1,2].includes(e))?l.slice(0,n):e>i-n?l.slice(-n):l.slice(t===r.MORE?e-3:e-2,t===r.MORE?e+1:e)},d=(e,i)=>{let t=e;for(;i.includes(t);)t++;return t},g=(e,i)=>{let t=e;for(;i.includes(t);)t--;return t};export{d as findNextAvailablePage,g as findPreviousAvailablePage,c as getPaginationAlignment,u as getPaginationItemsToRender};
1
+ import{VisibleElementsAmount as r}from"./pagination.constants.js";const s=e=>e===r.MORE?4:2,a=(e,i,t)=>e>i-s(t)?"start":"end",c=(e,i,t=r.LESS)=>{const n=s(t),l=Array.from({length:i},(g,o)=>o+1);return i<=t-2?l:(t===r.MORE?[1,2,3].includes(e):[1,2].includes(e))?l.slice(0,n):e>i-n?l.slice(-n):l.slice(t===r.MORE?e-3:e-2,t===r.MORE?e+1:e)},u=(e,i)=>{let t=e;for(;i.includes(t);)t++;return t},d=(e,i)=>{let t=e;for(;i.includes(t);)t--;return t};export{u as findNextAvailablePage,d as findPreviousAvailablePage,a as getPaginationAlignment,c as getPaginationItemsToRender};
2
2
  //# sourceMappingURL=pagination.helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.helper.js","sources":["../../../src/components/pagination/pagination.helper.ts"],"sourcesContent":["import {\n TRUNCATED_THRESHOLD,\n VisibleElementsAmount\n} from './pagination.constants'\nimport { IPaginationAlignment } from './types'\n\n/**\n * Return the maximum number of pagination items required, dependent\n * on the total visible elements.\n *\n * Excludes the 1st and last page as they are rendered separately.\n *\n * So if `visibleElementsCount` is `MORE` (`8`), when we exclude the following 4 buttons,\n * previous, next, popup, and _either_ 1st/last page items, we'll get `4` remaining to render.\n */\nconst getPaginationItemsLimit = (visibleElementsCount: VisibleElementsAmount) =>\n visibleElementsCount === VisibleElementsAmount.MORE ? 4 : 2\n\nexport const getPaginationAlignment = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount: VisibleElementsAmount\n): IPaginationAlignment =>\n currentPage > pagesCount - getPaginationItemsLimit(visibleElementsCount)\n ? 'start'\n : 'end'\n\nexport const getPaginationItemsToRender = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount = VisibleElementsAmount.LESS\n): number[] => {\n const paginationItemsLimit = getPaginationItemsLimit(visibleElementsCount)\n const paginationItems = Array.from(\n { length: pagesCount },\n (_, index) => index + 1\n )\n\n /**\n * If there are fewer pages than our threshold for truncating,\n * render the entire page list\n *\n * +---+ +---+ +---+ +---+\n * | 1 | | 2 | | 3 | | 4 |\n * +---+ +---+ +---+ +---+\n */\n if (pagesCount <= TRUNCATED_THRESHOLD) {\n return paginationItems\n }\n\n /**\n * If we're truncating and current page is at the start of the page list,\n * render the initial truncated page list, e.g.\n *\n * currentPage: 1/2\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [1, 2]\n * +---+ +---+ +---+ +---+\n * | 1 | | 2 | | … | | 6 |\n * +---+ +---+ +---+ +---+\n *\n * currentPage: 1/2/3\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [1, 2, 3, 4]\n * +---+ +---+ +---+ +---+ +---+ +----+\n * | 1 | | 2 | | 3 | | 4 | | … | | 10 |\n * +---+ +---+ +---+ +---+ +---+ +----+\n */\n if (\n visibleElementsCount === VisibleElementsAmount.MORE\n ? [1, 2, 3].includes(currentPage)\n : [1, 2].includes(currentPage)\n ) {\n return paginationItems.slice(0, paginationItemsLimit)\n }\n\n /**\n * If we're truncating and the current page is towards the end of the\n * page list (depending on visibleElementsCount),\n * render a truncated page list from the end, e.g.\n *\n * currentPage: 7\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [7, 8]\n * +---+ +---+ +---+ +---+\n * | 1 | | … | | 7 | | 8 |\n * +---+ +---+ +---+ +---+\n *\n * currentPage: 7\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [7, 8, 9, 10]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | 1 | | … | | 7 | | 8 | | 9 | | 10 |\n * +---+ +---+ +---+ +---+ +---+ +---+\n */\n if (currentPage > pagesCount - paginationItemsLimit) {\n return paginationItems.slice(-paginationItemsLimit)\n }\n\n /**\n * If we're truncating and the current page doesn't meet either previous condition\n * (we're in the middle)\n * render a truncated page list from a specific index relative to `currentPage`, e.g.\n *\n * currentPage: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [3, 4]\n * +---+ +---+ +---+ +---+\n * | 3 | | 4 | | … | | 6 |\n * +---+ +---+ +---+ +---+\n *\n * currentPage: 6\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [4, 5, 6, 7]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | 4 | | 5 | | 6 | | 7 | | … | | 10 |\n * +---+ +---+ +---+ +---+ +---+ +---+\n */\n return paginationItems.slice(\n visibleElementsCount === VisibleElementsAmount.MORE\n ? currentPage - 3\n : currentPage - 2,\n visibleElementsCount === VisibleElementsAmount.MORE\n ? currentPage + 1\n : currentPage\n )\n}\n\nexport const findNextAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number => {\n let nextPage = startPage\n while (disabledPages.includes(nextPage)) {\n nextPage++\n }\n return nextPage\n}\n\nexport const findPreviousAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number => {\n let previousPage = startPage\n while (disabledPages.includes(previousPage)) {\n previousPage--\n }\n return previousPage\n}\n"],"names":["getPaginationItemsLimit","visibleElementsCount","VisibleElementsAmount","getPaginationAlignment","currentPage","pagesCount","getPaginationItemsToRender","paginationItemsLimit","paginationItems","_","index","TRUNCATED_THRESHOLD","findNextAvailablePage","startPage","disabledPages","nextPage","findPreviousAvailablePage","previousPage"],"mappings":"2FAeA,MAAMA,EAA2BC,GAC/BA,IAAyBC,EAAsB,KAAO,EAAI,EAE/CC,EAAyB,CACpCC,EACAC,EACAJ,IAEAG,EAAcC,EAAaL,EAAwBC,CAAoB,EACnE,QACA,MAEOK,EAA6B,CACxCF,EACAC,EACAJ,EAAuBC,EAAsB,OAChC,CACb,MAAMK,EAAuBP,EAAwBC,CAAoB,EACnEO,EAAkB,MAAM,KAC5B,CAAE,OAAQH,CAAW,EACrB,CAACI,EAAGC,IAAUA,EAAQ,CACxB,EAUA,OAAIL,GAAcM,EACTH,GAsBPP,IAAyBC,EAAsB,KAC3C,CAAC,EAAG,EAAG,CAAC,EAAE,SAASE,CAAW,EAC9B,CAAC,EAAG,CAAC,EAAE,SAASA,CAAW,GAExBI,EAAgB,MAAM,EAAGD,CAAoB,EAsBlDH,EAAcC,EAAaE,EACtBC,EAAgB,MAAM,CAACD,CAAoB,EAsB7CC,EAAgB,MACrBP,IAAyBC,EAAsB,KAC3CE,EAAc,EACdA,EAAc,EAClBH,IAAyBC,EAAsB,KAC3CE,EAAc,EACdA,CACN,CACF,EAEaQ,EAAwB,CACnCC,EACAC,IACW,CACX,IAAIC,EAAWF,EACf,KAAOC,EAAc,SAASC,CAAQ,GACpCA,IAEF,OAAOA,CACT,EAEaC,EAA4B,CACvCH,EACAC,IACW,CACX,IAAIG,EAAeJ,EACnB,KAAOC,EAAc,SAASG,CAAY,GACxCA,IAEF,OAAOA,CACT"}
1
+ {"version":3,"file":"pagination.helper.js","sources":["../../../src/components/pagination/pagination.helper.ts"],"sourcesContent":["import { VisibleElementsAmount } from './pagination.constants'\nimport { IPaginationAlignment } from './types'\n\n/**\n * Return the maximum number of pagination items required, dependent\n * on the total visible elements.\n *\n * Excludes the 1st and last page as they are rendered separately.\n *\n * So if `visibleElementsCount` is `MORE` (`8`), when we exclude the following 4 buttons,\n * previous, next, popup, and _either_ 1st/last page items, we'll get `4` remaining to render.\n */\nconst getPaginationItemsLimit = (visibleElementsCount: VisibleElementsAmount) =>\n visibleElementsCount === VisibleElementsAmount.MORE ? 4 : 2\n\nexport const getPaginationAlignment = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount: VisibleElementsAmount\n): IPaginationAlignment =>\n currentPage > pagesCount - getPaginationItemsLimit(visibleElementsCount)\n ? 'start'\n : 'end'\n\nexport const getPaginationItemsToRender = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount = VisibleElementsAmount.LESS\n): number[] => {\n const paginationItemsLimit = getPaginationItemsLimit(visibleElementsCount)\n const paginationItems = Array.from(\n { length: pagesCount },\n (_, index) => index + 1\n )\n\n /**\n * If there are fewer pages than our threshold for truncating,\n * render the entire page list.\n *\n * We need to remove `2` from `visibleElementsCount` to account\n * for the previous & next buttons\n *\n * pagesCount: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [1, 2, 3, 4]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * pagesCount: 6\n * visibleElementsCount:8 // VisibleElementsAmount.MORE\n * returns [1, 2, 3, 4, 5, 6]\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n */\n if (pagesCount <= visibleElementsCount - 2) {\n return paginationItems\n }\n\n /**\n * If we're truncating and current page is at the start of the page list,\n * render the initial truncated page list, e.g.\n *\n * currentPage: 1/2\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [1, 2]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | … | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 1/2/3\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [1, 2, 3, 4]\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | … | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n */\n if (\n visibleElementsCount === VisibleElementsAmount.MORE\n ? [1, 2, 3].includes(currentPage)\n : [1, 2].includes(currentPage)\n ) {\n return paginationItems.slice(0, paginationItemsLimit)\n }\n\n /**\n * If we're truncating and the current page is towards the end of the\n * page list (depending on visibleElementsCount),\n * render a truncated page list from the end, e.g.\n *\n * currentPage: 7\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [7, 8]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | … | | 7 | | 8 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 7\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [7, 8, 9, 10]\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n * | < | | 1 | | … | | 7 | | 8 | | 9 | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n */\n if (currentPage > pagesCount - paginationItemsLimit) {\n return paginationItems.slice(-paginationItemsLimit)\n }\n\n /**\n * If we're truncating and the current page doesn't meet either previous condition\n * (we're in the middle)\n * render a truncated page list from a specific index relative to `currentPage`, e.g.\n *\n * currentPage: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [3, 4]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 3 | | 4 | | … | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 6\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [4, 5, 6, 7]\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n * | < | | 4 | | 5 | | 6 | | 7 | | … | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n */\n return paginationItems.slice(\n visibleElementsCount === VisibleElementsAmount.MORE\n ? currentPage - 3\n : currentPage - 2,\n visibleElementsCount === VisibleElementsAmount.MORE\n ? currentPage + 1\n : currentPage\n )\n}\n\nexport const findNextAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number => {\n let nextPage = startPage\n while (disabledPages.includes(nextPage)) {\n nextPage++\n }\n return nextPage\n}\n\nexport const findPreviousAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number => {\n let previousPage = startPage\n while (disabledPages.includes(previousPage)) {\n previousPage--\n }\n return previousPage\n}\n"],"names":["getPaginationItemsLimit","visibleElementsCount","VisibleElementsAmount","getPaginationAlignment","currentPage","pagesCount","getPaginationItemsToRender","paginationItemsLimit","paginationItems","_","index","findNextAvailablePage","startPage","disabledPages","nextPage","findPreviousAvailablePage","previousPage"],"mappings":"kEAYA,MAAMA,EAA2BC,GAC/BA,IAAyBC,EAAsB,KAAO,EAAI,EAE/CC,EAAyB,CACpCC,EACAC,EACAJ,IAEAG,EAAcC,EAAaL,EAAwBC,CAAoB,EACnE,QACA,MAEOK,EAA6B,CACxCF,EACAC,EACAJ,EAAuBC,EAAsB,OAChC,CACb,MAAMK,EAAuBP,EAAwBC,CAAoB,EACnEO,EAAkB,MAAM,KAC5B,CAAE,OAAQH,CAAW,EACrB,CAACI,EAAGC,IAAUA,EAAQ,CACxB,EAuBA,OAAIL,GAAcJ,EAAuB,EAChCO,GAsBPP,IAAyBC,EAAsB,KAC3C,CAAC,EAAG,EAAG,CAAC,EAAE,SAASE,CAAW,EAC9B,CAAC,EAAG,CAAC,EAAE,SAASA,CAAW,GAExBI,EAAgB,MAAM,EAAGD,CAAoB,EAsBlDH,EAAcC,EAAaE,EACtBC,EAAgB,MAAM,CAACD,CAAoB,EAsB7CC,EAAgB,MACrBP,IAAyBC,EAAsB,KAC3CE,EAAc,EACdA,EAAc,EAClBH,IAAyBC,EAAsB,KAC3CE,EAAc,EACdA,CACN,CACF,EAEaO,EAAwB,CACnCC,EACAC,IACW,CACX,IAAIC,EAAWF,EACf,KAAOC,EAAc,SAASC,CAAQ,GACpCA,IAEF,OAAOA,CACT,EAEaC,EAA4B,CACvCH,EACAC,IACW,CACX,IAAIG,EAAeJ,EACnB,KAAOC,EAAc,SAASG,CAAY,GACxCA,IAEF,OAAOA,CACT"}