{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pagination",
  "title": "Pagination",
  "description": "Page keys with previous, next and ellipses, and a position readout.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/pagination.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  Pagination as SdkPagination,\n  PaginationEllipsis,\n  PaginationItem,\n  PaginationLink,\n  PaginationList,\n  PaginationNext,\n  PaginationPrevious,\n} from \"@ui-sdk/react/pagination\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport \"@/registry/cyber/ui/cyber/pagination.css\"\n\nconst two = (n: number) => String(n).padStart(2, \"0\")\n\n// \"PAGE 03 / 12\". The padded figures are for the eye; assistive technology\n// gets \"Page 3 of 12\", politely, each time it changes, since a link that\n// becomes current isn't announced on its own. The figure slips for a moment\n// as it steps, but not as the page loads.\nfunction Readout({ page, pageCount }: { page: number; pageCount: number }) {\n  const first = React.useRef(page)\n  const [stepped, setStepped] = React.useState(false)\n  React.useEffect(() => {\n    if (page !== first.current) setStepped(true)\n  }, [page])\n  return (\n    <p data-kit=\"pagination-readout\" role=\"status\">\n      <span data-sr-only>\n        Page {page} of {pageCount}\n      </span>\n      <span aria-hidden>\n        PAGE{\" \"}\n        <b key={page} data-kit=\"pagination-page\" data-stepped={stepped ? \"\" : undefined}>\n          {two(page)}\n        </b>{\" \"}\n        / {two(pageCount)}\n      </span>\n    </p>\n  )\n}\n\n// The pages of a long list as one strip of keys: previous, the pages with\n// gaps where they're skipped, next. The current page is lit and underlined\n// in the signal color, and a readout beside the strip says where you are.\n//\n// - `label` names the navigation: \"Contract pages\", not \"Pagination\".\n// - Pass `pageCount`, or `total` and `pageSize`. `siblings` and `boundaries`\n//   set how many pages show around the current one and at each end.\n// - With `getHref` the keys are links; without it, buttons.\n//\n// The rest goes to ui-sdk's Pagination: `page`, `defaultPage`,\n// `onPageChange`, `controller`.\nfunction Pagination({\n  label,\n  readout = true,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkPagination>, \"children\" | \"aria-label\"> & {\n  label: string\n  /** Whether to print \"PAGE 03 / 12\" beside the strip. */\n  readout?: boolean\n}) {\n  return (\n    <SdkPagination data-kit=\"pagination\" aria-label={label} {...props}>\n      {({ page, pageCount, items }) => (\n        <>\n          <PaginationList data-kit=\"pagination-list\">\n            <PaginationItem data-kit=\"pagination-item\">\n              <PaginationPrevious data-kit=\"pagination-step\" data-frame=\"bl\" data-press-flash=\"\" data-sfx=\"tick\" aria-label=\"Previous page\">\n                <ChevronLeft data-kit=\"pagination-chevron\" aria-hidden />\n              </PaginationPrevious>\n            </PaginationItem>\n            {/* Keyed by the entry itself, so a page keeps its element, and\n                its focus, as the range moves around it. */}\n            {items.map((item) =>\n              typeof item === \"number\" ? (\n                <PaginationItem key={item} data-kit=\"pagination-item\">\n                  <PaginationLink data-kit=\"pagination-link\" data-frame=\"mid\" data-press-flash=\"\" data-sfx=\"select\" page={item} />\n                </PaginationItem>\n              ) : (\n                <PaginationItem key={item} data-kit=\"pagination-item\" data-gap=\"\">\n                  <PaginationEllipsis data-kit=\"pagination-gap\" />\n                </PaginationItem>\n              ),\n            )}\n            <PaginationItem data-kit=\"pagination-item\">\n              <PaginationNext data-kit=\"pagination-step\" data-frame=\"br\" data-press-flash=\"\" data-sfx=\"tick\" aria-label=\"Next page\">\n                <ChevronRight data-kit=\"pagination-chevron\" aria-hidden />\n              </PaginationNext>\n            </PaginationItem>\n          </PaginationList>\n          {readout && <Readout page={page} pageCount={pageCount} />}\n        </>\n      )}\n    </SdkPagination>\n  )\n}\n\nexport { Pagination }\n",
      "type": "registry:ui",
      "target": "@ui/pagination.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/pagination.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* The strip, then the readout. Side by side while there's room; the\n     readout drops under the strip when there isn't. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination\"] {\n    display: inline-flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 6px 14px;\n    max-width: 100%;\n    min-width: 0;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"pagination-list\"] {\n    display: flex;\n    min-width: 0;\n    max-width: 100%;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n    /* The cells restack as they light, and that stays inside the strip. */\n    isolation: isolate;\n  }\n\n  /* Each cell is a square that gives up width before the strip overflows:\n     nine cells still fit a phone, and stay taller than they are narrow. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination-item\"] {\n    position: relative;\n    flex: 0 1 var(--cy-h);\n    min-width: 26px;\n    display: grid;\n\n    /* Neighbours share one line, and it belongs to whichever is hot: the\n       current page comes forward, the one under the pointer or the keyboard\n       further still, and a dead step drops back. */\n    & + & {\n      margin-inline-start: -1px;\n    }\n    &:has([data-current]) {\n      z-index: 1;\n    }\n    &:has(:hover, :active, :focus-visible) {\n      z-index: 2;\n    }\n    &:has([data-disabled]),\n    &[data-gap] {\n      z-index: -1;\n    }\n  }\n\n  /* A page, or a step: the kit's key states.\n       idle     line 70%, no fill\n       hover    line 100%, fill 10%\n       current  line 100%, fill 40%, bright ink, a signal bar along its foot\n       down     a flash to 70% as it lands (data-press-flash) */\n  [data-skin=\"cyber\"] :is([data-kit=\"pagination-link\"], [data-kit=\"pagination-step\"]) {\n    --frame-cut: var(--cy-cut-sm);\n    --frame-line: var(--cy-line-ctl);\n    --frame-fill: var(--cy-panel-a);\n\n    display: grid;\n    place-items: center;\n    min-width: 0;\n    height: var(--cy-h);\n    padding: 0;\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-sm);\n    font-weight: 500;\n    line-height: 1;\n    text-decoration: none;\n    color: var(--cy-ink);\n    cursor: pointer;\n    user-select: none;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      border-color var(--cy-t-fast) linear,\n      color var(--cy-t-fast) linear;\n\n    @media (hover: hover) {\n      &:hover:not([data-disabled], [data-current]) {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-hover);\n      }\n    }\n\n    &:active:not([data-disabled]) {\n      --frame-line: var(--cy-line-hot);\n      --frame-fill: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n    }\n  }\n\n  /* Where you are: lit, and marked with a bar in the signal color along its\n     foot, drawn under the frame's edges so it's cut with them. Pressing it\n     goes nowhere, so it doesn't ask to be pressed. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination-link\"][data-current] {\n    --frame-line: var(--cy-line-hot);\n    --frame-fill: var(--cy-fill-active);\n    --frame-image: linear-gradient(to top, var(--cy-signal) 3px, transparent 3px);\n    font-weight: 700;\n    color: var(--cy-ink-hi);\n    cursor: default;\n  }\n\n  /* A step at the end it goes to: hatched. It stays focusable, and says\n     it's unavailable. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination-step\"][data-disabled] {\n    --frame-line: var(--cy-line-deco);\n    --frame-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--cy-line-deco) 5px 6px);\n    color: var(--cy-ink-mute);\n    cursor: not-allowed;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"pagination-chevron\"] {\n    width: 16px;\n    height: 16px;\n\n    &:dir(rtl) {\n      scale: -1 1;\n    }\n  }\n\n  /* Pages skipped: not a key, so it has no sides of its own. Its top and\n     bottom rules bridge the keys either side of it. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination-gap\"] {\n    display: grid;\n    place-items: center;\n    height: var(--cy-h);\n    border-block: 1px solid var(--cy-line-deco);\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-sm);\n    line-height: 1;\n    color: var(--cy-ink-mute);\n    user-select: none;\n  }\n\n  /* PAGE 03 / 12: a readout, so it's in the signal color. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination-readout\"] {\n    flex: none;\n    margin: 0;\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    line-height: 1;\n    letter-spacing: 0.04em;\n    white-space: nowrap;\n    color: var(--cy-signal);\n  }\n\n  /* The current figure, a weight heavier. Its channels slip apart for a\n     moment each time it steps. */\n  [data-skin=\"cyber\"] [data-kit=\"pagination-page\"] {\n    display: inline-block;\n    font-weight: 700;\n\n    &[data-stepped] {\n      animation: var(--cy-fx-rgb) 260ms var(--cy-ease-snap);\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/pagination.css"
    }
  ],
  "type": "registry:ui"
}
