import { type ReactElement } from "react";
import * as React from "react";
import {
ChevronLeftIcon,
ChevronRightIcon,
ChevronsLeftIcon,
ChevronsRightIcon,
MoreHorizontalIcon,
} from "lucide-react";
import { cn } from "@/lib/utils";
import { buttonVariants, Button } from "@/components/ui/button";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
/**
* Pagination — WealthX Design System
* Figma: https://www.figma.com/design/9V9F0NGVsif8LGmEhVjOcT/Design-System---shadcn?node-id=73-1981
*
* Base: official shadcn pagination (npx shadcn\@latest add pagination)
* WealthX overrides: none — ghost/outline variants match design system
*/
export type PaginationProps = React.ComponentProps<"nav">;
function Pagination({ className, ...props }: PaginationProps): ReactElement {
return (
);
}
export type PaginationContentProps = React.ComponentProps<"ul">;
function PaginationContent({
className,
...props
}: PaginationContentProps): ReactElement {
return (
);
}
export type PaginationItemProps = React.ComponentProps<"li">;
function PaginationItem({ ...props }: PaginationItemProps): ReactElement {
return ;
}
export type PaginationLinkProps = {
isActive?: boolean;
} & Pick, "size"> &
React.ComponentProps<"a">;
function PaginationLink({
className,
isActive,
size = "icon",
...props
}: PaginationLinkProps): ReactElement {
return (
// eslint-disable-next-line jsx-a11y/anchor-has-content -- children passed via props spread
);
}
export type PaginationPreviousProps = React.ComponentProps<
typeof PaginationLink
>;
function PaginationPrevious({
className,
...props
}: PaginationPreviousProps): ReactElement {
return (
Previous
);
}
export type PaginationNextProps = React.ComponentProps;
function PaginationNext({
className,
...props
}: PaginationNextProps): ReactElement {
return (
Next
);
}
export type PaginationEllipsisProps = React.ComponentProps<"span">;
function PaginationEllipsis({
className,
...props
}: PaginationEllipsisProps): ReactElement {
return (
More pages
);
}
export type PaginationNavButtonsProps = {
hasPrev: boolean;
hasNext: boolean;
onFirst: () => void;
onPrev: () => void;
onNext: () => void;
onLast: () => void;
};
function PaginationNavButtons({
hasPrev,
hasNext,
onFirst,
onPrev,
onNext,
onLast,
}: PaginationNavButtonsProps): ReactElement {
return (
);
}
export type TablePaginationProps = {
page: number;
pageCount: number;
pageSize: number;
pageSizeOptions?: number[];
onPageChange: (page: number) => void;
onPageSizeChange: (pageSize: number) => void;
selectedCount?: number;
totalCount?: number;
className?: string;
};
function TablePagination({
page,
pageCount,
pageSize,
pageSizeOptions = [10, 20, 30, 50],
onPageChange,
onPageSizeChange,
selectedCount,
totalCount,
className,
}: TablePaginationProps): ReactElement {
return (
{selectedCount != null && selectedCount > 0 && totalCount != null && (
{selectedCount} of {totalCount} row(s) selected.
)}
Rows per page
Page {page} of {pageCount}
1}
onFirst={() => onPageChange(1)}
onLast={() => onPageChange(pageCount)}
onNext={() => onPageChange(page + 1)}
onPrev={() => onPageChange(page - 1)}
/>
);
}
export {
Pagination,
PaginationContent,
PaginationLink,
PaginationItem,
PaginationPrevious,
PaginationNext,
PaginationEllipsis,
PaginationNavButtons,
TablePagination,
};