UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

38 lines (37 loc) 869 B
"use client"; import { useState as v, useCallback as V } from "react"; const b = (r, n) => { switch (n) { case 1: return [n + 1, n + 2, n + 3]; case 2: return [n, n + 1, n + 2]; case r: return [n - 3, n - 2, n - 1]; case r - 1: return [n - 2, n - 1, n]; default: return [n - 1, n, n + 1]; } }, p = (r, n) => { const [i, t] = v(n), o = 1, c = r, s = b(r, i), f = i + 1 <= r ? i + 1 : 1, S = i - 1 >= 1 ? i - 1 : r, h = r > 7, x = r.toString().length + 1, k = V( (u) => u === null ? !0 : u >= 1 && u <= r, [r] ); return { first: o, last: c, visible: s, setSelectedPage: t, selectedPage: i, nextPage: f, previousPage: S, isLong: h, maxDigits: x, checkValidity: k }; }; export { p as usePagePaginationState }; //# sourceMappingURL=usePagePaginationState.js.map