@uoguelph/react-components 1.3.1 → 1.3.2
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/dist/pagination.js +34 -34
- package/package.json +2 -2
package/dist/pagination.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { j as x } from "./solid-D19hAF5t.js";
|
|
3
|
-
import { FontAwesomeIcon as
|
|
3
|
+
import { FontAwesomeIcon as n } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { useState as y, useEffect as q } from "react";
|
|
5
5
|
import { twMerge as B } from "tailwind-merge";
|
|
6
6
|
import { tv as F } from "tailwind-variants";
|
|
7
|
-
import { c as
|
|
7
|
+
import { c as w } from "./math-utils-CnAd98v6.js";
|
|
8
8
|
import { Button as G } from "./button.js";
|
|
9
9
|
import { NumberInput as S } from "./number-input.js";
|
|
10
10
|
var V = {
|
|
@@ -30,8 +30,8 @@ var V = {
|
|
|
30
30
|
};
|
|
31
31
|
function Z({
|
|
32
32
|
page: d,
|
|
33
|
-
count:
|
|
34
|
-
visible:
|
|
33
|
+
count: e,
|
|
34
|
+
visible: N,
|
|
35
35
|
defaultPage: h,
|
|
36
36
|
onChange: c,
|
|
37
37
|
color: p = "yellow",
|
|
@@ -39,25 +39,25 @@ function Z({
|
|
|
39
39
|
hideList: k = !1,
|
|
40
40
|
className: L
|
|
41
41
|
}) {
|
|
42
|
-
const [t, M] = y(h ?? 0), [P, j] = y(h ?? 0), C = [...Array(
|
|
42
|
+
const [t, M] = y(h ?? 0), [P, j] = y(h ?? 0), C = [...Array(e).keys()], i = Math.max(Math.ceil(N), 3);
|
|
43
43
|
q(() => {
|
|
44
|
-
|
|
44
|
+
g(d ?? 0);
|
|
45
45
|
}, [d]);
|
|
46
|
-
const
|
|
47
|
-
const v =
|
|
46
|
+
const g = (r) => {
|
|
47
|
+
const v = w(r, 0, e - 1);
|
|
48
48
|
c == null || c(v), M(v);
|
|
49
|
-
},
|
|
49
|
+
}, f = (r) => /* @__PURE__ */ o("li", { className: "uog:contents", children: /* @__PURE__ */ o(
|
|
50
50
|
"button",
|
|
51
51
|
{
|
|
52
52
|
className: `uofg-pagination-item ${W({ active: t === r })}`,
|
|
53
53
|
onClick: () => {
|
|
54
|
-
|
|
54
|
+
g(r);
|
|
55
55
|
},
|
|
56
56
|
children: r + 1
|
|
57
57
|
}
|
|
58
58
|
) }, r);
|
|
59
|
-
let
|
|
60
|
-
|
|
59
|
+
let s, a, l, u;
|
|
60
|
+
e <= i || e < 5 ? (s = 1, a = e - 1, l = !1, u = !1) : t < i - 1 ? (s = 1, a = i, u = !0, l = !1) : t > e - i ? (s = e - i, a = e - 1, l = !0, u = !1) : (s = t - Math.floor(i / 2), a = s + i, l = s > 1, u = a < e);
|
|
61
61
|
const { base: I, list: z, seperator: E, control: b, item: W, inputWrapper: A, goTo: R, input: T } = F({
|
|
62
62
|
slots: {
|
|
63
63
|
base: "uog:flex uog:w-full uog:flex-col uog:md:flex-row uog:gap-4 uog:items-center uog:justify-center",
|
|
@@ -135,54 +135,54 @@ function Z({
|
|
|
135
135
|
hideList: k ?? !1,
|
|
136
136
|
hideInput: $ ?? !1
|
|
137
137
|
});
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ m("div", { className: `uofg-pagination ${B(I(), L)}`, children: [
|
|
139
|
+
/* @__PURE__ */ m("ul", { className: `uofg-pagination-list ${z()}`, children: [
|
|
140
|
+
/* @__PURE__ */ o("li", { className: "uog:contents", children: /* @__PURE__ */ o(
|
|
141
141
|
"button",
|
|
142
142
|
{
|
|
143
143
|
disabled: t <= 0,
|
|
144
144
|
className: `uofg-pagination-previous ${b()}`,
|
|
145
|
-
onClick: () =>
|
|
146
|
-
children: /* @__PURE__ */
|
|
145
|
+
onClick: () => g(t - 1),
|
|
146
|
+
children: /* @__PURE__ */ o(n, { icon: _ })
|
|
147
147
|
}
|
|
148
148
|
) }),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
C.slice(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/* @__PURE__ */
|
|
149
|
+
f(0),
|
|
150
|
+
l && /* @__PURE__ */ o(n, { icon: x }),
|
|
151
|
+
C.slice(s, a).map(f),
|
|
152
|
+
u && /* @__PURE__ */ o(n, { icon: x }),
|
|
153
|
+
f(e - 1),
|
|
154
|
+
/* @__PURE__ */ o("li", { className: "uog:contents", children: /* @__PURE__ */ o(
|
|
155
155
|
"button",
|
|
156
156
|
{
|
|
157
|
-
disabled: t >=
|
|
157
|
+
disabled: t >= e - 1,
|
|
158
158
|
className: `uofg-pagination-next ${b()}`,
|
|
159
|
-
onClick: () =>
|
|
160
|
-
children: /* @__PURE__ */
|
|
159
|
+
onClick: () => g(t + 1),
|
|
160
|
+
children: /* @__PURE__ */ o(n, { icon: V })
|
|
161
161
|
}
|
|
162
162
|
) })
|
|
163
163
|
] }),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ o("span", { className: `uofg-pagination-seperator ${E()}` }),
|
|
165
|
+
/* @__PURE__ */ m("div", { className: `uofg-pagination-go-to-wrapper ${A()}`, children: [
|
|
166
|
+
/* @__PURE__ */ o(
|
|
167
167
|
S,
|
|
168
168
|
{
|
|
169
169
|
color: p,
|
|
170
170
|
min: 1,
|
|
171
|
-
max:
|
|
171
|
+
max: e,
|
|
172
172
|
value: t + 1,
|
|
173
173
|
onInput: (r) => {
|
|
174
|
-
j(isNaN(r) ? 0 :
|
|
174
|
+
j(isNaN(r) ? 0 : w(r - 1, 0, e - 1));
|
|
175
175
|
},
|
|
176
176
|
className: `uofg-pagination-go-to-input ${T()}`
|
|
177
177
|
}
|
|
178
178
|
),
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ o(
|
|
180
180
|
G,
|
|
181
181
|
{
|
|
182
182
|
color: p,
|
|
183
183
|
className: `uofg-pagination-go-to-button ${R()}`,
|
|
184
184
|
onClick: () => {
|
|
185
|
-
|
|
185
|
+
g(P);
|
|
186
186
|
},
|
|
187
187
|
children: "Go to page"
|
|
188
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uoguelph/react-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "University of Guelph React Components Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"bugs": {
|
|
85
85
|
"url": "https://github.com/ccswbs/uofg-components/issues"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "e5f51f54bd5588ef083fd48aa5931f6c405cb06e"
|
|
88
88
|
}
|