{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pagination-05",
  "title": "Page count with text links",
  "description": "The page count on the left, Previous and Next on the right.",
  "dependencies": [],
  "registryDependencies": [
    "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-05.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\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 Pagination05() {\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    <div className='flex items-center justify-between gap-3'>\n      <p\n        className='text-muted-foreground grow 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      <Pagination className='mx-0 w-auto'>\n        <PaginationContent className='gap-3'>\n          <PaginationItem>\n            <PaginationLink\n              href={hrefOf(previousPage)}\n              size='default'\n              isDisabled={isFirstPage}\n              onClick={(event) => goToPage(event, previousPage)}\n              className='rounded-full'\n            >\n              Previous\n            </PaginationLink>\n          </PaginationItem>\n          <PaginationItem>\n            <PaginationLink\n              href={hrefOf(nextPage)}\n              size='default'\n              isDisabled={isLastPage}\n              onClick={(event) => goToPage(event, nextPage)}\n              className='rounded-full'\n            >\n              Next\n            </PaginationLink>\n          </PaginationItem>\n        </PaginationContent>\n      </Pagination>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "components",
    "pagination"
  ],
  "type": "registry:component"
}