Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d3c2f38
feat(ui): add Mosaic Pagination component
alexcarpenter Sep 11, 2026
e4090ef
fix(ui): sanitize Pagination numeric props and label the page-size co…
alexcarpenter Sep 16, 2026
2996d51
Merge branch 'main' into carp/mosaic-pagination
alexcarpenter Sep 16, 2026
0b539a7
Merge branch 'main' into carp/mosaic-pagination
alexcarpenter Sep 16, 2026
dd01af6
chore(ui): address Pagination review nits
alexcarpenter Sep 16, 2026
d846175
refactor(ui): take xstyle on Pagination instead of className and style
alexcarpenter Sep 16, 2026
2611063
feat(ui): use the Mosaic Select for the Pagination page size
alexcarpenter Sep 16, 2026
4a16f60
Merge remote-tracking branch 'origin/main' into carp/mosaic-pagination
alexcarpenter Sep 16, 2026
2d5e8f5
fix(ui): use the restructured foreground tokens in Pagination
alexcarpenter Sep 16, 2026
fe96131
fix(ui): size the Pagination page size options to match the trigger
alexcarpenter Sep 16, 2026
db99f7d
fix(ui): inset the Pagination page size options to the sm trigger text
alexcarpenter Sep 16, 2026
868ce38
refactor(ui): give the Pagination page size label its own slot
alexcarpenter Sep 16, 2026
934776d
feat(ui): take the Pagination page size label as a prop
alexcarpenter Sep 16, 2026
599edb6
Merge remote-tracking branch 'origin/main' into carp/mosaic-pagination
alexcarpenter Sep 16, 2026
c9d14e2
refactor(ui): render the Pagination page size label with Text
alexcarpenter Sep 16, 2026
b6542e8
fix(ui): keep the pagination-label slot class on the Text label
alexcarpenter Sep 16, 2026
bdb06d4
fix(ui): drop invalid and duplicate Pagination page size options
alexcarpenter Sep 16, 2026
9ad65e7
feat(ui): localize Pagination control labels and fill the gaps betwee…
alexcarpenter Sep 17, 2026
53b92a4
chore(ui): retrigger CI for Pagination
alexcarpenter Sep 17, 2026
72172d0
Merge remote-tracking branch 'origin/main' into carp/mosaic-pagination
alexcarpenter Sep 18, 2026
5d59113
refactor(mosaic): move Pagination into @clerk/mosaic and mirror its c…
alexcarpenter Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/mosaic-pagination.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Comment thread
coderabbitai[bot] marked this conversation as resolved.
2 changes: 2 additions & 0 deletions packages/mosaic/src/components/pagination/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Pagination } from './pagination';
export type { PaginationProps } from './pagination';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
33 changes: 33 additions & 0 deletions packages/mosaic/src/components/pagination/page-items.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export type PageItem = number | 'start-ellipsis' | 'end-ellipsis';

function range(start: number, end: number): number[] {
const pages: number[] = [];
for (let page = start; page <= end; page++) {
pages.push(page);
}
return pages;
}

export function getPageItems(page: number, pageCount: number, siblingCount: number): PageItem[] {
if (pageCount <= 1) {
return [1];
}

const windowStart = Math.max(Math.min(page - siblingCount, pageCount - 2 * siblingCount - 2), 3);
const windowEnd = Math.min(Math.max(page + siblingCount, 2 * siblingCount + 3), pageCount - 2);

const items: PageItem[] = [1];
if (windowStart > 3) {
items.push('start-ellipsis');
} else if (pageCount > 3) {
items.push(2);
}
items.push(...range(windowStart, windowEnd));
if (windowEnd < pageCount - 2) {
items.push('end-ellipsis');
} else if (pageCount > 2) {
items.push(pageCount - 1);
}
items.push(pageCount);
return items;
}
53 changes: 53 additions & 0 deletions packages/mosaic/src/components/pagination/pagination.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as stylex from '@stylexjs/stylex';

import { colorVars, space, typeScaleVars } from '../../tokens.stylex';

export const styles = stylex.create({
root: {
gap: space['4'],
alignItems: 'center',
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'space-between',
},
controls: {
gap: space['1'],
alignItems: 'center',
display: 'flex',
},
hitTarget: {
position: 'relative',
'::after': {
insetBlock: 0,
insetInline: `calc(${space['1']} / -2)`,
content: '""',
position: 'absolute',
},
},
page: {
color: {
default: colorVars['--cl-color-foreground-secondary'],
':where([aria-current="page"])': colorVars['--cl-color-foreground'],
},
},
ellipsis: {
alignItems: 'center',
color: colorVars['--cl-color-foreground-secondary'],
display: 'inline-flex',
justifyContent: 'center',
height: space['7'],
width: space['7'],
},
pageSize: {
gap: space['2'],
alignItems: 'center',
display: 'flex',
},
pageSizeOption: {
paddingBlock: 0,
paddingInline: space['2'],
fontSize: typeScaleVars['--cl-text-xs-size'],
lineHeight: typeScaleVars['--cl-text-xs-leading'],
minHeight: space['7'],
},
});
Loading
Loading