{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "page-nav",
  "type": "registry:item",
  "title": "Page Nav",
  "description": "Pagination: previous and next, the first and last page, and the pages around the current one, with gaps shown as \"…\". The current page is marked `aria-current=\"page\"`. `page` is two-way.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "navigation"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/page-nav.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/page-nav.js",
      "content": "// Generated by zubra from page-nav.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"page-nav\";\n\nexport default $define(tag, {\n  props: {\n    \"page\": { attribute: \"page\", default: 1, required: false, model: true },\n    \"pages\": { attribute: \"pages\", default: 1, required: false },\n    \"siblings\": { attribute: \"siblings\", default: 1, required: false },\n    \"label\": { attribute: \"label\", default: \"Pages\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [],\n  events: [\"pagechange\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (page-nav) to ([data-zb-slotted=\\\"page-nav\\\"]) {\\n  :scope { display: block; }\\n  ul { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }\\n  button { min-width: 2.25rem; height: 2.25rem; padding: 0 0.6rem; border: 1px solid transparent; border-radius: calc(var(--radius, 0.625rem) * 0.8); background: none; color: var(--foreground, #18181b); font: inherit; font-size: 0.9rem; cursor: pointer; transition: background var(--duration-fast, 150ms); }\\n  button:hover:not(:disabled) { background: var(--accent, #f4f4f5); }\\n  button:focus-visible { outline: 2px solid var(--ring, #a1a1aa); outline-offset: 2px; }\\n  button[aria-current=page] { border-color: var(--border, #e4e4e7); background: var(--background, #fff); font-weight: 700; }\\n  button:disabled { opacity: 0.45; cursor: not-allowed; }\\n  .pages-gap { padding: 0 0.35rem; color: var(--muted-foreground, #71717a); }\\n  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; } }\\n}\\n}\\n\",\n  template: \"\\n  <nav>\\n    <ul>\\n      <li><button type=\\\"button\\\">‹ Previous</button></li>\\n      <!--[--><!--]-->\\n      <li><button type=\\\"button\\\">Next ›</button></li>\\n    </ul>\\n  </nav>\\n\",\n  setup($p, $emit) {\n  // 1 … 4 5 [6] 7 8 … 20: the first, the last, and `siblings` either side of the current page.\n  // (A function given the props, so the derived list follows them.)\n  function around(current, total, near) {\n    const list = []\n    for (let n = 1; n <= Math.max(1, total); n++) {\n      if (n === 1 || n === total || Math.abs(n - current) <= near) list.push(n)\n      else if (list[list.length - 1] !== \"gap\") list.push(\"gap\")\n    }\n    return list.map((n, i) => ({ n, key: n === \"gap\" ? `gap-${i}` : n }))\n  }\n  const shown = __zubraComputed(() => (around($p.page, $p.pages, $p.siblings)))\n\n  function go(n) {\n    const next = Math.min(Math.max(1, n), Math.max(1, $p.pages))\n    if (next === $p.page) return\n    $p.page = next\n  }\n    return [\n      { path: [0], attribute: \"aria-label\", value: () => $p.label },\n      { path: [0, 0, 0, 0], attribute: \"disabled\", boolean: true, value: () => ($p.page <= 1) },\n      { path: [0, 0, 0, 0], on: \"click\", handler: () => (() => go($p.page - 1)) },\n      { path: [0, 0, 1], each: () => $r(shown), key: (item, $index) => $r(item).key, block: { template: \"\\n        <li>\\n          <!--[--><!--]-->\\n        </li>\\n      \", parts: (item, $index) => [{ path: [0, 0], when: () => ($r(item).n === \"gap\"), blocks: [{ template: \"<span class=\\\"pages-gap\\\" aria-hidden=\\\"true\\\">…</span>\", parts: () => [] }, { template: \"<button type=\\\"button\\\"></button>\", parts: () => [{ path: [0], attribute: \"aria-current\", value: () => (($r(item).n === $p.page) ? \"page\" : null) }, { path: [0], attribute: \"aria-label\", value: () => (`Page ${$r(item).n}`) }, { path: [0], on: \"click\", handler: () => (() => go($r(item).n)) }, { path: [0], text: () => $t($r(item).n) }] }] }] } },\n      { path: [0, 0, 2, 0], attribute: \"disabled\", boolean: true, value: () => ($p.page >= $p.pages) },\n      { path: [0, 0, 2, 0], on: \"click\", handler: () => (() => go($p.page + 1)) },\n    ];\n  },\n});\n"
    }
  ]
}
