From a8add4cd12f2efe35ef0a04905915023eee5603e Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 23 Jun 2026 16:02:25 +0700 Subject: [PATCH 1/3] Align pagination to architecture goals - Move all className composition into cva variants; drop cx from component files and from the exported slotBase helper (now an internal constant). - Add ellipsisVariants cva so PaginationEllipsis no longer calls cx directly. - Make PaginationEllipsis accept children (NodeSlot pattern) instead of baking MoreHorizontal inline, keeping it a single rendered element. - Add required magnitude prop to every ui part (PaginationArrowButton, PaginationPageButton, PaginationEllipsis, PaginationPerPageTrigger) with an md value covering the current 24px Figma size; no defaultVariants. - Switch [&_svg] descendant selectors to [&>svg] direct-child selectors to match the single-element/children-passed-in pattern. - Export PaginationMagnitude and ellipsisVariants from the ui entry; drop the now-internal slotBase from the public export. - Thread magnitude="md" through the Pagination composition and both story files. --- .../src/components/pagination/pagination.tsx | 13 +++- packages/propel/src/ui/pagination/index.tsx | 5 +- .../ui/pagination/pagination-arrow-button.tsx | 16 +++-- .../src/ui/pagination/pagination-ellipsis.tsx | 21 ++++--- .../ui/pagination/pagination-page-button.tsx | 12 ++-- .../pagination-per-page-trigger.tsx | 15 +++-- .../src/ui/pagination/pagination.stories.tsx | 20 +++--- packages/propel/src/ui/pagination/variants.ts | 62 ++++++++++++++----- 8 files changed, 115 insertions(+), 49 deletions(-) diff --git a/packages/propel/src/components/pagination/pagination.tsx b/packages/propel/src/components/pagination/pagination.tsx index 013845bd..8c16ca52 100644 --- a/packages/propel/src/components/pagination/pagination.tsx +++ b/packages/propel/src/components/pagination/pagination.tsx @@ -1,4 +1,4 @@ -import { ArrowLeft, ArrowRight, ChevronDown, LoaderCircle } from "lucide-react"; +import { ArrowLeft, ArrowRight, ChevronDown, LoaderCircle, MoreHorizontal } from "lucide-react"; import * as React from "react"; import { Menu, MenuTrigger } from "../../ui/menu/index"; @@ -177,7 +177,7 @@ export function Pagination({ arrows move, Enter selects). */} - }> + }> {l.perPageValue(pageSize.value)} {l.perPage} @@ -211,6 +211,7 @@ export function Pagination({
  • onPageChange(page - 1)} @@ -221,12 +222,17 @@ export function Pagination({ {tokens.map((token) => { if (token === "ellipsis-start" || token === "ellipsis-end") { - return ; + return ( + + + + ); } const isCurrent = token === page; return (
  • onPageChange(page + 1)} diff --git a/packages/propel/src/ui/pagination/index.tsx b/packages/propel/src/ui/pagination/index.tsx index 724a07b7..14112daf 100644 --- a/packages/propel/src/ui/pagination/index.tsx +++ b/packages/propel/src/ui/pagination/index.tsx @@ -1,5 +1,5 @@ export { PaginationArrowButton, type PaginationArrowButtonProps } from "./pagination-arrow-button"; -export { PaginationEllipsis } from "./pagination-ellipsis"; +export { PaginationEllipsis, type PaginationEllipsisProps } from "./pagination-ellipsis"; export { PaginationPageButton, type PaginationPageButtonProps } from "./pagination-page-button"; export { PaginationPerPageTrigger, @@ -7,7 +7,8 @@ export { } from "./pagination-per-page-trigger"; export { arrowButtonVariants, + ellipsisVariants, pageButtonVariants, perPageTriggerVariants, - slotBase, + type PaginationMagnitude, } from "./variants"; diff --git a/packages/propel/src/ui/pagination/pagination-arrow-button.tsx b/packages/propel/src/ui/pagination/pagination-arrow-button.tsx index 9f7fbd16..51eff57c 100644 --- a/packages/propel/src/ui/pagination/pagination-arrow-button.tsx +++ b/packages/propel/src/ui/pagination/pagination-arrow-button.tsx @@ -1,16 +1,20 @@ import type * as React from "react"; -import { arrowButtonVariants } from "./variants"; +import { type PaginationMagnitude, arrowButtonVariants } from "./variants"; export type PaginationArrowButtonProps = Omit< React.ComponentProps<"button">, "className" | "style" ->; +> & { + /** Size of the slot. Pass the icon as `children`; it is sized via `[&>svg]`. */ + magnitude: PaginationMagnitude; +}; /** - * A styled prev/next arrow button. Applies `arrowButtonVariants()`; pass the (directional, - * RTL-mirrored) arrow icon as `children` and wire `aria-label`/`disabled`/`onClick` through props. + * A styled prev/next arrow button. Applies `arrowButtonVariants({ magnitude })`; pass the + * (directional, RTL-mirrored) arrow icon as `children` and wire `aria-label`/`disabled`/`onClick` + * through props. */ -export function PaginationArrowButton(props: PaginationArrowButtonProps) { - return