{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pagination-04",
  "title": "Compact page count",
  "description": "The page count and its two arrows grouped in the centre.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/pagination.json",
    "https://ui.ndekocode.dev/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/pagination/pagination-04.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { ChevronLeftIcon, ChevronRightIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  Pagination,\n  PaginationContent,\n  PaginationItem,\n  PaginationLink,\n} from '@/registry/ndeko/ui/pagination';\n\nconst FIRST_PAGE = 1;\nconst TOTAL_PAGES = 10;\n\nfunction clampPage(page: number) {\n  const atLeastFirst = Math.max(FIRST_PAGE, page);\n  return Math.min(TOTAL_PAGES, atLeastFirst);\n}\n\nfunction hrefOf(page: number) {\n  return `#/page/${page}`;\n}\n\nexport default function Pagination04() {\n  const [page, setPage] = useState(FIRST_PAGE);\n  const previousPage = page - 1;\n  const nextPage = page + 1;\n  const isFirstPage = page === FIRST_PAGE;\n  const isLastPage = page === TOTAL_PAGES;\n\n  function goToPage(\n    event: React.MouseEvent<HTMLAnchorElement>,\n    target: number\n  ) {\n    event.preventDefault();\n    const nextCurrent = clampPage(target);\n    setPage(nextCurrent);\n  }\n\n  return (\n    <Pagination>\n      <PaginationContent className='gap-3'>\n        <PaginationItem>\n          <PaginationLink\n            href={hrefOf(previousPage)}\n            aria-label='Go to previous page'\n            isDisabled={isFirstPage}\n            onClick={(event) => goToPage(event, previousPage)}\n            className='rounded-full'\n          >\n            <ChevronLeftIcon />\n          </PaginationLink>\n        </PaginationItem>\n        <PaginationItem>\n          <p\n            className='text-muted-foreground text-[13px] tabular-nums'\n            aria-live='polite'\n          >\n            <span className='sr-only'>\n              Page {page} of {TOTAL_PAGES}\n            </span>\n            <span className='inline-flex items-baseline' aria-hidden='true'>\n              Page&nbsp;\n              <MotionNumber value={page} className='text-foreground' />\n              &nbsp;of&nbsp;\n              <span className='text-foreground'>{TOTAL_PAGES}</span>\n            </span>\n          </p>\n        </PaginationItem>\n        <PaginationItem>\n          <PaginationLink\n            href={hrefOf(nextPage)}\n            aria-label='Go to next page'\n            isDisabled={isLastPage}\n            onClick={(event) => goToPage(event, nextPage)}\n            className='rounded-full'\n          >\n            <ChevronRightIcon />\n          </PaginationLink>\n        </PaginationItem>\n      </PaginationContent>\n    </Pagination>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "components",
    "pagination"
  ],
  "type": "registry:component"
}