@uoguelph/react-components 1.4.1-rc.1 → 1.4.1

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.
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { jsxs as u, jsx as t } from "react/jsx-runtime";
3
- import { j as x } from "./solid-D19hAF5t.js";
4
- import { FontAwesomeIcon as p } from "@fortawesome/react-fontawesome";
5
- import { useState as y, useEffect as q } from "react";
2
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
3
+ import { j as y } from "./solid-D19hAF5t.js";
4
+ import { FontAwesomeIcon as m } from "@fortawesome/react-fontawesome";
5
+ import { useState as x, useEffect as q } from "react";
6
6
  import { twMerge as B } from "tailwind-merge";
7
7
  import { tv as F } from "tailwind-variants";
8
- import { c as w } from "./math-utils-CnAd98v6.js";
8
+ import { c as N } from "./math-utils-CnAd98v6.js";
9
9
  import { Button as G } from "./button.js";
10
10
  import { NumberInput as S } from "./number-input.js";
11
11
  var V = {
@@ -30,37 +30,46 @@ var V = {
30
30
  ]
31
31
  };
32
32
  function Z({
33
- page: d,
33
+ page: h,
34
34
  count: e,
35
- visible: N,
35
+ visible: w,
36
36
  defaultPage: b,
37
37
  onChange: f,
38
- color: g = "yellow",
39
- hideInput: $ = !1,
40
- hideList: k = !1,
41
- className: L
38
+ color: u = "yellow",
39
+ hideInput: P = !1,
40
+ hideList: $ = !1,
41
+ className: k
42
42
  }) {
43
- const [r, M] = y(b ?? 0), [P, j] = y(b ?? 0), C = [...Array(e).keys()], i = Math.max(Math.ceil(N), 3);
43
+ const [r, C] = x(b ?? 0), [I, L] = x(b ?? 0), M = [...Array(e).keys()], i = Math.max(Math.ceil(w), 3);
44
44
  q(() => {
45
- l(d ?? 0);
46
- }, [d]);
47
- const l = (o) => {
48
- const v = w(o, 0, e - 1);
49
- f == null || f(v), M(v);
50
- }, m = (o) => /* @__PURE__ */ t(
51
- "button",
52
- {
53
- className: `uofg-pagination-item ${W({ active: r === o })}`,
54
- onClick: () => {
55
- l(o);
45
+ n(h ?? 0);
46
+ }, [h]);
47
+ const n = (s) => {
48
+ const g = N(s, 0, e - 1);
49
+ f == null || f(g), C(g);
50
+ }, d = (s) => {
51
+ const g = r === s;
52
+ return /* @__PURE__ */ l(
53
+ "button",
54
+ {
55
+ className: `uofg-pagination-item ${A({ active: g })}`,
56
+ onClick: () => {
57
+ n(s);
58
+ },
59
+ children: [
60
+ /* @__PURE__ */ t("span", { className: "sr-only", children: "Page" }),
61
+ " ",
62
+ s + 1,
63
+ " ",
64
+ g ? /* @__PURE__ */ t("span", { className: "sr-only", children: "(Current Page)" }) : ""
65
+ ]
56
66
  },
57
- children: o + 1
58
- },
59
- o
60
- );
61
- let s, a, n, c;
62
- e <= i || e < 5 ? (s = 1, a = e - 1, n = !1, c = !1) : r < i - 1 ? (s = 1, a = i, c = !0, n = !1) : r > e - i ? (s = e - i, a = e - 1, n = !0, c = !1) : (s = r - Math.floor(i / 2), a = s + i, n = s > 1, c = a < e);
63
- const { base: I, list: z, seperator: E, control: h, item: W, inputWrapper: A, goTo: R, input: T } = F({
67
+ s
68
+ );
69
+ };
70
+ let o, a, c, p;
71
+ e <= i || e < 5 ? (o = 1, a = e - 1, c = !1, p = !1) : r < i - 1 ? (o = 1, a = i, p = !0, c = !1) : r > e - i ? (o = e - i, a = e - 1, c = !0, p = !1) : (o = r - Math.floor(i / 2), a = o + i, c = o > 1, p = a < e);
72
+ const { base: j, list: z, seperator: E, control: v, item: A, inputWrapper: W, goTo: R, input: T } = F({
64
73
  slots: {
65
74
  base: "flex w-full flex-col items-center justify-center gap-4 md:flex-row",
66
75
  list: "flex items-center justify-center gap-4",
@@ -133,58 +142,65 @@ function Z({
133
142
  }
134
143
  ]
135
144
  })({
136
- color: g ?? "yellow",
137
- hideList: k ?? !1,
138
- hideInput: $ ?? !1
145
+ color: u ?? "yellow",
146
+ hideList: $ ?? !1,
147
+ hideInput: P ?? !1
139
148
  });
140
- return /* @__PURE__ */ u("div", { className: `uofg-pagination ${B(I(), L)}`, children: [
141
- /* @__PURE__ */ u("div", { className: `uofg-pagination-list ${z()}`, children: [
142
- /* @__PURE__ */ t(
149
+ return /* @__PURE__ */ l("div", { className: `uofg-pagination ${B(j(), k)}`, children: [
150
+ /* @__PURE__ */ l("div", { className: `uofg-pagination-list ${z()}`, children: [
151
+ /* @__PURE__ */ l(
143
152
  "button",
144
153
  {
145
154
  disabled: r <= 0,
146
- className: `uofg-pagination-previous ${h()}`,
147
- onClick: () => l(r - 1),
148
- children: /* @__PURE__ */ t(p, { icon: _ })
155
+ className: `uofg-pagination-previous ${v()}`,
156
+ onClick: () => n(r - 1),
157
+ children: [
158
+ /* @__PURE__ */ t(m, { icon: _ }),
159
+ /* @__PURE__ */ t("span", { className: "sr-only", children: "Previous Page" })
160
+ ]
149
161
  }
150
162
  ),
151
- m(0),
152
- n && /* @__PURE__ */ t(p, { icon: x }),
153
- C.slice(s, a).map(m),
154
- c && /* @__PURE__ */ t(p, { icon: x }),
155
- m(e - 1),
156
- /* @__PURE__ */ t(
163
+ d(0),
164
+ c && /* @__PURE__ */ t(m, { icon: y }),
165
+ M.slice(o, a).map(d),
166
+ p && /* @__PURE__ */ t(m, { icon: y }),
167
+ d(e - 1),
168
+ /* @__PURE__ */ l(
157
169
  "button",
158
170
  {
159
171
  disabled: r >= e - 1,
160
- className: `uofg-pagination-next ${h()}`,
161
- onClick: () => l(r + 1),
162
- children: /* @__PURE__ */ t(p, { icon: V })
172
+ className: `uofg-pagination-next ${v()}`,
173
+ onClick: () => n(r + 1),
174
+ children: [
175
+ /* @__PURE__ */ t(m, { icon: V }),
176
+ /* @__PURE__ */ t("span", { className: "sr-only", children: "Next Page" })
177
+ ]
163
178
  }
164
179
  )
165
180
  ] }),
166
181
  /* @__PURE__ */ t("span", { className: `uofg-pagination-seperator ${E()}` }),
167
- /* @__PURE__ */ u("div", { className: `uofg-pagination-go-to-wrapper ${A()}`, children: [
182
+ /* @__PURE__ */ l("div", { className: `uofg-pagination-go-to-wrapper ${W()}`, children: [
168
183
  /* @__PURE__ */ t(
169
184
  S,
170
185
  {
171
- color: g,
186
+ color: u,
172
187
  min: 1,
173
188
  max: e,
174
189
  value: r + 1,
175
- onInput: (o) => {
176
- j(isNaN(o) ? 0 : w(o - 1, 0, e - 1));
190
+ onInput: (s) => {
191
+ L(isNaN(s) ? 0 : N(s - 1, 0, e - 1));
177
192
  },
178
- className: `uofg-pagination-go-to-input ${T()}`
193
+ className: `uofg-pagination-go-to-input ${T()}`,
194
+ children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Input Page Number" })
179
195
  }
180
196
  ),
181
197
  /* @__PURE__ */ t(
182
198
  G,
183
199
  {
184
- color: g,
200
+ color: u,
185
201
  className: `uofg-pagination-go-to-button ${R()}`,
186
202
  onClick: () => {
187
- l(P);
203
+ n(I);
188
204
  },
189
205
  children: "Go to page"
190
206
  }
@@ -1,26 +1,26 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
3
3
  import { h as y } from "./regular-DmWV6rTj.js";
4
4
  import { FontAwesomeIcon as N } from "@fortawesome/react-fontawesome";
5
- import { Field as B, Label as E, Input as $ } from "@headlessui/react";
6
- import { useState as j, useRef as C, useEffect as I } from "react";
5
+ import { Field as B, Label as C, Input as E } from "@headlessui/react";
6
+ import { useState as $, useRef as j, useEffect as I } from "react";
7
7
  import { twMerge as k } from "tailwind-merge";
8
8
  import { tv as F } from "tailwind-variants";
9
9
  function P({
10
- initialValue: p = "",
11
- type: a = "text",
10
+ initialValue: c = "",
11
+ type: p = "text",
12
12
  placeholder: f = "",
13
13
  onInput: i,
14
- children: u,
14
+ children: s,
15
15
  className: m,
16
16
  hideClear: x,
17
- value: l,
17
+ value: u,
18
18
  ...b
19
19
  }) {
20
- const [n, s] = j(p), e = C(null);
20
+ const [n, a] = $(c), e = j(null);
21
21
  I(() => {
22
- s(l ?? "");
23
- }, [l]);
22
+ a(u ?? "");
23
+ }, [u]);
24
24
  const d = F({
25
25
  slots: {
26
26
  base: "flex flex-col gap-0.5",
@@ -40,26 +40,26 @@ function P({
40
40
  }
41
41
  }
42
42
  }
43
- }), { base: g, wrapper: w, input: h, clearButton: v } = d({ empty: (n == null ? void 0 : n.length) === 0 });
44
- return /* @__PURE__ */ c(B, { className: `uofg-text-input-field ${k(g(), m)}`, children: [
45
- u && /* @__PURE__ */ o(E, { className: "uofg-text-input-label", children: u }),
46
- /* @__PURE__ */ c("div", { className: `uofg-text-input-wrapper ${w()}`, children: [
43
+ }), { base: g, wrapper: h, input: w, clearButton: v } = d({ empty: (n == null ? void 0 : n.length) === 0 });
44
+ return /* @__PURE__ */ l(B, { className: `uofg-text-input-field ${k(g(), m)}`, children: [
45
+ s && /* @__PURE__ */ o(C, { className: "uofg-text-input-label", children: s }),
46
+ /* @__PURE__ */ l("div", { className: `uofg-text-input-wrapper ${h()}`, children: [
47
47
  /* @__PURE__ */ o(
48
- $,
48
+ E,
49
49
  {
50
50
  ...b,
51
51
  ref: e,
52
52
  value: n,
53
- type: a,
53
+ type: p,
54
54
  placeholder: f,
55
55
  onInput: (t) => {
56
56
  var r;
57
- s((r = t == null ? void 0 : t.target) == null ? void 0 : r.value), i == null || i(t);
57
+ a((r = t == null ? void 0 : t.target) == null ? void 0 : r.value), i == null || i(t);
58
58
  },
59
- className: `uofg-text-input ${h()}`
59
+ className: `uofg-text-input ${w()}`
60
60
  }
61
61
  ),
62
- /* @__PURE__ */ o(
62
+ /* @__PURE__ */ l(
63
63
  "button",
64
64
  {
65
65
  className: `uofg-text-input-clear-button ${v({ hide: x })}`,
@@ -69,7 +69,10 @@ function P({
69
69
  const t = (r = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")) == null ? void 0 : r.set;
70
70
  t == null || t.call(e.current, ""), e.current.dispatchEvent(new Event("input", { bubbles: !0 })), e.current.focus();
71
71
  },
72
- children: /* @__PURE__ */ o(N, { icon: y })
72
+ children: [
73
+ /* @__PURE__ */ o(N, { icon: y }),
74
+ /* @__PURE__ */ o("span", { className: "sr-only", children: "Clear text" })
75
+ ]
73
76
  }
74
77
  )
75
78
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uoguelph/react-components",
3
- "version": "1.4.1-rc.1",
3
+ "version": "1.4.1",
4
4
  "description": "University of Guelph React Components Library",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -76,5 +76,5 @@
76
76
  "bugs": {
77
77
  "url": "https://github.com/ccswbs/uofg-components/issues"
78
78
  },
79
- "gitHead": "5f87db7b7c445202fe19bc7c9a81aa7283039bcb"
79
+ "gitHead": "451236eee706208e21e88751876f83b7918e11d9"
80
80
  }