should render correctly with pageClick 1`] = `
class="emotion-0 emotion-1"
>
+
+
+`;
+
+exports[`Pagination > should work correctly with perPage 1`] = `
+
+ .emotion-0 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-align-items: normal;
+ -webkit-box-align: normal;
+ -ms-flex-align: normal;
+ align-items: normal;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ justify-content: space-between;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+}
+
+.emotion-2 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 1rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: normal;
+ -ms-flex-pack: normal;
+ -webkit-justify-content: normal;
+ justify-content: normal;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+}
+
+.emotion-4 {
+ color: #727683;
+ font-size: 1rem;
+ font-family: Inter,Asap,sans-serif;
+ font-weight: 400;
+ letter-spacing: 0;
+ line-height: 1.5rem;
+ text-transform: none;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-7 {
+ width: 100%;
+ width: -webkit-fit-content;
+ width: -moz-fit-content;
+ width: fit-content;
+ min-width: none;
+}
+
+.emotion-9 {
+ display: inherit;
+}
+
+.emotion-9[data-container-full-width="true"] {
+ width: 100%;
+}
+
+.emotion-11 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0.25rem;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-align-items: normal;
+ -webkit-box-align: normal;
+ -ms-flex-align: normal;
+ align-items: normal;
+ -webkit-box-pack: normal;
+ -ms-flex-pack: normal;
+ -webkit-justify-content: normal;
+ justify-content: normal;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+}
+
+.emotion-13 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0.5rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ justify-content: space-between;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ padding: 0.5rem;
+ padding-right: 0;
+ padding-left: 1rem;
+ cursor: pointer;
+ box-shadow: none;
+ background: #ffffff;
+ border-radius: 0.25rem;
+ width: 100%;
+ overflow: hidden;
+}
+
+.emotion-13[data-size='small'] {
+ height: 2rem;
+ padding-left: 0.5rem;
+}
+
+.emotion-13[data-size='medium'] {
+ height: 2.5rem;
+}
+
+.emotion-13[data-size='large'] {
+ height: 3rem;
+}
+
+.emotion-13[data-state='neutral'] {
+ border: 1px solid #d9dadd;
+}
+
+.emotion-13[data-state='neutral']:not([data-disabled="true"]):not([data-readonly="true"]):active {
+ border-color: #792dd4;
+ box-shadow: 0px 0px 0px 3px #8c40ef40;
+}
+
+.emotion-13[data-state='neutral']:not([data-disabled='true']):hover,
+.emotion-13[data-state='neutral']:not([data-disabled='true']):focus {
+ border-color: #792dd4;
+ outline: none;
+}
+
+.emotion-13[data-state='neutral'][data-dropdownvisible='true'] {
+ border-color: #792dd4;
+}
+
+.emotion-13[data-state='success'] {
+ border: 1px solid #22674e;
+}
+
+.emotion-13[data-state='success']:not([data-disabled="true"]):not([data-readonly="true"]):active {
+ border-color: #1b533f;
+ box-shadow: 0px 0px 0px 3px #45d19f40;
+}
+
+.emotion-13[data-state='success'][data-dropdownvisible='true'] {
+ border-color: #1b533f;
+}
+
+.emotion-13[data-state='danger'] {
+ border: 1px solid #b3144d;
+}
+
+.emotion-13[data-state='danger']:not([data-disabled="true"]):not([data-readonly="true"]):active {
+ border-color: #92103f;
+ box-shadow: 0px 0px 0px 3px #f91b6c40;
+}
+
+.emotion-13[data-state='danger'][data-dropdownvisible='true'] {
+ border-color: #92103f;
+}
+
+.emotion-13:not([data-disabled='true']):not([data-readonly]):hover {
+ border-color: #8c40ef;
+}
+
+.emotion-13[data-readonly='true'] {
+ background: #f9f9fa;
+ border-color: #d9dadd;
+ cursor: default;
+}
+
+.emotion-13[data-disabled='true'] {
+ background: #f3f3f4;
+ border-color: #e9eaeb;
+ cursor: not-allowed;
+}
+
+.emotion-16 {
+ color: #3f4250;
+ font-size: 0.875rem;
+ font-family: Inter,Asap,sans-serif;
+ font-weight: 400;
+ letter-spacing: 0;
+ line-height: 1.25rem;
+ text-transform: none;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+
+.emotion-18 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0.5rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: normal;
+ -ms-flex-pack: normal;
+ -webkit-justify-content: normal;
+ justify-content: normal;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+ padding-right: 1rem;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+}
+
+.emotion-20 {
+ vertical-align: middle;
+ fill: #3f4250;
+ height: 16px;
+ width: 16px;
+ min-width: 16px;
+ min-height: 16px;
+}
+
+.emotion-20 .fillStroke {
+ stroke: #3f4250;
+ fill: none;
+}
+
+.emotion-24 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-align-items: normal;
+ -webkit-box-align: normal;
+ -ms-flex-align: normal;
+ align-items: normal;
+ -webkit-box-pack: normal;
+ -ms-flex-pack: normal;
+ -webkit-justify-content: normal;
+ justify-content: normal;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+}
+
+.emotion-26 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0.5rem;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-align-items: normal;
+ -webkit-box-align: normal;
+ -ms-flex-align: normal;
+ align-items: normal;
+ -webkit-box-pack: normal;
+ -ms-flex-pack: normal;
+ -webkit-justify-content: normal;
+ justify-content: normal;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+}
+
+.emotion-28 {
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ height: 2rem;
+ padding: 0 0.5rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ gap: 0.5rem;
+ border-radius: 0.25rem;
+ box-sizing: border-box;
+ width: 2rem;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ cursor: pointer;
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ outline-offset: 2px;
+ white-space: nowrap;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ font-size: 0.875rem;
+ font-family: Inter,Asap,sans-serif;
+ font-weight: 500;
+ letter-spacing: 0;
+ line-height: 1.25rem;
+ paragraph-spacing: 0;
+ text-case: none;
+ background: none;
+ border: 1px solid #8c40ef;
+ color: #641cb3;
+}
+
+.emotion-28:hover {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-28:active {
+ box-shadow: 0px 0px 0px 3px #8c40ef40;
+}
+
+.emotion-28:hover,
+.emotion-28:active {
+ background: #e5dbfd;
+ color: #521094;
+ border: 1px solid #792dd4;
+}
+
+.emotion-30 {
+ vertical-align: middle;
+ fill: currentColor;
+ height: 16px;
+ width: 16px;
+ min-width: 16px;
+ min-height: 16px;
+}
+
+.emotion-30 .fillStroke {
+ stroke: currentColor;
+ fill: none;
+}
+
+.emotion-32 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ gap: 0.5rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-align-items: normal;
+ -webkit-box-align: normal;
+ -ms-flex-align: normal;
+ align-items: normal;
+ -webkit-box-pack: normal;
+ -ms-flex-pack: normal;
+ -webkit-justify-content: normal;
+ justify-content: normal;
+ -webkit-box-flex-wrap: nowrap;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+ margin: 0 0.5rem;
+}
+
+.emotion-35 {
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ height: 2rem;
+ padding: 0 0.5rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ gap: 0.5rem;
+ border-radius: 0.25rem;
+ box-sizing: border-box;
+ width: auto;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ cursor: pointer;
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ outline-offset: 2px;
+ white-space: nowrap;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ font-size: 0.875rem;
+ font-family: Inter,Asap,sans-serif;
+ font-weight: 500;
+ letter-spacing: 0;
+ line-height: 1.25rem;
+ paragraph-spacing: 0;
+ text-case: none;
+ background: none;
+ border: 1px solid #b5b7bd;
+ color: #3f4250;
+ width: 2rem;
+}
+
+.emotion-35:hover {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-35:active {
+ box-shadow: 0px 0px 0px 3px #151a2d5c;
+}
+
+.emotion-35:hover,
+.emotion-35:active {
+ background: #e9eaeb;
+ color: #222638;
+ border: 1px solid #92959d;
+}
+
+.emotion-38 {
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ height: 2rem;
+ padding: 0 0.5rem;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ gap: 0.5rem;
+ border-radius: 0.25rem;
+ box-sizing: border-box;
+ width: auto;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ cursor: pointer;
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ outline-offset: 2px;
+ white-space: nowrap;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ font-size: 0.875rem;
+ font-family: Inter,Asap,sans-serif;
+ font-weight: 500;
+ letter-spacing: 0;
+ line-height: 1.25rem;
+ paragraph-spacing: 0;
+ text-case: none;
+ background: none;
+ border: 1px solid #8c40ef;
+ color: #641cb3;
+ width: 2rem;
+}
+
+.emotion-38:hover {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-38:active {
+ box-shadow: 0px 0px 0px 3px #8c40ef40;
+}
+
+.emotion-38:hover,
+.emotion-38:active {
+ background: #e5dbfd;
+ color: #521094;
+ border: 1px solid #792dd4;
+}
+
+.emotion-50 {
+ color: #3f4250;
+ font-size: 1rem;
+ font-family: Inter,Asap,sans-serif;
+ font-weight: 400;
+ letter-spacing: 0;
+ line-height: 1.5rem;
+ text-transform: none;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ text-align: center;
+ -webkit-align-content: center;
+ -ms-flex-line-pack: center;
+ align-content: center;
+ padding: 0.5rem;
+ height: 2rem;
+ width: 2rem;
+}
+
+
+
+
+
+ test
+
+
+
+
+
should render correctly with perPage 1`] = `
should render correctly with perPage 1`] = `
{
test('should render correctly with perPage', async () => {
const mockOnClick = vi.fn()
+
+ const { asFragment } = renderWithTheme(
+ ,
+ )
+ const nextButton = screen.getByRole('button', { name: 'Next' })
+ await userEvent.click(nextButton)
+ expect(mockOnClick).toHaveBeenCalledOnce()
+
+ expect(asFragment()).toMatchSnapshot()
+ })
+
+ test('should work correctly with perPage', async () => {
+ const mockOnClick = vi.fn()
const mockOnClickPerPage = vi.fn()
const { asFragment } = renderWithTheme(
diff --git a/packages/ui/src/components/Pagination/getPageNumbers.ts b/packages/ui/src/components/Pagination/getPageNumbers.ts
index eb90a5f367..5f57658388 100644
--- a/packages/ui/src/components/Pagination/getPageNumbers.ts
+++ b/packages/ui/src/components/Pagination/getPageNumbers.ts
@@ -1,3 +1,4 @@
+const NUMBER_OF_BUTTONS_IN_BETWEEN = 3
/**
* * Return a list of page numbers around the currentPage
* @param currentPage The current page
@@ -27,7 +28,10 @@ export const getPageNumbers = (
: Array.from({ length: range }, (_, index) => index + pageCount - range + 1)
const pagesToShowBetweenTruncation =
truncationBefore && truncationAfter
- ? Array.from({ length: 3 }, (_, index) => currentPage + index - 1)
+ ? Array.from(
+ { length: NUMBER_OF_BUTTONS_IN_BETWEEN },
+ (_, index) => currentPage + index - 1,
+ )
: []
return [
diff --git a/packages/ui/src/components/Pagination/index.tsx b/packages/ui/src/components/Pagination/index.tsx
index 7f0a0438d8..6759c07ae4 100644
--- a/packages/ui/src/components/Pagination/index.tsx
+++ b/packages/ui/src/components/Pagination/index.tsx
@@ -112,6 +112,7 @@ export const Pagination = ({
data-testid={dataTestId}
onChange={onChange}
page={page}
+ perPage={!!perPage}
/>
)