'use client'; import * as React from 'react'; import { cva, type VariantProps } from '@/lib/cva'; import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from '@/icons'; import { cn } from '@/lib/utils'; import { colorPalettes, disabledState, focusRing, iconSizing } from '@/lib/cva-presets'; const paginationVariants = cva('mx-auto flex w-full justify-center', { variants: { colorPalette: colorPalettes, }, defaultVariants: { /* CBAR paints the selected page turquoise. */ colorPalette: 'secondary', }, }); /* * CBAR draws every control in the strip at the same 32×32 — pages, arrows and * the ellipsis alike — rather than reusing its Button ladder, so this is a * local variant rather than a call into `buttonVariants`. */ const paginationLinkVariants = cva( cn( 'inline-flex size-8 items-center justify-center rounded-md text-sm', 'transition-colors duration-(--ui-duration-fast) ease-(--ui-ease-standard)', focusRing, disabledState, iconSizing ), { variants: { isActive: { true: 'bg-(--ctl-solid) text-(--ctl-solid-fg)', /* * Hover lands on `--ctl-soft`, a step below the selected fill. CBAR * draws hover identically to the resting state, which leaves a page * with no feedback at all before it is clicked. */ false: 'bg-muted text-foreground hover:bg-(--ctl-soft)', }, }, defaultVariants: { isActive: false, }, } ); export interface PaginationProps extends React.ComponentProps<'nav'>, VariantProps {} export type PaginationLinkProps = { isActive?: boolean; } & React.ComponentProps<'a'>; /** * Page navigation. * * Renders real anchors so pages stay linkable and open-in-new-tab works. Wire * each link to a route or query string rather than a click handler. */ function Pagination({ className, colorPalette, ...props }: PaginationProps) { return (