{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "The list footer: a summary line and previous / next page buttons. With `numbered` it shows page numbers (1 … 4 5 6 … 21), with `moreLabel` a \"Load more\" button. The current page is a plain element marked aria-current=\"page\"; the others are buttons, or links with `pageUrl` (the ad",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Source: packages/compose-gen/specs/parts/pager.json\n\npackage blocks\n\nimport (\n\t\"github.com/ui8kit/codegen/generated/templ/ui/box\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/button\"\n\t\"github.com/ui8kit/codegen/generated/templ/compose\"\n\t\"github.com/ui8kit/codegen/generated/templ/icons\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/text\"\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/orgutils\"\n)\n\n// PagerProps are the props of Pager; the values are the JSON shapes of the TypeScript props.\ntype PagerProps struct {\n\tPage any `json:\"page\"`\n\tPages any `json:\"pages\"`\n\tSummary any `json:\"summary\"`\n\tPreviousLabel any `json:\"previousLabel\"`\n\tNextLabel any `json:\"nextLabel\"`\n\tNumbered any `json:\"numbered\"`\n\tPageLabel any `json:\"pageLabel\"`\n\tMoreLabel any `json:\"moreLabel\"`\n\tPageUrl any `json:\"pageUrl\"`\n\tFirstUrl any `json:\"firstUrl\"`\n}\n\n// The list footer: a summary line and previous / next page buttons. With `numbered` it shows page numbers (1 … 4 5 6 … 21), with `moreLabel` a \"Load more\" button. The current page is a plain element marked aria-current=\"page\"; the others are buttons, or links with `pageUrl` (the address of page ｛0｝; `firstUrl` for page 1): a disabled previous / next stays a disabled button, without an address. All text comes in through props.\ntempl Pager(p PagerProps) {\n\t{{ vPage := p.Page }}\n\t{{ vPages := p.Pages }}\n\t{{ vSummary := p.Summary }}\n\t{{ vPreviousLabel := p.PreviousLabel }}\n\t{{ vNextLabel := p.NextLabel }}\n\t{{ vNumbered := uiutils.Def(p.Numbered, false) }}\n\t{{ vPageLabel := p.PageLabel }}\n\t{{ vMoreLabel := p.MoreLabel }}\n\t{{ vPageUrl := p.PageUrl }}\n\t{{ vFirstUrl := p.FirstUrl }}\n\t{{ vNumbers := any(uiutils.PageWindow(vPage, vPages)) }}\n\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"flex flex-wrap items-center justify-between gap-4 text-xs font-semibold text-muted-foreground\", Attrs: uiutils.Attrs(\"data-slot\", \"pager\")}}) {\n\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: \"flex flex-wrap items-center gap-4\"}}) {\n\t\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{}}) {\n\t\t\t\t{ uiutils.Text(vSummary) }\n\t\t\t}\n\t\t}\n\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: \"flex flex-wrap items-center gap-2\"}}) {\n\t\t\tif uiutils.T(uiutils.And(vMoreLabel, uiutils.Lt(vPage, vPages))) {\n\t\t\t\t@compose.Button(compose.ButtonProps{Variant: \"outline\", Size: \"sm\", ButtonProps: button.ButtonProps{Type: \"button\"}}) {\n\t\t\t\t\t{ uiutils.Text(vMoreLabel) }\n\t\t\t\t}\n\t\t\t}\n\t\t\t@compose.Button(compose.ButtonProps{Variant: \"outline\", Size: \"sm\", Layout: \"icon\", ButtonProps: button.ButtonProps{AriaLabel: uiutils.S(vPreviousLabel), Disabled: uiutils.T(uiutils.Le(vPage, float64(1))), Href: uiutils.URL(uiutils.Cond(uiutils.T(uiutils.Le(vPage, float64(1))), nil, uiutils.Cond(uiutils.T(vPageUrl), uiutils.Cond(uiutils.T(uiutils.And(uiutils.Eq(uiutils.Sub(vPage, float64(1)), float64(1)), vFirstUrl)), vFirstUrl, uiutils.Tpl(vPageUrl, uiutils.Sub(vPage, float64(1)))), nil)), false)}}) {\n\t\t\t\t@icons.LucideIcon(icons.LucideIconProps{Name: \"chevron-left\", Size: 16})\n\t\t\t}\n\t\t\tif uiutils.T(vNumbered) {\n\t\t\t\tfor _, vN := range uiutils.L(vNumbers) {\n\t\t\t\t\tif uiutils.Eq(vN, nil) {\n\t\t\t\t\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: \"w-8 text-center\", Attrs: uiutils.Attrs(\"data-slot\", \"numbers-row\")}}) {\n\t\t\t\t\t\t\t{ uiutils.Text(\"…\") }\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if uiutils.Eq(vN, vPage) {\n\t\t\t\t\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: \"flex h-8 min-w-8 items-center justify-center rounded bg-foreground px-2 font-bold text-background\", Attrs: uiutils.Attrs(\"aria-current\", \"page\", \"data-slot\", \"pager-current\")}}) {\n\t\t\t\t\t\t\t{ uiutils.Text(vN) }\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t@compose.Button(compose.ButtonProps{Variant: \"ghost\", Size: \"sm\", Layout: \"icon\", ButtonProps: button.ButtonProps{Type: uiutils.S(uiutils.Cond(uiutils.T(vPageUrl), nil, \"button\")), AriaLabel: uiutils.S(uiutils.Tpl(vPageLabel, vN)), Href: uiutils.URL(uiutils.Cond(uiutils.T(vPageUrl), uiutils.Cond(uiutils.T(uiutils.And(uiutils.Eq(vN, float64(1)), vFirstUrl)), vFirstUrl, uiutils.Tpl(vPageUrl, vN)), nil), false)}}) {\n\t\t\t\t\t\t\t{ uiutils.Text(vN) }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: \"min-w-12 text-center font-bold text-foreground\"}}) {\n\t\t\t\t\t{ uiutils.Text(vPage) }\n\t\t\t\t\t{ uiutils.Text(\" / \") }\n\t\t\t\t\t{ uiutils.Text(vPages) }\n\t\t\t\t}\n\t\t\t}\n\t\t\t@compose.Button(compose.ButtonProps{Variant: \"outline\", Size: \"sm\", Layout: \"icon\", ButtonProps: button.ButtonProps{AriaLabel: uiutils.S(vNextLabel), Disabled: uiutils.T(uiutils.Ge(vPage, vPages)), Href: uiutils.URL(uiutils.Cond(uiutils.T(uiutils.Ge(vPage, vPages)), nil, uiutils.Cond(uiutils.T(vPageUrl), uiutils.Cond(uiutils.T(uiutils.And(uiutils.Eq(uiutils.Add(vPage, float64(1)), float64(1)), vFirstUrl)), vFirstUrl, uiutils.Tpl(vPageUrl, uiutils.Add(vPage, float64(1)))), nil)), false)}}) {\n\t\t\t\t@icons.LucideIcon(icons.LucideIconProps{Name: \"chevron-right\", Size: 16})\n\t\t\t}\n\t\t}\n\t}\n}\n",
      "path": "blocks/pager.templ",
      "target": "blocks/pager.templ"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "templ",
      "component"
    ]
  },
  "name": "pager",
  "registryDependencies": [
    "box",
    "button",
    "inline",
    "kit-box",
    "kit-button",
    "kit-text",
    "lucide-icon",
    "utils"
  ],
  "runtime": "templ",
  "title": "Pager",
  "type": "registry:component"
}
