@uoguelph/react-components 1.3.1 → 1.3.3
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 +43 -42
- 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,35 +30,36 @@ var V = {
|
|
|
30
30
|
};
|
|
31
31
|
function Z({
|
|
32
32
|
page: d,
|
|
33
|
-
count:
|
|
34
|
-
visible:
|
|
35
|
-
defaultPage:
|
|
33
|
+
count: e,
|
|
34
|
+
visible: N,
|
|
35
|
+
defaultPage: b,
|
|
36
36
|
onChange: c,
|
|
37
37
|
color: p = "yellow",
|
|
38
38
|
hideInput: $ = !1,
|
|
39
39
|
hideList: k = !1,
|
|
40
40
|
className: L
|
|
41
41
|
}) {
|
|
42
|
-
const [t, M] = y(
|
|
42
|
+
const [t, M] = y(b ?? 0), [P, j] = y(b ?? 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(
|
|
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
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
},
|
|
58
|
+
r
|
|
59
|
+
);
|
|
60
|
+
let s, a, u, l;
|
|
61
|
+
e <= i || e < 5 ? (s = 1, a = e - 1, u = !1, l = !1) : t < i - 1 ? (s = 1, a = i, l = !0, u = !1) : t > e - i ? (s = e - i, a = e - 1, u = !0, l = !1) : (s = t - Math.floor(i / 2), a = s + i, u = s > 1, l = a < e);
|
|
62
|
+
const { base: I, list: z, seperator: E, control: h, item: W, inputWrapper: A, goTo: R, input: T } = F({
|
|
62
63
|
slots: {
|
|
63
64
|
base: "uog:flex uog:w-full uog:flex-col uog:md:flex-row uog:gap-4 uog:items-center uog:justify-center",
|
|
64
65
|
list: "uog:flex uog:gap-4 uog:items-center uog:justify-center",
|
|
@@ -135,54 +136,54 @@ function Z({
|
|
|
135
136
|
hideList: k ?? !1,
|
|
136
137
|
hideInput: $ ?? !1
|
|
137
138
|
});
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ m("div", { className: `uofg-pagination ${B(I(), L)}`, children: [
|
|
140
|
+
/* @__PURE__ */ m("div", { className: `uofg-pagination-list ${z()}`, children: [
|
|
141
|
+
/* @__PURE__ */ o(
|
|
141
142
|
"button",
|
|
142
143
|
{
|
|
143
144
|
disabled: t <= 0,
|
|
144
|
-
className: `uofg-pagination-previous ${
|
|
145
|
-
onClick: () =>
|
|
146
|
-
children: /* @__PURE__ */
|
|
145
|
+
className: `uofg-pagination-previous ${h()}`,
|
|
146
|
+
onClick: () => g(t - 1),
|
|
147
|
+
children: /* @__PURE__ */ o(n, { icon: _ })
|
|
147
148
|
}
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
C.slice(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/* @__PURE__ */
|
|
149
|
+
),
|
|
150
|
+
f(0),
|
|
151
|
+
u && /* @__PURE__ */ o(n, { icon: x }),
|
|
152
|
+
C.slice(s, a).map(f),
|
|
153
|
+
l && /* @__PURE__ */ o(n, { icon: x }),
|
|
154
|
+
f(e - 1),
|
|
155
|
+
/* @__PURE__ */ o(
|
|
155
156
|
"button",
|
|
156
157
|
{
|
|
157
|
-
disabled: t >=
|
|
158
|
-
className: `uofg-pagination-next ${
|
|
159
|
-
onClick: () =>
|
|
160
|
-
children: /* @__PURE__ */
|
|
158
|
+
disabled: t >= e - 1,
|
|
159
|
+
className: `uofg-pagination-next ${h()}`,
|
|
160
|
+
onClick: () => g(t + 1),
|
|
161
|
+
children: /* @__PURE__ */ o(n, { icon: V })
|
|
161
162
|
}
|
|
162
|
-
)
|
|
163
|
+
)
|
|
163
164
|
] }),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ o("span", { className: `uofg-pagination-seperator ${E()}` }),
|
|
166
|
+
/* @__PURE__ */ m("div", { className: `uofg-pagination-go-to-wrapper ${A()}`, children: [
|
|
167
|
+
/* @__PURE__ */ o(
|
|
167
168
|
S,
|
|
168
169
|
{
|
|
169
170
|
color: p,
|
|
170
171
|
min: 1,
|
|
171
|
-
max:
|
|
172
|
+
max: e,
|
|
172
173
|
value: t + 1,
|
|
173
174
|
onInput: (r) => {
|
|
174
|
-
j(isNaN(r) ? 0 :
|
|
175
|
+
j(isNaN(r) ? 0 : w(r - 1, 0, e - 1));
|
|
175
176
|
},
|
|
176
177
|
className: `uofg-pagination-go-to-input ${T()}`
|
|
177
178
|
}
|
|
178
179
|
),
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ o(
|
|
180
181
|
G,
|
|
181
182
|
{
|
|
182
183
|
color: p,
|
|
183
184
|
className: `uofg-pagination-go-to-button ${R()}`,
|
|
184
185
|
onClick: () => {
|
|
185
|
-
|
|
186
|
+
g(P);
|
|
186
187
|
},
|
|
187
188
|
children: "Go to page"
|
|
188
189
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uoguelph/react-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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": "3b12885d82db0a5bd8f52a8a391edc5c801e420c"
|
|
88
88
|
}
|