{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Pager component",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->\n<!--\n  The list footer: a summary line and previous / next page buttons. With `numbered` it shows page numbers (1 … 4\n  5 6 … 21), with `moreLabel` a \"Load more\" button. The current page is a plain element marked\n  aria-current=\"page\"; the others are buttons, or links with `pageUrl` (the address of page ｛0｝; `firstUrl` for\n  page 1): a disabled previous / next stays a disabled button, without an address. All text comes in through\n  props.\n-->\n<script lang=\"ts\">\nexport type PagerProps = {\n  page: number;\n  pages: number;\n  summary: string;\n  previousLabel: string;\n  nextLabel: string;\n  numbered?: boolean;\n  pageLabel?: string;\n  moreLabel?: string;\n  pageUrl?: string;\n  firstUrl?: string;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport Box from \"../compose/Box.vue\";\nimport Button from \"../compose/Button.vue\";\nimport Inline from \"../compose/Inline.vue\";\nimport LucideIcon from \"../icons/LucideIcon.vue\";\nimport { pageWindow, tpl, urlOf } from \"../utils\";\n\nconst {\n  page,\n  pages,\n  summary,\n  previousLabel,\n  nextLabel,\n  numbered = false,\n  pageLabel,\n  moreLabel,\n  pageUrl,\n  firstUrl,\n} = defineProps<PagerProps>();\nconst emit = defineEmits<{ page: [page: number], more: [] }>();\nconst numbers = computed(() => pageWindow(page, pages));\n</script>\n\n<template>\n  <Box\n    :class=\"'flex flex-wrap items-center justify-between gap-4 text-xs font-semibold text-muted-foreground'\"\n    data-slot=\"pager\"\n  >\n    <Inline class=\"flex flex-wrap items-center gap-4\">\n      <Inline>\n        {{ summary }}\n      </Inline>\n    </Inline>\n    <Inline class=\"flex flex-wrap items-center gap-2\">\n      <Button\n        v-if=\"(moreLabel && (page < pages))\"\n        variant=\"outline\"\n        size=\"sm\"\n        type=\"button\"\n        @click=\"() => emit('more')\"\n      >\n        {{ moreLabel }}\n      </Button>\n      <Button\n        variant=\"outline\"\n        size=\"sm\"\n        layout=\"icon\"\n        :aria-label=\"previousLabel\"\n        :disabled=\"(page <= 1)\"\n        :href=\"urlOf(((page <= 1) ? undefined : (pageUrl ? ((((page - 1) === 1) && firstUrl) ? firstUrl : tpl(pageUrl, (page - 1))) : undefined)))\"\n        @click=\"() => emit('page', (page - 1))\"\n      >\n        <LucideIcon name=\"chevron-left\" :size=\"16\" />\n      </Button>\n      <template v-if=\"numbered\">\n        <template v-for=\"(n, i) in numbers\" :key=\"(n || tpl('gap{0}', i))\">\n          <Inline v-if=\"(n === null)\" class=\"w-8 text-center\" data-slot=\"numbers-row\">\n            {{ \"…\" }}\n          </Inline>\n          <Inline v-else-if=\"(n === page)\"\n            :class=\"'flex h-8 min-w-8 items-center justify-center rounded bg-foreground px-2 font-bold text-background'\"\n            aria-current=\"page\"\n            data-slot=\"pager-current\"\n          >\n            {{ n }}\n          </Inline>\n          <Button v-else\n            variant=\"ghost\"\n            size=\"sm\"\n            layout=\"icon\"\n            :type=\"(pageUrl ? undefined : 'button')\"\n            :aria-label=\"tpl(pageLabel, n)\"\n            :href=\"urlOf((pageUrl ? (((n === 1) && firstUrl) ? firstUrl : tpl(pageUrl, n)) : undefined))\"\n            @click=\"() => emit('page', n)\"\n          >\n            {{ n }}\n          </Button>\n        </template>\n      </template>\n      <Inline v-else class=\"min-w-12 text-center font-bold text-foreground\">\n        {{ page }}\n        {{ \" / \" }}\n        {{ pages }}\n      </Inline>\n      <Button\n        variant=\"outline\"\n        size=\"sm\"\n        layout=\"icon\"\n        :aria-label=\"nextLabel\"\n        :disabled=\"(page >= pages)\"\n        :href=\"urlOf(((page >= pages) ? undefined : (pageUrl ? ((((page + 1) === 1) && firstUrl) ? firstUrl : tpl(pageUrl, (page + 1))) : undefined)))\"\n        @click=\"() => emit('page', (page + 1))\"\n      >\n        <LucideIcon name=\"chevron-right\" :size=\"16\" />\n      </Button>\n    </Inline>\n  </Box>\n</template>\n",
      "path": "components/pager.vue",
      "target": "components/pager.vue"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "vue",
      "component"
    ]
  },
  "name": "pager",
  "registryDependencies": [
    "box",
    "button",
    "inline",
    "lucide-icon",
    "utils"
  ],
  "runtime": "vue",
  "title": "Pager",
  "type": "registry:component"
}
