mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
157 lines
3.6 KiB
TypeScript
157 lines
3.6 KiB
TypeScript
import * as React from "react"
|
|
|
|
import { cn } from "@/registry/bases/base/lib/utils"
|
|
import { Button } from "@/registry/bases/base/ui/button"
|
|
import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"
|
|
|
|
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
return (
|
|
<nav
|
|
role="navigation"
|
|
aria-label="pagination"
|
|
data-slot="pagination"
|
|
className={cn(
|
|
"cn-pagination mx-auto flex w-full justify-center",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function PaginationContent({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"ul">) {
|
|
return (
|
|
<ul
|
|
data-slot="pagination-content"
|
|
className={cn("cn-pagination-content flex items-center", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
return <li data-slot="pagination-item" {...props} />
|
|
}
|
|
|
|
type PaginationLinkProps = {
|
|
isActive?: boolean
|
|
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
|
React.ComponentProps<"a">
|
|
|
|
function PaginationLink({
|
|
className,
|
|
isActive,
|
|
size = "icon",
|
|
...props
|
|
}: PaginationLinkProps) {
|
|
return (
|
|
<Button
|
|
variant={isActive ? "outline" : "ghost"}
|
|
size={size}
|
|
className={cn("cn-pagination-link", className)}
|
|
nativeButton={false}
|
|
render={
|
|
<a
|
|
aria-current={isActive ? "page" : undefined}
|
|
data-slot="pagination-link"
|
|
data-active={isActive}
|
|
{...props}
|
|
/>
|
|
}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function PaginationPrevious({
|
|
className,
|
|
text = "Previous",
|
|
...props
|
|
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
return (
|
|
<PaginationLink
|
|
aria-label="Go to previous page"
|
|
size="default"
|
|
className={cn("cn-pagination-previous", className)}
|
|
{...props}
|
|
>
|
|
<IconPlaceholder
|
|
lucide="ChevronLeftIcon"
|
|
tabler="IconChevronLeft"
|
|
hugeicons="ArrowLeft01Icon"
|
|
phosphor="CaretLeftIcon"
|
|
remixicon="RiArrowLeftSLine"
|
|
data-icon="inline-start"
|
|
className="cn-rtl-flip"
|
|
/>
|
|
<span className="cn-pagination-previous-text hidden sm:block">
|
|
{text}
|
|
</span>
|
|
</PaginationLink>
|
|
)
|
|
}
|
|
|
|
function PaginationNext({
|
|
className,
|
|
text = "Next",
|
|
...props
|
|
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
return (
|
|
<PaginationLink
|
|
aria-label="Go to next page"
|
|
size="default"
|
|
className={cn("cn-pagination-next", className)}
|
|
{...props}
|
|
>
|
|
<span className="cn-pagination-next-text hidden sm:block">{text}</span>
|
|
<IconPlaceholder
|
|
lucide="ChevronRightIcon"
|
|
tabler="IconChevronRight"
|
|
hugeicons="ArrowRight01Icon"
|
|
phosphor="CaretRightIcon"
|
|
remixicon="RiArrowRightSLine"
|
|
data-icon="inline-end"
|
|
className="cn-rtl-flip"
|
|
/>
|
|
</PaginationLink>
|
|
)
|
|
}
|
|
|
|
function PaginationEllipsis({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
aria-hidden
|
|
data-slot="pagination-ellipsis"
|
|
className={cn(
|
|
"cn-pagination-ellipsis flex items-center justify-center",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<IconPlaceholder
|
|
lucide="MoreHorizontalIcon"
|
|
tabler="IconDots"
|
|
hugeicons="MoreHorizontalCircle01Icon"
|
|
phosphor="DotsThreeIcon"
|
|
remixicon="RiMoreLine"
|
|
/>
|
|
<span className="sr-only">More pages</span>
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export {
|
|
Pagination,
|
|
PaginationContent,
|
|
PaginationEllipsis,
|
|
PaginationItem,
|
|
PaginationLink,
|
|
PaginationNext,
|
|
PaginationPrevious,
|
|
}
|