@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.
Files changed (2) hide show
  1. package/dist/pagination.js +43 -42
  2. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
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 u } from "@fortawesome/react-fontawesome";
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 N } from "./math-utils-CnAd98v6.js";
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: o,
34
- visible: w,
35
- defaultPage: h,
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(h ?? 0), [P, j] = y(h ?? 0), C = [...Array(o).keys()], s = Math.max(Math.ceil(w), 3);
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
- l(d ?? 0);
44
+ g(d ?? 0);
45
45
  }, [d]);
46
- const l = (r) => {
47
- const v = N(r, 0, o - 1);
46
+ const g = (r) => {
47
+ const v = w(r, 0, e - 1);
48
48
  c == null || c(v), M(v);
49
- }, m = (r) => /* @__PURE__ */ e("li", { className: "uog:contents", children: /* @__PURE__ */ e(
49
+ }, f = (r) => /* @__PURE__ */ o(
50
50
  "button",
51
51
  {
52
52
  className: `uofg-pagination-item ${W({ active: t === r })}`,
53
53
  onClick: () => {
54
- l(r);
54
+ g(r);
55
55
  },
56
56
  children: r + 1
57
- }
58
- ) }, r);
59
- let i, a, g, n;
60
- o <= s || o < 5 ? (i = 1, a = o - 1, g = !1, n = !1) : t < s - 1 ? (i = 1, a = s, n = !0, g = !1) : t > o - s ? (i = o - s, a = o - 1, g = !0, n = !1) : (i = t - Math.floor(s / 2), a = i + s, g = i > 1, n = a < o);
61
- const { base: I, list: z, seperator: E, control: b, item: W, inputWrapper: A, goTo: R, input: T } = F({
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__ */ f("div", { className: `uofg-pagination ${B(I(), L)}`, children: [
139
- /* @__PURE__ */ f("ul", { className: `uofg-pagination-list ${z()}`, children: [
140
- /* @__PURE__ */ e("li", { className: "uog:contents", children: /* @__PURE__ */ e(
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 ${b()}`,
145
- onClick: () => l(t - 1),
146
- children: /* @__PURE__ */ e(u, { icon: _ })
145
+ className: `uofg-pagination-previous ${h()}`,
146
+ onClick: () => g(t - 1),
147
+ children: /* @__PURE__ */ o(n, { icon: _ })
147
148
  }
148
- ) }),
149
- /* @__PURE__ */ e("li", { className: "uog:contents", children: m(0) }),
150
- g && /* @__PURE__ */ e(u, { icon: x }),
151
- C.slice(i, a).map(m),
152
- n && /* @__PURE__ */ e(u, { icon: x }),
153
- /* @__PURE__ */ e("li", { className: "uog:contents", children: m(o - 1) }),
154
- /* @__PURE__ */ e("li", { className: "uog:contents", children: /* @__PURE__ */ e(
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 >= o - 1,
158
- className: `uofg-pagination-next ${b()}`,
159
- onClick: () => l(t + 1),
160
- children: /* @__PURE__ */ e(u, { icon: V })
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__ */ e("span", { className: `uofg-pagination-seperator ${E()}` }),
165
- /* @__PURE__ */ f("div", { className: `uofg-pagination-go-to-wrapper ${A()}`, children: [
166
- /* @__PURE__ */ e(
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: o,
172
+ max: e,
172
173
  value: t + 1,
173
174
  onInput: (r) => {
174
- j(isNaN(r) ? 0 : N(r - 1, 0, o - 1));
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__ */ e(
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
- l(P);
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.1",
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": "2a9a13f4af35d833daf38dfd27b1346df69f2a57"
87
+ "gitHead": "3b12885d82db0a5bd8f52a8a391edc5c801e420c"
88
88
  }