@starasia/pagination 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # starasia pagination
2
+
3
+ starasia pagination is a strict and customizable pagination component for web development projects, designed for simplicity and adherence to strict design guidelines.
4
+
5
+ ## Screenshots
6
+
7
+ ![App Screenshot](https://github.com/primaramadhaniputra/image/blob/main/IPagination.png)
8
+
9
+ ## Package instalation
10
+
11
+ Instal package using pnpm
12
+
13
+ ```bash
14
+ pnpm add @starasia/pagination
15
+ ```
16
+
17
+ Instal package using yarn
18
+
19
+ ```bash
20
+ yarn add @starasia/pagination
21
+ ```
22
+
23
+ Instal package using npm
24
+
25
+ ```bash
26
+ npm i @starasia/pagination
27
+ ```
28
+
29
+ ## Usage/Examples (you can combine using icon package starasia)
30
+
31
+ ```javascript
32
+ import React from "react";
33
+ import {Pagination} from "@starasia/pagination";
34
+ import ReactDOM from "react-dom/client";
35
+ import {useState} from "react";
36
+
37
+ const App = () => {
38
+ const [currentPage, setCurrentPage] = useState(1);
39
+ return (
40
+ <div>
41
+ <h1>Pagination Progress Component</h1>
42
+ <Pagination
43
+ currentPage={currentPage}
44
+ onPageChange={(e) => setCurrentPage(e)}
45
+ totalCount={100}
46
+ />
47
+ </div>
48
+ );
49
+ };
50
+
51
+ ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
52
+
53
+
54
+ ```
55
+
56
+ ## Props @starasia/pagination
57
+
58
+ #### Props that you can pass to <Pagination {...props} />
59
+
60
+ | Prop Name | Value | required |
61
+ | :----------- | :--------------------- | :------- |
62
+ | totalCount | number | true |
63
+ | siblingCount | number | false |
64
+ | currentPage | number | true |
65
+ | onPageChange | (page: number) => void | true |
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { IPaginationProps } from "./types";
3
+ export declare const Pagination: ({ onPageChange, totalCount, siblingCount, currentPage, size, }: IPaginationProps) => React.JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ export { Pagination } from "./Pagination";
2
+ export * from "./types";
@@ -0,0 +1,893 @@
1
+ import Pa, { useMemo as vr } from "react";
2
+ var ra = { exports: {} }, N = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var Oa;
13
+ function gr() {
14
+ if (Oa)
15
+ return N;
16
+ Oa = 1;
17
+ var m = Pa, c = Symbol.for("react.element"), w = Symbol.for("react.fragment"), v = Object.prototype.hasOwnProperty, f = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, T = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function S(E, u, y) {
19
+ var p, x = {}, R = null, j = null;
20
+ y !== void 0 && (R = "" + y), u.key !== void 0 && (R = "" + u.key), u.ref !== void 0 && (j = u.ref);
21
+ for (p in u)
22
+ v.call(u, p) && !T.hasOwnProperty(p) && (x[p] = u[p]);
23
+ if (E && E.defaultProps)
24
+ for (p in u = E.defaultProps, u)
25
+ x[p] === void 0 && (x[p] = u[p]);
26
+ return { $$typeof: c, type: E, key: R, ref: j, props: x, _owner: f.current };
27
+ }
28
+ return N.Fragment = w, N.jsx = S, N.jsxs = S, N;
29
+ }
30
+ var Y = {};
31
+ /**
32
+ * @license React
33
+ * react-jsx-runtime.development.js
34
+ *
35
+ * Copyright (c) Facebook, Inc. and its affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ */
40
+ var ja;
41
+ function mr() {
42
+ return ja || (ja = 1, process.env.NODE_ENV !== "production" && function() {
43
+ var m = Pa, c = Symbol.for("react.element"), w = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), E = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), ea = Symbol.iterator, ka = "@@iterator";
44
+ function Da(a) {
45
+ if (a === null || typeof a != "object")
46
+ return null;
47
+ var r = ea && a[ea] || a[ka];
48
+ return typeof r == "function" ? r : null;
49
+ }
50
+ var D = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ function g(a) {
52
+ {
53
+ for (var r = arguments.length, e = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
54
+ e[n - 1] = arguments[n];
55
+ Aa("error", a, e);
56
+ }
57
+ }
58
+ function Aa(a, r, e) {
59
+ {
60
+ var n = D.ReactDebugCurrentFrame, o = n.getStackAddendum();
61
+ o !== "" && (r += "%s", e = e.concat([o]));
62
+ var s = e.map(function(i) {
63
+ return String(i);
64
+ });
65
+ s.unshift("Warning: " + r), Function.prototype.apply.call(console[a], console, s);
66
+ }
67
+ }
68
+ var Fa = !1, Ia = !1, $a = !1, Wa = !1, Na = !1, na;
69
+ na = Symbol.for("react.module.reference");
70
+ function Ya(a) {
71
+ return !!(typeof a == "string" || typeof a == "function" || a === v || a === T || Na || a === f || a === y || a === p || Wa || a === j || Fa || Ia || $a || typeof a == "object" && a !== null && (a.$$typeof === R || a.$$typeof === x || a.$$typeof === S || a.$$typeof === E || a.$$typeof === u || // This needs to include all possible module reference object
72
+ // types supported by any Flight configuration anywhere since
73
+ // we don't know which Flight build this will end up being used
74
+ // with.
75
+ a.$$typeof === na || a.getModuleId !== void 0));
76
+ }
77
+ function Ma(a, r, e) {
78
+ var n = a.displayName;
79
+ if (n)
80
+ return n;
81
+ var o = r.displayName || r.name || "";
82
+ return o !== "" ? e + "(" + o + ")" : e;
83
+ }
84
+ function ta(a) {
85
+ return a.displayName || "Context";
86
+ }
87
+ function O(a) {
88
+ if (a == null)
89
+ return null;
90
+ if (typeof a.tag == "number" && g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof a == "function")
91
+ return a.displayName || a.name || null;
92
+ if (typeof a == "string")
93
+ return a;
94
+ switch (a) {
95
+ case v:
96
+ return "Fragment";
97
+ case w:
98
+ return "Portal";
99
+ case T:
100
+ return "Profiler";
101
+ case f:
102
+ return "StrictMode";
103
+ case y:
104
+ return "Suspense";
105
+ case p:
106
+ return "SuspenseList";
107
+ }
108
+ if (typeof a == "object")
109
+ switch (a.$$typeof) {
110
+ case E:
111
+ var r = a;
112
+ return ta(r) + ".Consumer";
113
+ case S:
114
+ var e = a;
115
+ return ta(e._context) + ".Provider";
116
+ case u:
117
+ return Ma(a, a.render, "ForwardRef");
118
+ case x:
119
+ var n = a.displayName || null;
120
+ return n !== null ? n : O(a.type) || "Memo";
121
+ case R: {
122
+ var o = a, s = o._payload, i = o._init;
123
+ try {
124
+ return O(i(s));
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ var C = Object.assign, I = 0, ia, oa, sa, ua, la, ca, fa;
133
+ function da() {
134
+ }
135
+ da.__reactDisabledLog = !0;
136
+ function La() {
137
+ {
138
+ if (I === 0) {
139
+ ia = console.log, oa = console.info, sa = console.warn, ua = console.error, la = console.group, ca = console.groupCollapsed, fa = console.groupEnd;
140
+ var a = {
141
+ configurable: !0,
142
+ enumerable: !0,
143
+ value: da,
144
+ writable: !0
145
+ };
146
+ Object.defineProperties(console, {
147
+ info: a,
148
+ log: a,
149
+ warn: a,
150
+ error: a,
151
+ group: a,
152
+ groupCollapsed: a,
153
+ groupEnd: a
154
+ });
155
+ }
156
+ I++;
157
+ }
158
+ }
159
+ function Ua() {
160
+ {
161
+ if (I--, I === 0) {
162
+ var a = {
163
+ configurable: !0,
164
+ enumerable: !0,
165
+ writable: !0
166
+ };
167
+ Object.defineProperties(console, {
168
+ log: C({}, a, {
169
+ value: ia
170
+ }),
171
+ info: C({}, a, {
172
+ value: oa
173
+ }),
174
+ warn: C({}, a, {
175
+ value: sa
176
+ }),
177
+ error: C({}, a, {
178
+ value: ua
179
+ }),
180
+ group: C({}, a, {
181
+ value: la
182
+ }),
183
+ groupCollapsed: C({}, a, {
184
+ value: ca
185
+ }),
186
+ groupEnd: C({}, a, {
187
+ value: fa
188
+ })
189
+ });
190
+ }
191
+ I < 0 && g("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ }
193
+ }
194
+ var B = D.ReactCurrentDispatcher, J;
195
+ function L(a, r, e) {
196
+ {
197
+ if (J === void 0)
198
+ try {
199
+ throw Error();
200
+ } catch (o) {
201
+ var n = o.stack.trim().match(/\n( *(at )?)/);
202
+ J = n && n[1] || "";
203
+ }
204
+ return `
205
+ ` + J + a;
206
+ }
207
+ }
208
+ var K = !1, U;
209
+ {
210
+ var Va = typeof WeakMap == "function" ? WeakMap : Map;
211
+ U = new Va();
212
+ }
213
+ function pa(a, r) {
214
+ if (!a || K)
215
+ return "";
216
+ {
217
+ var e = U.get(a);
218
+ if (e !== void 0)
219
+ return e;
220
+ }
221
+ var n;
222
+ K = !0;
223
+ var o = Error.prepareStackTrace;
224
+ Error.prepareStackTrace = void 0;
225
+ var s;
226
+ s = B.current, B.current = null, La();
227
+ try {
228
+ if (r) {
229
+ var i = function() {
230
+ throw Error();
231
+ };
232
+ if (Object.defineProperty(i.prototype, "props", {
233
+ set: function() {
234
+ throw Error();
235
+ }
236
+ }), typeof Reflect == "object" && Reflect.construct) {
237
+ try {
238
+ Reflect.construct(i, []);
239
+ } catch (h) {
240
+ n = h;
241
+ }
242
+ Reflect.construct(a, [], i);
243
+ } else {
244
+ try {
245
+ i.call();
246
+ } catch (h) {
247
+ n = h;
248
+ }
249
+ a.call(i.prototype);
250
+ }
251
+ } else {
252
+ try {
253
+ throw Error();
254
+ } catch (h) {
255
+ n = h;
256
+ }
257
+ a();
258
+ }
259
+ } catch (h) {
260
+ if (h && n && typeof h.stack == "string") {
261
+ for (var t = h.stack.split(`
262
+ `), b = n.stack.split(`
263
+ `), l = t.length - 1, d = b.length - 1; l >= 1 && d >= 0 && t[l] !== b[d]; )
264
+ d--;
265
+ for (; l >= 1 && d >= 0; l--, d--)
266
+ if (t[l] !== b[d]) {
267
+ if (l !== 1 || d !== 1)
268
+ do
269
+ if (l--, d--, d < 0 || t[l] !== b[d]) {
270
+ var _ = `
271
+ ` + t[l].replace(" at new ", " at ");
272
+ return a.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", a.displayName)), typeof a == "function" && U.set(a, _), _;
273
+ }
274
+ while (l >= 1 && d >= 0);
275
+ break;
276
+ }
277
+ }
278
+ } finally {
279
+ K = !1, B.current = s, Ua(), Error.prepareStackTrace = o;
280
+ }
281
+ var F = a ? a.displayName || a.name : "", P = F ? L(F) : "";
282
+ return typeof a == "function" && U.set(a, P), P;
283
+ }
284
+ function qa(a, r, e) {
285
+ return pa(a, !1);
286
+ }
287
+ function za(a) {
288
+ var r = a.prototype;
289
+ return !!(r && r.isReactComponent);
290
+ }
291
+ function V(a, r, e) {
292
+ if (a == null)
293
+ return "";
294
+ if (typeof a == "function")
295
+ return pa(a, za(a));
296
+ if (typeof a == "string")
297
+ return L(a);
298
+ switch (a) {
299
+ case y:
300
+ return L("Suspense");
301
+ case p:
302
+ return L("SuspenseList");
303
+ }
304
+ if (typeof a == "object")
305
+ switch (a.$$typeof) {
306
+ case u:
307
+ return qa(a.render);
308
+ case x:
309
+ return V(a.type, r, e);
310
+ case R: {
311
+ var n = a, o = n._payload, s = n._init;
312
+ try {
313
+ return V(s(o), r, e);
314
+ } catch {
315
+ }
316
+ }
317
+ }
318
+ return "";
319
+ }
320
+ var $ = Object.prototype.hasOwnProperty, va = {}, ga = D.ReactDebugCurrentFrame;
321
+ function q(a) {
322
+ if (a) {
323
+ var r = a._owner, e = V(a.type, a._source, r ? r.type : null);
324
+ ga.setExtraStackFrame(e);
325
+ } else
326
+ ga.setExtraStackFrame(null);
327
+ }
328
+ function Ba(a, r, e, n, o) {
329
+ {
330
+ var s = Function.call.bind($);
331
+ for (var i in a)
332
+ if (s(a, i)) {
333
+ var t = void 0;
334
+ try {
335
+ if (typeof a[i] != "function") {
336
+ var b = Error((n || "React class") + ": " + e + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
+ throw b.name = "Invariant Violation", b;
338
+ }
339
+ t = a[i](r, i, n, e, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ } catch (l) {
341
+ t = l;
342
+ }
343
+ t && !(t instanceof Error) && (q(o), g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", e, i, typeof t), q(null)), t instanceof Error && !(t.message in va) && (va[t.message] = !0, q(o), g("Failed %s type: %s", e, t.message), q(null));
344
+ }
345
+ }
346
+ }
347
+ var Ja = Array.isArray;
348
+ function G(a) {
349
+ return Ja(a);
350
+ }
351
+ function Ka(a) {
352
+ {
353
+ var r = typeof Symbol == "function" && Symbol.toStringTag, e = r && a[Symbol.toStringTag] || a.constructor.name || "Object";
354
+ return e;
355
+ }
356
+ }
357
+ function Ga(a) {
358
+ try {
359
+ return ma(a), !1;
360
+ } catch {
361
+ return !0;
362
+ }
363
+ }
364
+ function ma(a) {
365
+ return "" + a;
366
+ }
367
+ function ya(a) {
368
+ if (Ga(a))
369
+ return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ka(a)), ma(a);
370
+ }
371
+ var W = D.ReactCurrentOwner, Xa = {
372
+ key: !0,
373
+ ref: !0,
374
+ __self: !0,
375
+ __source: !0
376
+ }, ba, ha, X;
377
+ X = {};
378
+ function Ha(a) {
379
+ if ($.call(a, "ref")) {
380
+ var r = Object.getOwnPropertyDescriptor(a, "ref").get;
381
+ if (r && r.isReactWarning)
382
+ return !1;
383
+ }
384
+ return a.ref !== void 0;
385
+ }
386
+ function Za(a) {
387
+ if ($.call(a, "key")) {
388
+ var r = Object.getOwnPropertyDescriptor(a, "key").get;
389
+ if (r && r.isReactWarning)
390
+ return !1;
391
+ }
392
+ return a.key !== void 0;
393
+ }
394
+ function Qa(a, r) {
395
+ if (typeof a.ref == "string" && W.current && r && W.current.stateNode !== r) {
396
+ var e = O(W.current.type);
397
+ X[e] || (g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', O(W.current.type), a.ref), X[e] = !0);
398
+ }
399
+ }
400
+ function ar(a, r) {
401
+ {
402
+ var e = function() {
403
+ ba || (ba = !0, g("%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://reactjs.org/link/special-props)", r));
404
+ };
405
+ e.isReactWarning = !0, Object.defineProperty(a, "key", {
406
+ get: e,
407
+ configurable: !0
408
+ });
409
+ }
410
+ }
411
+ function rr(a, r) {
412
+ {
413
+ var e = function() {
414
+ ha || (ha = !0, g("%s: `ref` 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://reactjs.org/link/special-props)", r));
415
+ };
416
+ e.isReactWarning = !0, Object.defineProperty(a, "ref", {
417
+ get: e,
418
+ configurable: !0
419
+ });
420
+ }
421
+ }
422
+ var er = function(a, r, e, n, o, s, i) {
423
+ var t = {
424
+ // This tag allows us to uniquely identify this as a React Element
425
+ $$typeof: c,
426
+ // Built-in properties that belong on the element
427
+ type: a,
428
+ key: r,
429
+ ref: e,
430
+ props: i,
431
+ // Record the component responsible for creating this element.
432
+ _owner: s
433
+ };
434
+ return t._store = {}, Object.defineProperty(t._store, "validated", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !0,
438
+ value: !1
439
+ }), Object.defineProperty(t, "_self", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: n
444
+ }), Object.defineProperty(t, "_source", {
445
+ configurable: !1,
446
+ enumerable: !1,
447
+ writable: !1,
448
+ value: o
449
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
450
+ };
451
+ function nr(a, r, e, n, o) {
452
+ {
453
+ var s, i = {}, t = null, b = null;
454
+ e !== void 0 && (ya(e), t = "" + e), Za(r) && (ya(r.key), t = "" + r.key), Ha(r) && (b = r.ref, Qa(r, o));
455
+ for (s in r)
456
+ $.call(r, s) && !Xa.hasOwnProperty(s) && (i[s] = r[s]);
457
+ if (a && a.defaultProps) {
458
+ var l = a.defaultProps;
459
+ for (s in l)
460
+ i[s] === void 0 && (i[s] = l[s]);
461
+ }
462
+ if (t || b) {
463
+ var d = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
464
+ t && ar(i, d), b && rr(i, d);
465
+ }
466
+ return er(a, t, b, o, n, W.current, i);
467
+ }
468
+ }
469
+ var H = D.ReactCurrentOwner, Ra = D.ReactDebugCurrentFrame;
470
+ function A(a) {
471
+ if (a) {
472
+ var r = a._owner, e = V(a.type, a._source, r ? r.type : null);
473
+ Ra.setExtraStackFrame(e);
474
+ } else
475
+ Ra.setExtraStackFrame(null);
476
+ }
477
+ var Z;
478
+ Z = !1;
479
+ function Q(a) {
480
+ return typeof a == "object" && a !== null && a.$$typeof === c;
481
+ }
482
+ function Ea() {
483
+ {
484
+ if (H.current) {
485
+ var a = O(H.current.type);
486
+ if (a)
487
+ return `
488
+
489
+ Check the render method of \`` + a + "`.";
490
+ }
491
+ return "";
492
+ }
493
+ }
494
+ function tr(a) {
495
+ {
496
+ if (a !== void 0) {
497
+ var r = a.fileName.replace(/^.*[\\\/]/, ""), e = a.lineNumber;
498
+ return `
499
+
500
+ Check your code at ` + r + ":" + e + ".";
501
+ }
502
+ return "";
503
+ }
504
+ }
505
+ var _a = {};
506
+ function ir(a) {
507
+ {
508
+ var r = Ea();
509
+ if (!r) {
510
+ var e = typeof a == "string" ? a : a.displayName || a.name;
511
+ e && (r = `
512
+
513
+ Check the top-level render call using <` + e + ">.");
514
+ }
515
+ return r;
516
+ }
517
+ }
518
+ function wa(a, r) {
519
+ {
520
+ if (!a._store || a._store.validated || a.key != null)
521
+ return;
522
+ a._store.validated = !0;
523
+ var e = ir(r);
524
+ if (_a[e])
525
+ return;
526
+ _a[e] = !0;
527
+ var n = "";
528
+ a && a._owner && a._owner !== H.current && (n = " It was passed a child from " + O(a._owner.type) + "."), A(a), g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', e, n), A(null);
529
+ }
530
+ }
531
+ function xa(a, r) {
532
+ {
533
+ if (typeof a != "object")
534
+ return;
535
+ if (G(a))
536
+ for (var e = 0; e < a.length; e++) {
537
+ var n = a[e];
538
+ Q(n) && wa(n, r);
539
+ }
540
+ else if (Q(a))
541
+ a._store && (a._store.validated = !0);
542
+ else if (a) {
543
+ var o = Da(a);
544
+ if (typeof o == "function" && o !== a.entries)
545
+ for (var s = o.call(a), i; !(i = s.next()).done; )
546
+ Q(i.value) && wa(i.value, r);
547
+ }
548
+ }
549
+ }
550
+ function or(a) {
551
+ {
552
+ var r = a.type;
553
+ if (r == null || typeof r == "string")
554
+ return;
555
+ var e;
556
+ if (typeof r == "function")
557
+ e = r.propTypes;
558
+ else if (typeof r == "object" && (r.$$typeof === u || // Note: Memo only checks outer props here.
559
+ // Inner props are checked in the reconciler.
560
+ r.$$typeof === x))
561
+ e = r.propTypes;
562
+ else
563
+ return;
564
+ if (e) {
565
+ var n = O(r);
566
+ Ba(e, a.props, "prop", n, a);
567
+ } else if (r.PropTypes !== void 0 && !Z) {
568
+ Z = !0;
569
+ var o = O(r);
570
+ g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown");
571
+ }
572
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
+ }
574
+ }
575
+ function sr(a) {
576
+ {
577
+ for (var r = Object.keys(a.props), e = 0; e < r.length; e++) {
578
+ var n = r[e];
579
+ if (n !== "children" && n !== "key") {
580
+ A(a), g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), A(null);
581
+ break;
582
+ }
583
+ }
584
+ a.ref !== null && (A(a), g("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
585
+ }
586
+ }
587
+ var Ta = {};
588
+ function Sa(a, r, e, n, o, s) {
589
+ {
590
+ var i = Ya(a);
591
+ if (!i) {
592
+ var t = "";
593
+ (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (t += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
+ var b = tr(o);
595
+ b ? t += b : t += Ea();
596
+ var l;
597
+ a === null ? l = "null" : G(a) ? l = "array" : a !== void 0 && a.$$typeof === c ? (l = "<" + (O(a.type) || "Unknown") + " />", t = " Did you accidentally export a JSX literal instead of a component?") : l = typeof a, g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, t);
598
+ }
599
+ var d = nr(a, r, e, o, s);
600
+ if (d == null)
601
+ return d;
602
+ if (i) {
603
+ var _ = r.children;
604
+ if (_ !== void 0)
605
+ if (n)
606
+ if (G(_)) {
607
+ for (var F = 0; F < _.length; F++)
608
+ xa(_[F], a);
609
+ Object.freeze && Object.freeze(_);
610
+ } else
611
+ g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
+ else
613
+ xa(_, a);
614
+ }
615
+ if ($.call(r, "key")) {
616
+ var P = O(a), h = Object.keys(r).filter(function(pr) {
617
+ return pr !== "key";
618
+ }), aa = h.length > 0 ? "{key: someKey, " + h.join(": ..., ") + ": ...}" : "{key: someKey}";
619
+ if (!Ta[P + aa]) {
620
+ var dr = h.length > 0 ? "{" + h.join(": ..., ") + ": ...}" : "{}";
621
+ g(`A props object containing a "key" prop is being spread into JSX:
622
+ let props = %s;
623
+ <%s {...props} />
624
+ React keys must be passed directly to JSX without using spread:
625
+ let props = %s;
626
+ <%s key={someKey} {...props} />`, aa, P, dr, P), Ta[P + aa] = !0;
627
+ }
628
+ }
629
+ return a === v ? sr(d) : or(d), d;
630
+ }
631
+ }
632
+ function ur(a, r, e) {
633
+ return Sa(a, r, e, !0);
634
+ }
635
+ function lr(a, r, e) {
636
+ return Sa(a, r, e, !1);
637
+ }
638
+ var cr = lr, fr = ur;
639
+ Y.Fragment = v, Y.jsx = cr, Y.jsxs = fr;
640
+ }()), Y;
641
+ }
642
+ process.env.NODE_ENV === "production" ? ra.exports = gr() : ra.exports = mr();
643
+ var k = ra.exports;
644
+ const yr = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap");
645
+
646
+ :root {
647
+ /* spacing */
648
+ --starasia-ui-pagination-spacing-xs: var(--starasia-ui-spacing-xs, 4px);
649
+ --starasia-ui-pagination-spacing-sm: var(--starasia-ui-spacing-sm, 8px);
650
+
651
+ /* color */
652
+ --starasia-ui-pagination-color-primary-gray: var(
653
+ --starasia-ui-color-gray-700,
654
+ #374151
655
+ );
656
+ --starasia-ui-pagination-color-secondary-gray: var(
657
+ --starasia-ui-color-gray-500,
658
+ #6b7280
659
+ );
660
+ --starasia-ui-pagination-color-tertiary-gray: var(
661
+ --starasia-ui-color-gray-300,
662
+ #d1d5db
663
+ );
664
+ --starasia-ui-pagination-color-quaternary-gray: var(
665
+ --starasia-ui-color-gray-100,
666
+ #f3f4f6
667
+ );
668
+ --starasia-ui-pagination-color-quinary-gray: var(
669
+ --starasia-ui-color-gray-50,
670
+ #f9fafb
671
+ );
672
+ /* blue color */
673
+ /* blue */
674
+ --starasia-ui-pagination-color-primary-blue: var(
675
+ --starasia-ui-color-blue-700,
676
+ #1d4ed8
677
+ );
678
+ --starasia-ui-pagination-color-secondary-blue: var(
679
+ --starasia-ui-color-blue-500,
680
+ #3b82f6
681
+ );
682
+ --starasia-ui-pagination-color-tertiary-blue: var(
683
+ --starasia-ui-color-blue-300,
684
+ #93c5fd
685
+ );
686
+ --starasia-ui-pagination-color-quaternary-blue: var(
687
+ --starasia-ui-color-blue-100,
688
+ #dbeafe
689
+ );
690
+ --starasia-ui-pagination-color-quinary-blue: var(
691
+ --starasia-ui-color-blue-50,
692
+ #eff6ff
693
+ );
694
+
695
+ /* border radius */
696
+ --starasia-ui-pagination-border-radius: var(--starasia-ui-radii-base, 4px);
697
+
698
+ /* font size */
699
+ --starasia-ui-pagination-font-size-xs: var(--starasia-ui-fontSizes-sm, 12px);
700
+ --starasia-ui-pagination-font-size-sm: var(--starasia-ui-fontSizes-md, 14px);
701
+
702
+ /* font weight */
703
+ --starasia-ui-pagination-font-weight: var(
704
+ --starasia-ui-fontWeights-medium,
705
+ 400
706
+ );
707
+
708
+ /* border widht */
709
+ --starasia-ui-pagination-border-width: var(--starasia-ui-border, 1px);
710
+ }
711
+
712
+ .starasia-pagination-container {
713
+ display: flex;
714
+ list-style-type: none;
715
+ }
716
+
717
+ .starasia-pagination-item {
718
+ padding: var(--starasia-ui-pagination-spacing-xs)
719
+ var(--starasia-ui-pagination-spacing-sm);
720
+ text-align: center;
721
+ margin: auto var(--starasia-ui-pagination-spacing-xs);
722
+ color: var(--starasia-ui-pagination-color-primary-gray);
723
+ display: flex;
724
+ box-sizing: border-box;
725
+ align-items: center;
726
+ border-radius: var(--starasia-ui-pagination-border-radius);
727
+ font-size: var(--starasia-ui-pagination-font-size-sm);
728
+ font-family: "Montserrat";
729
+ text-align: center;
730
+ }
731
+
732
+ .starasia-pagination-item.starasia-pagination-item-responsive {
733
+ margin: auto 0;
734
+ font-size: var(--starasia-ui-pagination-font-size-xs);
735
+ padding: var(--starasia-ui-pagination-spacing-xs)
736
+ var(--starasia-ui-pagination-spacing-sm);
737
+ }
738
+
739
+ .starasia-pagination-item.starasia-pagination-dots:hover {
740
+ background-color: transparent;
741
+ cursor: default;
742
+ }
743
+
744
+ .starasia-pagination-item:hover {
745
+ background-color: var(--starasia-ui-pagination-color-quaternary-gray);
746
+ cursor: pointer;
747
+ }
748
+
749
+ .starasia-pagination-item.starasia-pagination-selected {
750
+ background-color: var(--starasia-ui-pagination-color-quinary-blue);
751
+ color: var(--starasia-ui-pagination-color-secondary-blue);
752
+ font-weight: var(--starasia-ui-pagination-font-weight);
753
+ }
754
+
755
+ .starasia-pagination-arrow::before {
756
+ position: relative;
757
+ /* top: 3pt; Uncomment this to lower the icons as requested in comments*/
758
+ content: "";
759
+ /* By using an em scale, the arrows will size with the font */
760
+ display: inline-block;
761
+ width: 6px;
762
+ height: 6px;
763
+ border-right: var(--starasia-ui-pagination-border-width) solid
764
+ var(--starasia-ui-pagination-color-primary-gray);
765
+ border-top: var(--starasia-ui-pagination-border-width) solid
766
+ var(--starasia-ui-pagination-color-primary-gray);
767
+ }
768
+
769
+ .starasia-pagination-arrow.starasia-pagination-left {
770
+ transform: rotate(-135deg) translateX(-25%);
771
+ }
772
+
773
+ .starasia-pagination-arrow.starasia-pagination-right {
774
+ transform: rotate(45deg);
775
+ }
776
+
777
+ .starasia-pagination-item.starasia-pagination-disabled {
778
+ pointer-events: none;
779
+ }
780
+
781
+ .starasia-pagination-item.starasia-pagination-disabled
782
+ .starasia-pagination-arrow::before {
783
+ border-right: var(--starasia-ui-pagination-border-width) solid
784
+ var(--starasia-ui-pagination-color-tertiary-gray);
785
+ border-top: var(--starasia-ui-pagination-border-width) solid
786
+ var(--starasia-ui-pagination-color-tertiary-gray);
787
+ }
788
+ .starasia-pagination-item.starasia-pagination-disabled:hover {
789
+ background-color: transparent;
790
+ cursor: default;
791
+ }
792
+ `, M = "...", z = (m, c) => {
793
+ let w = c - m + 1;
794
+ return Array.from({ length: w }, (v, f) => f + m);
795
+ }, br = ({
796
+ totalCount: m,
797
+ // pageSize,
798
+ siblingCount: c = 1,
799
+ currentPage: w
800
+ }) => vr(() => {
801
+ const f = m;
802
+ if (c + 5 >= f)
803
+ return z(1, f);
804
+ const S = Math.max(w - c, 1), E = Math.min(
805
+ w + c,
806
+ f
807
+ ), u = S > 2, y = E < f - 2, p = 1, x = f;
808
+ if (!u && y) {
809
+ let R = 3 + 2 * c;
810
+ return [...z(1, R), M, f];
811
+ }
812
+ if (u && !y) {
813
+ let R = 3 + 2 * c, j = z(
814
+ f - R + 1,
815
+ f
816
+ );
817
+ return [p, M, ...j];
818
+ }
819
+ if (u && y) {
820
+ let R = z(S, E);
821
+ return [p, M, ...R, M, x];
822
+ }
823
+ }, [m, c, w]), Ca = "starasia-pagination-styles", hr = (m) => {
824
+ if (!document.getElementById(Ca)) {
825
+ const c = document.createElement("style");
826
+ c.id = Ca, c.textContent = m, document.head.appendChild(c);
827
+ }
828
+ };
829
+ hr(yr);
830
+ const Er = ({
831
+ onPageChange: m,
832
+ totalCount: c,
833
+ siblingCount: w = 1,
834
+ currentPage: v,
835
+ size: f = "md"
836
+ }) => {
837
+ const T = br({
838
+ currentPage: v,
839
+ totalCount: c,
840
+ siblingCount: w
841
+ // pageSize
842
+ });
843
+ if (v === 0 || T.length < 2)
844
+ return null;
845
+ const S = () => {
846
+ m(v + 1);
847
+ }, E = () => {
848
+ m(v - 1);
849
+ };
850
+ let u = T[T.length - 1];
851
+ return /* @__PURE__ */ k.jsxs("ul", { className: "starasia-pagination-container", style: { padding: 0 }, children: [
852
+ /* @__PURE__ */ k.jsx(
853
+ "li",
854
+ {
855
+ className: `starasia-pagination-item ${v === 1 ? "starasia-pagination-disabled" : null} ${f === "sm" ? "starasia-pagination-item-responsive" : ""}`,
856
+ onClick: E,
857
+ children: /* @__PURE__ */ k.jsx("div", { className: "starasia-pagination-arrow starasia-pagination-left" })
858
+ }
859
+ ),
860
+ T.map((y, p) => y === M ? /* @__PURE__ */ k.jsx(
861
+ "li",
862
+ {
863
+ className: `starasia-pagination-item starasia-pagination-dots ${f === "sm" ? "starasia-pagination-item-responsive" : ""}`,
864
+ children: "…"
865
+ },
866
+ p
867
+ ) : /* @__PURE__ */ k.jsx(
868
+ "li",
869
+ {
870
+ className: `starasia-pagination-item ${y === v ? "starasia-pagination-selected" : null} ${f === "sm" ? "starasia-pagination-item-responsive" : ""}`,
871
+ onClick: () => m(Number(y)),
872
+ children: y
873
+ },
874
+ p
875
+ )),
876
+ /* @__PURE__ */ k.jsx(
877
+ "li",
878
+ {
879
+ className: `starasia-pagination-item ${v === u ? "starasia-pagination-disabled" : null} ${f === "sm" ? "starasia-pagination-item-responsive" : ""}`,
880
+ onClick: S,
881
+ children: /* @__PURE__ */ k.jsx(
882
+ "div",
883
+ {
884
+ className: "starasia-pagination-arrow starasia-pagination-right"
885
+ }
886
+ )
887
+ }
888
+ )
889
+ ] });
890
+ };
891
+ export {
892
+ Er as Pagination
893
+ };
@@ -0,0 +1,180 @@
1
+ (function(j,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],P):(j=typeof globalThis<"u"?globalThis:j||self,P(j.Pagination={},j.React))})(this,function(j,P){"use strict";var K={exports:{}},$={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ta;function Da(){if(ta)return $;ta=1;var m=P,c=Symbol.for("react.element"),w=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,f=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,T={key:!0,ref:!0,__self:!0,__source:!0};function S(E,u,y){var p,x={},R=null,k=null;y!==void 0&&(R=""+y),u.key!==void 0&&(R=""+u.key),u.ref!==void 0&&(k=u.ref);for(p in u)g.call(u,p)&&!T.hasOwnProperty(p)&&(x[p]=u[p]);if(E&&E.defaultProps)for(p in u=E.defaultProps,u)x[p]===void 0&&(x[p]=u[p]);return{$$typeof:c,type:E,key:R,ref:k,props:x,_owner:f.current}}return $.Fragment=w,$.jsx=S,$.jsxs=S,$}var N={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var ia;function Aa(){return ia||(ia=1,process.env.NODE_ENV!=="production"&&function(){var m=P,c=Symbol.for("react.element"),w=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),E=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),sa=Symbol.iterator,$a="@@iterator";function Na(a){if(a===null||typeof a!="object")return null;var r=sa&&a[sa]||a[$a];return typeof r=="function"?r:null}var F=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(a){{for(var r=arguments.length,e=new Array(r>1?r-1:0),n=1;n<r;n++)e[n-1]=arguments[n];Ya("error",a,e)}}function Ya(a,r,e){{var n=F.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",e=e.concat([o]));var s=e.map(function(i){return String(i)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[a],console,s)}}var Ma=!1,La=!1,Ua=!1,Va=!1,qa=!1,ua;ua=Symbol.for("react.module.reference");function za(a){return!!(typeof a=="string"||typeof a=="function"||a===g||a===T||qa||a===f||a===y||a===p||Va||a===k||Ma||La||Ua||typeof a=="object"&&a!==null&&(a.$$typeof===R||a.$$typeof===x||a.$$typeof===S||a.$$typeof===E||a.$$typeof===u||a.$$typeof===ua||a.getModuleId!==void 0))}function Ba(a,r,e){var n=a.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?e+"("+o+")":e}function la(a){return a.displayName||"Context"}function O(a){if(a==null)return null;if(typeof a.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case g:return"Fragment";case w:return"Portal";case T:return"Profiler";case f:return"StrictMode";case y:return"Suspense";case p:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case E:var r=a;return la(r)+".Consumer";case S:var e=a;return la(e._context)+".Provider";case u:return Ba(a,a.render,"ForwardRef");case x:var n=a.displayName||null;return n!==null?n:O(a.type)||"Memo";case R:{var o=a,s=o._payload,i=o._init;try{return O(i(s))}catch{return null}}}return null}var D=Object.assign,M=0,ca,fa,da,pa,ga,va,ma;function ya(){}ya.__reactDisabledLog=!0;function Ja(){{if(M===0){ca=console.log,fa=console.info,da=console.warn,pa=console.error,ga=console.group,va=console.groupCollapsed,ma=console.groupEnd;var a={configurable:!0,enumerable:!0,value:ya,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}M++}}function Ka(){{if(M--,M===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},a,{value:ca}),info:D({},a,{value:fa}),warn:D({},a,{value:da}),error:D({},a,{value:pa}),group:D({},a,{value:ga}),groupCollapsed:D({},a,{value:va}),groupEnd:D({},a,{value:ma})})}M<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=F.ReactCurrentDispatcher,X;function q(a,r,e){{if(X===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);X=n&&n[1]||""}return`
18
+ `+X+a}}var H=!1,z;{var Ga=typeof WeakMap=="function"?WeakMap:Map;z=new Ga}function ba(a,r){if(!a||H)return"";{var e=z.get(a);if(e!==void 0)return e}var n;H=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=G.current,G.current=null,Ja();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(h){n=h}Reflect.construct(a,[],i)}else{try{i.call()}catch(h){n=h}a.call(i.prototype)}}else{try{throw Error()}catch(h){n=h}a()}}catch(h){if(h&&n&&typeof h.stack=="string"){for(var t=h.stack.split(`
19
+ `),b=n.stack.split(`
20
+ `),l=t.length-1,d=b.length-1;l>=1&&d>=0&&t[l]!==b[d];)d--;for(;l>=1&&d>=0;l--,d--)if(t[l]!==b[d]){if(l!==1||d!==1)do if(l--,d--,d<0||t[l]!==b[d]){var _=`
21
+ `+t[l].replace(" at new "," at ");return a.displayName&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",a.displayName)),typeof a=="function"&&z.set(a,_),_}while(l>=1&&d>=0);break}}}finally{H=!1,G.current=s,Ka(),Error.prepareStackTrace=o}var W=a?a.displayName||a.name:"",A=W?q(W):"";return typeof a=="function"&&z.set(a,A),A}function Xa(a,r,e){return ba(a,!1)}function Ha(a){var r=a.prototype;return!!(r&&r.isReactComponent)}function B(a,r,e){if(a==null)return"";if(typeof a=="function")return ba(a,Ha(a));if(typeof a=="string")return q(a);switch(a){case y:return q("Suspense");case p:return q("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case u:return Xa(a.render);case x:return B(a.type,r,e);case R:{var n=a,o=n._payload,s=n._init;try{return B(s(o),r,e)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,ha={},Ra=F.ReactDebugCurrentFrame;function J(a){if(a){var r=a._owner,e=B(a.type,a._source,r?r.type:null);Ra.setExtraStackFrame(e)}else Ra.setExtraStackFrame(null)}function Za(a,r,e,n,o){{var s=Function.call.bind(L);for(var i in a)if(s(a,i)){var t=void 0;try{if(typeof a[i]!="function"){var b=Error((n||"React class")+": "+e+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}t=a[i](r,i,n,e,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){t=l}t&&!(t instanceof Error)&&(J(o),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",e,i,typeof t),J(null)),t instanceof Error&&!(t.message in ha)&&(ha[t.message]=!0,J(o),v("Failed %s type: %s",e,t.message),J(null))}}}var Qa=Array.isArray;function Z(a){return Qa(a)}function ar(a){{var r=typeof Symbol=="function"&&Symbol.toStringTag,e=r&&a[Symbol.toStringTag]||a.constructor.name||"Object";return e}}function rr(a){try{return Ea(a),!1}catch{return!0}}function Ea(a){return""+a}function _a(a){if(rr(a))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ar(a)),Ea(a)}var U=F.ReactCurrentOwner,er={key:!0,ref:!0,__self:!0,__source:!0},wa,xa,Q;Q={};function nr(a){if(L.call(a,"ref")){var r=Object.getOwnPropertyDescriptor(a,"ref").get;if(r&&r.isReactWarning)return!1}return a.ref!==void 0}function tr(a){if(L.call(a,"key")){var r=Object.getOwnPropertyDescriptor(a,"key").get;if(r&&r.isReactWarning)return!1}return a.key!==void 0}function ir(a,r){if(typeof a.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var e=O(U.current.type);Q[e]||(v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',O(U.current.type),a.ref),Q[e]=!0)}}function or(a,r){{var e=function(){wa||(wa=!0,v("%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://reactjs.org/link/special-props)",r))};e.isReactWarning=!0,Object.defineProperty(a,"key",{get:e,configurable:!0})}}function sr(a,r){{var e=function(){xa||(xa=!0,v("%s: `ref` 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://reactjs.org/link/special-props)",r))};e.isReactWarning=!0,Object.defineProperty(a,"ref",{get:e,configurable:!0})}}var ur=function(a,r,e,n,o,s,i){var t={$$typeof:c,type:a,key:r,ref:e,props:i,_owner:s};return t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(t,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(t,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t};function lr(a,r,e,n,o){{var s,i={},t=null,b=null;e!==void 0&&(_a(e),t=""+e),tr(r)&&(_a(r.key),t=""+r.key),nr(r)&&(b=r.ref,ir(r,o));for(s in r)L.call(r,s)&&!er.hasOwnProperty(s)&&(i[s]=r[s]);if(a&&a.defaultProps){var l=a.defaultProps;for(s in l)i[s]===void 0&&(i[s]=l[s])}if(t||b){var d=typeof a=="function"?a.displayName||a.name||"Unknown":a;t&&or(i,d),b&&sr(i,d)}return ur(a,t,b,o,n,U.current,i)}}var aa=F.ReactCurrentOwner,Ta=F.ReactDebugCurrentFrame;function I(a){if(a){var r=a._owner,e=B(a.type,a._source,r?r.type:null);Ta.setExtraStackFrame(e)}else Ta.setExtraStackFrame(null)}var ra;ra=!1;function ea(a){return typeof a=="object"&&a!==null&&a.$$typeof===c}function Sa(){{if(aa.current){var a=O(aa.current.type);if(a)return`
22
+
23
+ Check the render method of \``+a+"`."}return""}}function cr(a){{if(a!==void 0){var r=a.fileName.replace(/^.*[\\\/]/,""),e=a.lineNumber;return`
24
+
25
+ Check your code at `+r+":"+e+"."}return""}}var Oa={};function fr(a){{var r=Sa();if(!r){var e=typeof a=="string"?a:a.displayName||a.name;e&&(r=`
26
+
27
+ Check the top-level render call using <`+e+">.")}return r}}function ja(a,r){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var e=fr(r);if(Oa[e])return;Oa[e]=!0;var n="";a&&a._owner&&a._owner!==aa.current&&(n=" It was passed a child from "+O(a._owner.type)+"."),I(a),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',e,n),I(null)}}function Pa(a,r){{if(typeof a!="object")return;if(Z(a))for(var e=0;e<a.length;e++){var n=a[e];ea(n)&&ja(n,r)}else if(ea(a))a._store&&(a._store.validated=!0);else if(a){var o=Na(a);if(typeof o=="function"&&o!==a.entries)for(var s=o.call(a),i;!(i=s.next()).done;)ea(i.value)&&ja(i.value,r)}}}function dr(a){{var r=a.type;if(r==null||typeof r=="string")return;var e;if(typeof r=="function")e=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===u||r.$$typeof===x))e=r.propTypes;else return;if(e){var n=O(r);Za(e,a.props,"prop",n,a)}else if(r.PropTypes!==void 0&&!ra){ra=!0;var o=O(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pr(a){{for(var r=Object.keys(a.props),e=0;e<r.length;e++){var n=r[e];if(n!=="children"&&n!=="key"){I(a),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}a.ref!==null&&(I(a),v("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var Ca={};function ka(a,r,e,n,o,s){{var i=za(a);if(!i){var t="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(t+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=cr(o);b?t+=b:t+=Sa();var l;a===null?l="null":Z(a)?l="array":a!==void 0&&a.$$typeof===c?(l="<"+(O(a.type)||"Unknown")+" />",t=" Did you accidentally export a JSX literal instead of a component?"):l=typeof a,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,t)}var d=lr(a,r,e,o,s);if(d==null)return d;if(i){var _=r.children;if(_!==void 0)if(n)if(Z(_)){for(var W=0;W<_.length;W++)Pa(_[W],a);Object.freeze&&Object.freeze(_)}else v("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 Pa(_,a)}if(L.call(r,"key")){var A=O(a),h=Object.keys(r).filter(function(hr){return hr!=="key"}),na=h.length>0?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}";if(!Ca[A+na]){var br=h.length>0?"{"+h.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
28
+ let props = %s;
29
+ <%s {...props} />
30
+ React keys must be passed directly to JSX without using spread:
31
+ let props = %s;
32
+ <%s key={someKey} {...props} />`,na,A,br,A),Ca[A+na]=!0}}return a===g?pr(d):dr(d),d}}function gr(a,r,e){return ka(a,r,e,!0)}function vr(a,r,e){return ka(a,r,e,!1)}var mr=vr,yr=gr;N.Fragment=g,N.jsx=mr,N.jsxs=yr}()),N}process.env.NODE_ENV==="production"?K.exports=Da():K.exports=Aa();var C=K.exports;const Fa=`@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap");
33
+
34
+ :root {
35
+ /* spacing */
36
+ --starasia-ui-pagination-spacing-xs: var(--starasia-ui-spacing-xs, 4px);
37
+ --starasia-ui-pagination-spacing-sm: var(--starasia-ui-spacing-sm, 8px);
38
+
39
+ /* color */
40
+ --starasia-ui-pagination-color-primary-gray: var(
41
+ --starasia-ui-color-gray-700,
42
+ #374151
43
+ );
44
+ --starasia-ui-pagination-color-secondary-gray: var(
45
+ --starasia-ui-color-gray-500,
46
+ #6b7280
47
+ );
48
+ --starasia-ui-pagination-color-tertiary-gray: var(
49
+ --starasia-ui-color-gray-300,
50
+ #d1d5db
51
+ );
52
+ --starasia-ui-pagination-color-quaternary-gray: var(
53
+ --starasia-ui-color-gray-100,
54
+ #f3f4f6
55
+ );
56
+ --starasia-ui-pagination-color-quinary-gray: var(
57
+ --starasia-ui-color-gray-50,
58
+ #f9fafb
59
+ );
60
+ /* blue color */
61
+ /* blue */
62
+ --starasia-ui-pagination-color-primary-blue: var(
63
+ --starasia-ui-color-blue-700,
64
+ #1d4ed8
65
+ );
66
+ --starasia-ui-pagination-color-secondary-blue: var(
67
+ --starasia-ui-color-blue-500,
68
+ #3b82f6
69
+ );
70
+ --starasia-ui-pagination-color-tertiary-blue: var(
71
+ --starasia-ui-color-blue-300,
72
+ #93c5fd
73
+ );
74
+ --starasia-ui-pagination-color-quaternary-blue: var(
75
+ --starasia-ui-color-blue-100,
76
+ #dbeafe
77
+ );
78
+ --starasia-ui-pagination-color-quinary-blue: var(
79
+ --starasia-ui-color-blue-50,
80
+ #eff6ff
81
+ );
82
+
83
+ /* border radius */
84
+ --starasia-ui-pagination-border-radius: var(--starasia-ui-radii-base, 4px);
85
+
86
+ /* font size */
87
+ --starasia-ui-pagination-font-size-xs: var(--starasia-ui-fontSizes-sm, 12px);
88
+ --starasia-ui-pagination-font-size-sm: var(--starasia-ui-fontSizes-md, 14px);
89
+
90
+ /* font weight */
91
+ --starasia-ui-pagination-font-weight: var(
92
+ --starasia-ui-fontWeights-medium,
93
+ 400
94
+ );
95
+
96
+ /* border widht */
97
+ --starasia-ui-pagination-border-width: var(--starasia-ui-border, 1px);
98
+ }
99
+
100
+ .starasia-pagination-container {
101
+ display: flex;
102
+ list-style-type: none;
103
+ }
104
+
105
+ .starasia-pagination-item {
106
+ padding: var(--starasia-ui-pagination-spacing-xs)
107
+ var(--starasia-ui-pagination-spacing-sm);
108
+ text-align: center;
109
+ margin: auto var(--starasia-ui-pagination-spacing-xs);
110
+ color: var(--starasia-ui-pagination-color-primary-gray);
111
+ display: flex;
112
+ box-sizing: border-box;
113
+ align-items: center;
114
+ border-radius: var(--starasia-ui-pagination-border-radius);
115
+ font-size: var(--starasia-ui-pagination-font-size-sm);
116
+ font-family: "Montserrat";
117
+ text-align: center;
118
+ }
119
+
120
+ .starasia-pagination-item.starasia-pagination-item-responsive {
121
+ margin: auto 0;
122
+ font-size: var(--starasia-ui-pagination-font-size-xs);
123
+ padding: var(--starasia-ui-pagination-spacing-xs)
124
+ var(--starasia-ui-pagination-spacing-sm);
125
+ }
126
+
127
+ .starasia-pagination-item.starasia-pagination-dots:hover {
128
+ background-color: transparent;
129
+ cursor: default;
130
+ }
131
+
132
+ .starasia-pagination-item:hover {
133
+ background-color: var(--starasia-ui-pagination-color-quaternary-gray);
134
+ cursor: pointer;
135
+ }
136
+
137
+ .starasia-pagination-item.starasia-pagination-selected {
138
+ background-color: var(--starasia-ui-pagination-color-quinary-blue);
139
+ color: var(--starasia-ui-pagination-color-secondary-blue);
140
+ font-weight: var(--starasia-ui-pagination-font-weight);
141
+ }
142
+
143
+ .starasia-pagination-arrow::before {
144
+ position: relative;
145
+ /* top: 3pt; Uncomment this to lower the icons as requested in comments*/
146
+ content: "";
147
+ /* By using an em scale, the arrows will size with the font */
148
+ display: inline-block;
149
+ width: 6px;
150
+ height: 6px;
151
+ border-right: var(--starasia-ui-pagination-border-width) solid
152
+ var(--starasia-ui-pagination-color-primary-gray);
153
+ border-top: var(--starasia-ui-pagination-border-width) solid
154
+ var(--starasia-ui-pagination-color-primary-gray);
155
+ }
156
+
157
+ .starasia-pagination-arrow.starasia-pagination-left {
158
+ transform: rotate(-135deg) translateX(-25%);
159
+ }
160
+
161
+ .starasia-pagination-arrow.starasia-pagination-right {
162
+ transform: rotate(45deg);
163
+ }
164
+
165
+ .starasia-pagination-item.starasia-pagination-disabled {
166
+ pointer-events: none;
167
+ }
168
+
169
+ .starasia-pagination-item.starasia-pagination-disabled
170
+ .starasia-pagination-arrow::before {
171
+ border-right: var(--starasia-ui-pagination-border-width) solid
172
+ var(--starasia-ui-pagination-color-tertiary-gray);
173
+ border-top: var(--starasia-ui-pagination-border-width) solid
174
+ var(--starasia-ui-pagination-color-tertiary-gray);
175
+ }
176
+ .starasia-pagination-item.starasia-pagination-disabled:hover {
177
+ background-color: transparent;
178
+ cursor: default;
179
+ }
180
+ `,Y="...",V=(m,c)=>{let w=c-m+1;return Array.from({length:w},(g,f)=>f+m)},Ia=({totalCount:m,siblingCount:c=1,currentPage:w})=>P.useMemo(()=>{const f=m;if(c+5>=f)return V(1,f);const S=Math.max(w-c,1),E=Math.min(w+c,f),u=S>2,y=E<f-2,p=1,x=f;if(!u&&y){let R=3+2*c;return[...V(1,R),Y,f]}if(u&&!y){let R=3+2*c,k=V(f-R+1,f);return[p,Y,...k]}if(u&&y){let R=V(S,E);return[p,Y,...R,Y,x]}},[m,c,w]),oa="starasia-pagination-styles";(m=>{if(!document.getElementById(oa)){const c=document.createElement("style");c.id=oa,c.textContent=m,document.head.appendChild(c)}})(Fa);const Wa=({onPageChange:m,totalCount:c,siblingCount:w=1,currentPage:g,size:f="md"})=>{const T=Ia({currentPage:g,totalCount:c,siblingCount:w});if(g===0||T.length<2)return null;const S=()=>{m(g+1)},E=()=>{m(g-1)};let u=T[T.length-1];return C.jsxs("ul",{className:"starasia-pagination-container",style:{padding:0},children:[C.jsx("li",{className:`starasia-pagination-item ${g===1?"starasia-pagination-disabled":null} ${f==="sm"?"starasia-pagination-item-responsive":""}`,onClick:E,children:C.jsx("div",{className:"starasia-pagination-arrow starasia-pagination-left"})}),T.map((y,p)=>y===Y?C.jsx("li",{className:`starasia-pagination-item starasia-pagination-dots ${f==="sm"?"starasia-pagination-item-responsive":""}`,children:"…"},p):C.jsx("li",{className:`starasia-pagination-item ${y===g?"starasia-pagination-selected":null} ${f==="sm"?"starasia-pagination-item-responsive":""}`,onClick:()=>m(Number(y)),children:y},p)),C.jsx("li",{className:`starasia-pagination-item ${g===u?"starasia-pagination-disabled":null} ${f==="sm"?"starasia-pagination-item-responsive":""}`,onClick:S,children:C.jsx("div",{className:"starasia-pagination-arrow starasia-pagination-right"})})]})};j.Pagination=Wa,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,7 @@
1
+ export interface IPaginationProps {
2
+ totalCount: number;
3
+ siblingCount?: number;
4
+ currentPage: number;
5
+ onPageChange: (page: number) => void;
6
+ size?: "sm" | "md";
7
+ }
@@ -0,0 +1,8 @@
1
+ export declare const DOTS = "...";
2
+ interface IProps {
3
+ totalCount: number;
4
+ siblingCount?: number;
5
+ currentPage: number;
6
+ }
7
+ export declare const usePagination: ({ totalCount, siblingCount, currentPage, }: IProps) => (string | number)[] | undefined;
8
+ export {};
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@starasia/pagination",
3
+ "version": "1.0.0",
4
+ "description": "pagination component for starasia UI",
5
+ "author": "Prawito Hudoro",
6
+ "main": "dist/pagination.umd.js",
7
+ "module": "dist/pagination.es.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist/*.js",
11
+ "dist/*.d.ts",
12
+ "dist/*.map",
13
+ "dist/*.css"
14
+ ],
15
+ "scripts": {
16
+ "dev": "vite --config vite.config.ts --port 3000",
17
+ "build": "vite build --config vite.config.ts"
18
+ },
19
+ "keywords": [],
20
+ "license": "ISC",
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=18.0.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^20.11.16",
27
+ "@vitejs/plugin-react": "^4.2.1",
28
+ "tsconfig-paths": "^4.2.0",
29
+ "typescript": "^5.3.3",
30
+ "vite": "^5.0.12",
31
+ "vite-plugin-dts": "^3.7.2",
32
+ "react": "^18.2.0",
33
+ "react-dom": "^18.2.0",
34
+ "@types/react": "^18.2.55",
35
+ "@types/react-dom": "^18.2.19"
36
+ }
37
+ }