UNPKG

@ea-lab/reactive-json

Version:

A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.

31 lines (30 loc) 780 B
import { jsxs as m } from "react/jsx-runtime"; import { useReducer as u } from "react"; import { PaginationContext as s } from "./PaginationContext.js"; const h = (t) => { const { after: i, before: o, contentToPaginate: e, pagination: n } = t; e.length; const a = t != null && t.paginated ? e.slice(n.firstShownItemIndex, n.maxShownItemIndexExcluded) : e, [l, c] = u((r, d) => { switch (d.type) { case "increment": return r + 1; case "decrement": return r - 1; default: return r; } }, { updateId: 0, realCurrentData: {} }); return /* @__PURE__ */ m(s.Provider, { value: { dispatchItemCountAdjustment: c, pagination: n }, children: [ o, a, i ] }); }; export { h as PaginationProvider };