{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pagination",
  "title": "Pagination",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/pagination/Pagination.tsx",
      "content": "import * as React from 'react'\nimport { Pressable, View, type ViewProps } from 'react-native'\nimport { Button, type ButtonProps } from '@/components/ui/button'\nimport { Text, type TextProps } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface PaginationProps extends ViewProps {\n  page?: number\n  defaultPage?: number\n  pageCount?: number\n  onPageChange?: (page: number) => void\n  disabled?: boolean\n  className?: string\n}\ninterface PageContext {\n  page: number\n  count: number\n  disabled: boolean\n  go: (page: number) => void\n}\nconst Context = React.createContext<PageContext | null>(null)\nfunction usePage() {\n  const context = React.useContext(Context)\n  if (!context) throw new Error('Pagination parts must be inside Pagination')\n  return context\n}\nfunction clamp(page: number, count: number) {\n  return count ? Math.max(1, Math.min(count, Number.isFinite(page) ? Math.trunc(page) : 1)) : 0\n}\nexport const Pagination = React.forwardRef<React.ComponentRef<typeof View>, PaginationProps>(\n  ({ page, defaultPage = 1, pageCount = 1, onPageChange, disabled = false, className, ...props }, ref) => {\n    const count = Number.isFinite(pageCount) ? Math.max(0, Math.trunc(pageCount)) : 0\n    const [internal, setInternal] = React.useState(() => clamp(defaultPage, count))\n    const current = clamp(page ?? internal, count)\n    React.useEffect(() => {\n      if (page === undefined) setInternal((value) => clamp(value, count))\n    }, [count, page])\n    return (\n      <Context.Provider\n        value={{\n          page: current,\n          count,\n          disabled,\n          go: (next) => {\n            if (disabled || !count) return\n            const target = clamp(next, count)\n            if (target === current) return\n            if (page === undefined) setInternal(target)\n            onPageChange?.(target)\n          },\n        }}\n      >\n        <View\n          {...props}\n          ref={ref}\n          className={cn('flex-row flex-wrap items-center justify-center gap-[8px]', className)}\n        />\n      </Context.Provider>\n    )\n  },\n)\nPagination.displayName = 'Pagination'\nexport const PaginationPrevious = React.forwardRef<React.ComponentRef<typeof Pressable>, ButtonProps>(\n  ({ children = 'Previous', disabled, onPress, ...props }, ref) => {\n    const page = usePage()\n    const isDisabled = page.disabled || !!disabled || page.page <= 1\n    return (\n      <Button\n        variant=\"outline\"\n        {...props}\n        ref={ref}\n        disabled={isDisabled}\n        onPress={(event) => {\n          if (isDisabled) return\n          onPress?.(event)\n          if (!event.isDefaultPrevented()) page.go(page.page - 1)\n        }}\n      >\n        {children}\n      </Button>\n    )\n  },\n)\nPaginationPrevious.displayName = 'PaginationPrevious'\nexport const PaginationNext = React.forwardRef<React.ComponentRef<typeof Pressable>, ButtonProps>(\n  ({ children = 'Next', disabled, onPress, ...props }, ref) => {\n    const page = usePage()\n    const isDisabled = page.disabled || !!disabled || page.page >= page.count || !page.count\n    return (\n      <Button\n        variant=\"outline\"\n        {...props}\n        ref={ref}\n        disabled={isDisabled}\n        onPress={(event) => {\n          if (isDisabled) return\n          onPress?.(event)\n          if (!event.isDefaultPrevented()) page.go(page.page + 1)\n        }}\n      >\n        {children}\n      </Button>\n    )\n  },\n)\nPaginationNext.displayName = 'PaginationNext'\nexport interface PaginationPageProps extends ButtonProps {\n  page: number\n}\nexport const PaginationPage = React.forwardRef<React.ComponentRef<typeof Pressable>, PaginationPageProps>(\n  ({ page: destination, children, disabled, onPress, accessibilityState, ...props }, ref) => {\n    const page = usePage()\n    const selected = destination === page.page\n    const isDisabled =\n      page.disabled || !!disabled || !Number.isInteger(destination) || destination < 1 || destination > page.count\n    return (\n      <Button\n        variant={selected ? 'default' : 'outline'}\n        {...props}\n        ref={ref}\n        accessibilityLabel={props.accessibilityLabel ?? 'Page ' + destination}\n        accessibilityState={{ ...accessibilityState, selected }}\n        disabled={isDisabled}\n        onPress={(event) => {\n          if (isDisabled) return\n          onPress?.(event)\n          if (!event.isDefaultPrevented()) page.go(destination)\n        }}\n      >\n        {children ?? String(destination)}\n      </Button>\n    )\n  },\n)\nPaginationPage.displayName = 'PaginationPage'\nexport const PaginationStatus = React.forwardRef<React.ComponentRef<typeof Text>, TextProps>(\n  ({ children, ...props }, ref) => {\n    const page = usePage()\n    return (\n      <Text {...props} ref={ref}>\n        {children ?? (page.count ? 'Page ' + page.page + ' of ' + page.count : 'No pages')}\n      </Text>\n    )\n  },\n)\nPaginationStatus.displayName = 'PaginationStatus'\n",
      "type": "registry:ui",
      "target": "~/components/ui/pagination/Pagination.tsx"
    },
    {
      "path": "packages/registry-native/components/pagination/index.ts",
      "content": "export * from './Pagination'\n",
      "type": "registry:ui",
      "target": "~/components/ui/pagination/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Bounded page navigation with controlled state and consumer-composed buttons."
}