{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "adminlte-pagination", "title": "AdminLTE Pagination", "description": "Pagination component with flat variant, three sizes, and ellipsis for large page counts.", "registryDependencies": [ "https://raw.githubusercontent.com/dnachavez/adminlte-next/master/public/r/adminlte-theme.json" ], "files": [ { "path": "registry/new-york/adminlte-pagination/ui/adminlte-pagination.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"@/registry/new-york/adminlte-theme/lib/cn\"\n\ninterface AdminLTEPaginationProps\n extends React.HTMLAttributes {\n currentPage: number\n totalPages: number\n onPageChange: (page: number) => void\n size?: \"sm\" | \"md\" | \"lg\"\n flat?: boolean\n}\n\nconst AdminLTEPagination = React.forwardRef<\n HTMLUListElement,\n AdminLTEPaginationProps\n>(\n (\n {\n className,\n currentPage,\n totalPages,\n onPageChange,\n size = \"md\",\n flat = false,\n ...props\n },\n ref\n ) => {\n const pages = React.useMemo(() => {\n const p: (number | \"...\")[] = []\n if (totalPages <= 7) {\n for (let i = 1; i <= totalPages; i++) p.push(i)\n } else {\n p.push(1)\n if (currentPage > 3) p.push(\"...\")\n for (\n let i = Math.max(2, currentPage - 1);\n i <= Math.min(totalPages - 1, currentPage + 1);\n i++\n ) {\n p.push(i)\n }\n if (currentPage < totalPages - 2) p.push(\"...\")\n p.push(totalPages)\n }\n return p\n }, [currentPage, totalPages])\n\n const sizeClass = {\n sm: \"[&_a]:px-[10px] [&_a]:py-[5px] [&_a]:text-[12px]\",\n md: \"\",\n lg: \"[&_a]:px-[16px] [&_a]:py-[10px] [&_a]:text-[18px]\",\n }[size]\n\n return (\n \n \n onPageChange(currentPage - 1)}\n >\n «\n \n \n {pages.map((page, i) => (\n \n \n typeof page === \"number\" && onPageChange(page)\n }\n >\n {page}\n \n \n ))}\n \n onPageChange(currentPage + 1)}\n >\n »\n \n \n \n )\n }\n)\nAdminLTEPagination.displayName = \"AdminLTEPagination\"\n\nexport { AdminLTEPagination }\nexport type { AdminLTEPaginationProps }\n", "type": "registry:ui" } ], "type": "registry:ui" }