@adyen/adyen-platform-experience-web
Version:

23 lines (22 loc) • 826 B
JavaScript
import { useMemo as g } from "../../../../external/preact/hooks/dist/hooks.module.js";
import m from "./usePagination.js";
import { isString as i, isUndefined as a } from "../../../../utils/value/is.js";
const C = (o) => i(o.next), h = (o) => i(o.prev), S = (o, u) => {
const c = g(() => {
const e = [], P = () => e.length, d = () => {
e.length = 0;
}, f = (t) => ({ cursor: e[t - 1] }), s = (t, r) => {
const n = e[r - 1];
(r === 1 || r === (e.length || 1) + 1) && a(n) && (e[r - 1] = t ? decodeURIComponent(t) : void 0);
};
return { getPageCount: P, getPageParams: f, resetPageCount: d, updatePagination: (t, r, n) => {
C(n) && s(n.next, t + 1), h(n) && s(n.prev, t - 1);
} };
}, []);
return m(c, o, u);
};
export {
S as default,
C as hasNextPage,
h as hasPrevPage
};