{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "comp-461",
  "type": "registry:component",
  "title": "Comp 461",
  "description": "Comp 461",
  "files": [
    {
      "path": "registry/ui-basic/comp-461.tsx",
      "content": "import { buttonVariants } from \"@/components/ui/button\";\nimport {\n\tPagination,\n\tPaginationContent,\n\tPaginationEllipsis,\n\tPaginationItem,\n\tPaginationLink,\n} from \"@/components/ui/pagination\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"../utilities/cn\";\nimport { usePagination } from \"../utilities/usePagination\";\n\ntype PaginationProps = {\n\tcurrentPage: number;\n\ttotalPages: number;\n\tpaginationItemsToDisplay?: number;\n};\n\nexport default function Component({\n\tcurrentPage,\n\ttotalPages,\n\tpaginationItemsToDisplay = 5,\n}: PaginationProps) {\n\tconst { pages, showLeftEllipsis, showRightEllipsis } = usePagination({\n\t\tcurrentPage,\n\t\ttotalPages,\n\t\tpaginationItemsToDisplay,\n\t});\n\n\treturn (\n\t\t<Pagination>\n\t\t\t<PaginationContent className=\"inline-flex gap-0 -space-x-px rounded-md shadow-2xs rtl:space-x-reverse\">\n\t\t\t\t{/* Previous page button */}\n\t\t\t\t<PaginationItem className=\"[&:first-child>a]:rounded-s-md [&:last-child>a]:rounded-e-md\">\n\t\t\t\t\t<PaginationLink\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\tbuttonVariants({\n\t\t\t\t\t\t\t\tvariant: \"outline\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\"rounded-none shadow-none focus-visible:z-10 aria-disabled:pointer-events-none [&[aria-disabled]>svg]:opacity-50\"\n\t\t\t\t\t\t)}\n\t\t\t\t\t\thref={\n\t\t\t\t\t\t\tcurrentPage === 1 ? undefined : `#/page/${currentPage - 1}`\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label=\"Go to previous page\"\n\t\t\t\t\t\taria-disabled={currentPage === 1 ? true : undefined}\n\t\t\t\t\t\trole={currentPage === 1 ? \"link\" : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ChevronLeftIcon size={16} aria-hidden=\"true\" />\n\t\t\t\t\t</PaginationLink>\n\t\t\t\t</PaginationItem>\n\n\t\t\t\t{/* Left ellipsis (...) */}\n\t\t\t\t{showLeftEllipsis && (\n\t\t\t\t\t<PaginationItem className=\"[&:first-child>a]:rounded-s-md [&:last-child>a]:rounded-e-md\">\n\t\t\t\t\t\t<PaginationEllipsis />\n\t\t\t\t\t</PaginationItem>\n\t\t\t\t)}\n\n\t\t\t\t{/* Page number links */}\n\t\t\t\t{pages.map((page) => (\n\t\t\t\t\t<PaginationItem key={page}>\n\t\t\t\t\t\t<PaginationLink\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\tbuttonVariants({\n\t\t\t\t\t\t\t\t\tvariant: \"outline\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\"rounded-none shadow-none focus-visible:z-10\",\n\t\t\t\t\t\t\t\tpage === currentPage && \"bg-accent\"\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\thref={`#/page/${page}`}\n\t\t\t\t\t\t\tisActive={page === currentPage}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t</PaginationLink>\n\t\t\t\t\t</PaginationItem>\n\t\t\t\t))}\n\n\t\t\t\t{/* Right ellipsis (...) */}\n\t\t\t\t{showRightEllipsis && (\n\t\t\t\t\t<PaginationItem className=\"[&:first-child>a]:rounded-s-md [&:last-child>a]:rounded-e-md\">\n\t\t\t\t\t\t<PaginationEllipsis\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\tbuttonVariants({\n\t\t\t\t\t\t\t\t\tvariant: \"outline\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\"pointer-events-none rounded-none shadow-none\"\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PaginationItem>\n\t\t\t\t)}\n\n\t\t\t\t{/* Next page button */}\n\t\t\t\t<PaginationItem className=\"[&:first-child>a]:rounded-s-md [&:last-child>a]:rounded-e-md\">\n\t\t\t\t\t<PaginationLink\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\tbuttonVariants({\n\t\t\t\t\t\t\t\tvariant: \"outline\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\"rounded-none shadow-none focus-visible:z-10 aria-disabled:pointer-events-none [&[aria-disabled]>svg]:opacity-50\"\n\t\t\t\t\t\t)}\n\t\t\t\t\t\thref={\n\t\t\t\t\t\t\tcurrentPage === totalPages\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: `#/page/${currentPage + 1}`\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label=\"Go to next page\"\n\t\t\t\t\t\taria-disabled={currentPage === totalPages ? true : undefined}\n\t\t\t\t\t\trole={currentPage === totalPages ? \"link\" : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ChevronRightIcon size={16} aria-hidden=\"true\" />\n\t\t\t\t\t</PaginationLink>\n\t\t\t\t</PaginationItem>\n\t\t\t</PaginationContent>\n\t\t</Pagination>\n\t);\n}\n",
      "type": "registry:ui"
    },
    {
      "path": "components/ui/button.tsx",
      "content": "import * as React from \"react\";\r\n\r\nimport { cn } from \"@/registry/utilities/cn\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\nimport { cva, type VariantProps } from \"class-variance-authority\";\r\n\r\nconst buttonVariants = cva(\r\n\t\"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm text-white hover:text-gray-400 font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\r\n\t{\r\n\t\tvariants: {\r\n\t\t\tvariant: {\r\n\t\t\t\tsimple:\r\n\t\t\t\t\t\"bg-secondary relative z-10 bg-transparent hover:border-secondary hover:bg-secondary/50  border border-transparent dark:text-white text-sm md:text-sm transition font-medium duration-200  rounded-md px-4 py-2  flex items-center justify-center\",\r\n\t\t\t\tdefault: \"bg-primary text-primary-foreground hover:bg-primary/90\",\r\n\t\t\t\tdestructive:\r\n\t\t\t\t\t\"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\r\n\t\t\t\toutline:\r\n\t\t\t\t\t\"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\r\n\t\t\t\tsecondary:\r\n\t\t\t\t\t\"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\r\n\t\t\t\tghost: \"hover:bg-accent hover:text-black hover:stroke-black dark:text-white text-black\",\r\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\r\n\t\t\t},\r\n\t\t\tsize: {\r\n\t\t\t\tdefault: \"h-10 px-4 py-2\",\r\n\t\t\t\tsm: \"h-9 rounded-md px-3\",\r\n\t\t\t\tlg: \"h-11 rounded-md px-8\",\r\n\t\t\t\ticon: \"h-10 w-10\",\r\n\t\t\t},\r\n\t\t},\r\n\t\tdefaultVariants: {\r\n\t\t\tvariant: \"default\",\r\n\t\t\tsize: \"default\",\r\n\t\t},\r\n\t}\r\n);\r\n\r\nexport interface ButtonProps\r\n\textends React.ButtonHTMLAttributes<HTMLButtonElement>,\r\n\t\tVariantProps<typeof buttonVariants> {\r\n\tasChild?: boolean;\r\n}\r\n\r\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\r\n\t({ className, variant, size, asChild = false, ...props }, ref) => {\r\n\t\tconst Comp = asChild ? Slot : \"button\";\r\n\t\treturn (\r\n\t\t\t<Comp\r\n\t\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\r\n\t\t\t\tref={ref}\r\n\t\t\t\t{...props}\r\n\t\t\t/>\r\n\t\t);\r\n\t}\r\n);\r\nButton.displayName = \"Button\";\r\n\r\nexport { Button, buttonVariants };\r\n",
      "type": "registry:ui"
    },
    {
      "path": "registry/utilities/cn.ts",
      "content": "import { ClassValue, clsx } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n\treturn twMerge(clsx(inputs));\r\n}\r\n",
      "type": "registry:ui"
    },
    {
      "path": "registry/utilities/usePagination.ts",
      "content": "\r\ntype UsePaginationProps = {\r\n    currentPage: number\r\n    totalPages: number\r\n    paginationItemsToDisplay: number\r\n}\r\n\r\ntype UsePaginationReturn = {\r\n    pages: number[]\r\n    showLeftEllipsis: boolean\r\n    showRightEllipsis: boolean\r\n}\r\n\r\nexport function usePagination({\r\n    currentPage,\r\n    totalPages,\r\n    paginationItemsToDisplay,\r\n}: UsePaginationProps): UsePaginationReturn {\r\n    const showLeftEllipsis = currentPage - 1 > paginationItemsToDisplay / 2\r\n    const showRightEllipsis =\r\n        totalPages - currentPage + 1 > paginationItemsToDisplay / 2\r\n\r\n    function calculatePaginationRange(): number[] {\r\n        if (totalPages <= paginationItemsToDisplay) {\r\n            return Array.from({ length: totalPages }, (_, i) => i + 1)\r\n        }\r\n\r\n        const halfDisplay = Math.floor(paginationItemsToDisplay / 2)\r\n        const initialRange = {\r\n            start: currentPage - halfDisplay,\r\n            end: currentPage + halfDisplay,\r\n        }\r\n\r\n        const adjustedRange = {\r\n            start: Math.max(1, initialRange.start),\r\n            end: Math.min(totalPages, initialRange.end),\r\n        }\r\n\r\n        if (adjustedRange.start === 1) {\r\n            adjustedRange.end = paginationItemsToDisplay\r\n        }\r\n        if (adjustedRange.end === totalPages) {\r\n            adjustedRange.start = totalPages - paginationItemsToDisplay + 1\r\n        }\r\n\r\n        if (showLeftEllipsis) adjustedRange.start++\r\n        if (showRightEllipsis) adjustedRange.end--\r\n\r\n        return Array.from(\r\n            { length: adjustedRange.end - adjustedRange.start + 1 },\r\n            (_, i) => adjustedRange.start + i\r\n        )\r\n    }\r\n\r\n    const pages = calculatePaginationRange()\r\n\r\n    return {\r\n        pages,\r\n        showLeftEllipsis,\r\n        showRightEllipsis,\r\n    }\r\n}\r\n",
      "type": "registry:ui"
    }
  ]
}