react-pagination-new
Version:
A simple and customizable pagination component for React applications.
297 lines (296 loc) • 9.33 kB
JavaScript
import re from "react";
var T = { exports: {} }, b = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var I;
function te() {
if (I) return b;
I = 1;
var c = Symbol.for("react.transitional.element"), d = Symbol.for("react.fragment");
function i(f, n, s) {
var E = null;
if (s !== void 0 && (E = "" + s), n.key !== void 0 && (E = "" + n.key), "key" in n) {
s = {};
for (var R in n)
R !== "key" && (s[R] = n[R]);
} else s = n;
return n = s.ref, {
$$typeof: c,
type: f,
key: E,
ref: n !== void 0 ? n : null,
props: s
};
}
return b.Fragment = d, b.jsx = i, b.jsxs = i, b;
}
var _ = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var F;
function ne() {
return F || (F = 1, process.env.NODE_ENV !== "production" && function() {
function c(e) {
if (e == null) return null;
if (typeof e == "function")
return e.$$typeof === Q ? null : e.displayName || e.name || null;
if (typeof e == "string") return e;
switch (e) {
case p:
return "Fragment";
case J:
return "Profiler";
case q:
return "StrictMode";
case X:
return "Suspense";
case B:
return "SuspenseList";
case Z:
return "Activity";
}
if (typeof e == "object")
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case U:
return "Portal";
case V:
return (e.displayName || "Context") + ".Provider";
case z:
return (e._context.displayName || "Context") + ".Consumer";
case G:
var r = e.render;
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case H:
return r = e.displayName || null, r !== null ? r : c(e.type) || "Memo";
case w:
r = e._payload, e = e._init;
try {
return c(e(r));
} catch {
}
}
return null;
}
function d(e) {
return "" + e;
}
function i(e) {
try {
d(e);
var r = !1;
} catch {
r = !0;
}
if (r) {
r = console;
var t = r.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t.call(
r,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
a
), d(e);
}
}
function f(e) {
if (e === p) return "<>";
if (typeof e == "object" && e !== null && e.$$typeof === w)
return "<...>";
try {
var r = c(e);
return r ? "<" + r + ">" : "<...>";
} catch {
return "<...>";
}
}
function n() {
var e = k.A;
return e === null ? null : e.getOwner();
}
function s() {
return Error("react-stack-top-frame");
}
function E(e) {
if (h.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning) return !1;
}
return e.key !== void 0;
}
function R(e, r) {
function t() {
N || (N = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
r
));
}
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
function M() {
var e = c(this.type);
return y[e] || (y[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function W(e, r, t, a, l, u, A, P) {
return t = u.ref, e = {
$$typeof: x,
type: e,
key: r,
props: u,
_owner: l
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: M
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(e, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: A
}), Object.defineProperty(e, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: P
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
function g(e, r, t, a, l, u, A, P) {
var o = r.children;
if (o !== void 0)
if (a)
if (K(o)) {
for (a = 0; a < o.length; a++)
j(o[a]);
Object.freeze && Object.freeze(o);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else j(o);
if (h.call(r, "key")) {
o = c(e);
var m = Object.keys(r).filter(function(ee) {
return ee !== "key";
});
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", $[o + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
a,
o,
m,
o
), $[o + a] = !0);
}
if (o = null, t !== void 0 && (i(t), o = "" + t), E(r) && (i(r.key), o = "" + r.key), "key" in r) {
t = {};
for (var S in r)
S !== "key" && (t[S] = r[S]);
} else t = r;
return o && R(
t,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), W(
e,
o,
u,
l,
n(),
t,
A,
P
);
}
function j(e) {
typeof e == "object" && e !== null && e.$$typeof === x && e._store && (e._store.validated = 1);
}
var v = re, x = Symbol.for("react.transitional.element"), U = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), V = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), Q = Symbol.for("react.client.reference"), k = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, h = Object.prototype.hasOwnProperty, K = Array.isArray, O = console.createTask ? console.createTask : function() {
return null;
};
v = {
"react-stack-bottom-frame": function(e) {
return e();
}
};
var N, y = {}, C = v["react-stack-bottom-frame"].bind(
v,
s
)(), Y = O(f(s)), $ = {};
_.Fragment = p, _.jsx = function(e, r, t, a, l) {
var u = 1e4 > k.recentlyCreatedOwnerStacks++;
return g(
e,
r,
t,
!1,
a,
l,
u ? Error("react-stack-top-frame") : C,
u ? O(f(e)) : Y
);
}, _.jsxs = function(e, r, t, a, l) {
var u = 1e4 > k.recentlyCreatedOwnerStacks++;
return g(
e,
r,
t,
!0,
a,
l,
u ? Error("react-stack-top-frame") : C,
u ? O(f(e)) : Y
);
};
}()), _;
}
var D;
function ae() {
return D || (D = 1, process.env.NODE_ENV === "production" ? T.exports = te() : T.exports = ne()), T.exports;
}
var L = ae();
const se = ({ totalPages: c, currentPage: d, onPageChange: i }) => {
const f = Array.from({ length: c }, (n, s) => s + 1);
return /* @__PURE__ */ L.jsx("div", { className: "pagination", children: f.map((n) => /* @__PURE__ */ L.jsx(
"button",
{
className: `page-button ${n === d ? "active" : ""}`,
onClick: () => i(n),
children: n
},
n
)) });
};
export {
se as default
};