UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

24 lines (23 loc) 1.23 kB
import { jsx as i } from "react/jsx-runtime"; import { u as f, P as m, a as P, i as a, d as r, g as p, h as x, e as C, f as I, b as v, c as E } from "./ButtonPagination-NOYlcyA8.mjs"; import { useSpeziContext as L } from "./SpeziProvider.js"; const S = ({ total: e, page: t, getHref: o, showControls: l = !0, ...h }) => { const { router: { Link: s } } = L(), { activePage: c, range: u } = f({ total: e, page: t, showControls: l, ...h }); return /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(P, { children: u.map((n, d) => n === a.PREV ? t === 1 ? null : /* @__PURE__ */ i(r, { children: /* @__PURE__ */ i(p, { asChild: !0, children: /* @__PURE__ */ i(s, { href: o(c - 1), children: /* @__PURE__ */ i(x, {}) }) }) }, n) : n === a.NEXT ? t === e ? null : /* @__PURE__ */ i(r, { children: /* @__PURE__ */ i(C, { asChild: !0, children: /* @__PURE__ */ i(s, { href: o(c + 1), children: /* @__PURE__ */ i(I, {}) }) }) }, n) : n === a.DOTS ? /* @__PURE__ */ i(r, { children: /* @__PURE__ */ i(v, {}) }, `${n}-${d}`) : /* @__PURE__ */ i(r, { children: /* @__PURE__ */ i(E, { isActive: n === t, children: /* @__PURE__ */ i(s, { href: o(n), children: n }) }) }, n)) }) }); }; export { S as L };