@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.
Files changed (2) hide show
  1. package/dist/pagination.js +34 -34
  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,8 +30,8 @@ var V = {
30
30
  };
31
31
  function Z({
32
32
  page: d,
33
- count: o,
34
- visible: w,
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(o).keys()], s = Math.max(Math.ceil(w), 3);
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
- 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("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
- l(r);
54
+ g(r);
55
55
  },
56
56
  children: r + 1
57
57
  }
58
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);
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__ */ 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(
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: () => l(t - 1),
146
- children: /* @__PURE__ */ e(u, { icon: _ })
145
+ onClick: () => g(t - 1),
146
+ children: /* @__PURE__ */ o(n, { icon: _ })
147
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
+ 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 >= o - 1,
157
+ disabled: t >= e - 1,
158
158
  className: `uofg-pagination-next ${b()}`,
159
- onClick: () => l(t + 1),
160
- children: /* @__PURE__ */ e(u, { icon: V })
159
+ onClick: () => g(t + 1),
160
+ children: /* @__PURE__ */ o(n, { icon: V })
161
161
  }
162
162
  ) })
163
163
  ] }),
164
- /* @__PURE__ */ e("span", { className: `uofg-pagination-seperator ${E()}` }),
165
- /* @__PURE__ */ f("div", { className: `uofg-pagination-go-to-wrapper ${A()}`, children: [
166
- /* @__PURE__ */ e(
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: o,
171
+ max: e,
172
172
  value: t + 1,
173
173
  onInput: (r) => {
174
- j(isNaN(r) ? 0 : N(r - 1, 0, o - 1));
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__ */ e(
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
- l(P);
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.1",
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": "2a9a13f4af35d833daf38dfd27b1346df69f2a57"
87
+ "gitHead": "e5f51f54bd5588ef083fd48aa5931f6c405cb06e"
88
88
  }