@uoguelph/react-components 1.10.0-rc.3 → 1.10.0-rc.4

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/toaster.js +29 -28
  2. package/package.json +1 -1
package/dist/toaster.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as o, jsxs as y } from "react/jsx-runtime";
2
3
  import { e as T, d as v, o as N, g as C } from "./solid-CpJcQLq3.js";
3
4
  import { FontAwesomeIcon as c } from "@fortawesome/react-fontawesome";
@@ -9,28 +10,28 @@ import { tv as q } from "tailwind-variants";
9
10
  let i = [];
10
11
  const f = /* @__PURE__ */ new Set();
11
12
  function d() {
12
- f.forEach((t) => t());
13
+ f.forEach((e) => e());
13
14
  }
14
- function p(t) {
15
- i = i.filter((e) => e.id !== t), d();
15
+ function p(e) {
16
+ i = i.filter((t) => t.id !== e), d();
16
17
  }
17
- function a(t, e = "info", s = 3e3) {
18
+ function a(e, t = "info", s = 3e3) {
18
19
  const n = S();
19
20
  i = [
20
21
  ...i,
21
22
  {
22
23
  id: n,
23
- message: t,
24
- type: e,
24
+ message: e,
25
+ type: t,
25
26
  timeout: s
26
27
  }
27
28
  ], d(), window.setTimeout(() => {
28
29
  p(n);
29
30
  }, s);
30
31
  }
31
- function I(t) {
32
- return f.add(t), () => {
33
- f.delete(t);
32
+ function I(e) {
33
+ return f.add(e), () => {
34
+ f.delete(e);
34
35
  };
35
36
  }
36
37
  function g() {
@@ -42,18 +43,18 @@ function z() {
42
43
  const G = {
43
44
  add: a,
44
45
  remove: p,
45
- info: (t, e) => a(t, "info", e),
46
- success: (t, e) => a(t, "success", e),
47
- warning: (t, e) => a(t, "warning", e),
48
- error: (t, e) => a(t, "error", e)
46
+ info: (e, t) => a(e, "info", t),
47
+ success: (e, t) => a(e, "success", t),
48
+ warning: (e, t) => a(e, "warning", t),
49
+ error: (e, t) => a(e, "error", t)
49
50
  };
50
- function J({ toast: t, onRemove: e, ...s }) {
51
+ function J({ toast: e, onRemove: t, ...s }) {
51
52
  const n = F(null);
52
- return /* @__PURE__ */ o(R, { ...s, nodeRef: n, timeout: 300, classNames: "uofg-toast-transition", children: /* @__PURE__ */ o(M, { toast: t, onRemove: e, nodeRef: n }) });
53
+ return /* @__PURE__ */ o(R, { ...s, nodeRef: n, timeout: 300, classNames: "uofg-toast-transition", children: /* @__PURE__ */ o(M, { toast: e, onRemove: t, nodeRef: n }) });
53
54
  }
54
55
  function M({
55
- toast: t,
56
- onRemove: e,
56
+ toast: e,
57
+ onRemove: t,
57
58
  nodeRef: s
58
59
  }) {
59
60
  const [n, x] = E(100);
@@ -61,13 +62,13 @@ function M({
61
62
  const h = performance.now();
62
63
  let m;
63
64
  const l = (w) => {
64
- const b = w - h, u = Math.max(0, 100 - b / t.timeout * 100);
65
+ const b = w - h, u = Math.max(0, 100 - b / e.timeout * 100);
65
66
  x(u), u > 0 && (m = requestAnimationFrame(l));
66
67
  };
67
68
  return m = requestAnimationFrame(l), () => {
68
69
  cancelAnimationFrame(m);
69
70
  };
70
- }, [t.timeout]);
71
+ }, [e.timeout]);
71
72
  const r = q({
72
73
  slots: {
73
74
  toast: "uofg-toast relative flex max-w-[50ch] gap-2 overflow-hidden p-6 text-left text-lg",
@@ -91,18 +92,18 @@ function M({
91
92
  }
92
93
  }
93
94
  }
94
- })({ type: t.type });
95
- return /* @__PURE__ */ y("button", { onClick: () => e(t.id), ref: s, className: r.toast(), children: [
96
- t.type === "info" && /* @__PURE__ */ o(c, { className: r.icon(), icon: T }),
97
- t.type === "success" && /* @__PURE__ */ o(c, { className: r.icon(), icon: v }),
98
- t.type === "warning" && /* @__PURE__ */ o(c, { className: r.icon(), icon: N }),
99
- t.type === "error" && /* @__PURE__ */ o(c, { className: r.icon(), icon: C }),
100
- /* @__PURE__ */ o("span", { className: r.message(), children: t.message }),
95
+ })({ type: e.type });
96
+ return /* @__PURE__ */ y("button", { onClick: () => t(e.id), ref: s, className: r.toast(), children: [
97
+ e.type === "info" && /* @__PURE__ */ o(c, { className: r.icon(), icon: T }),
98
+ e.type === "success" && /* @__PURE__ */ o(c, { className: r.icon(), icon: v }),
99
+ e.type === "warning" && /* @__PURE__ */ o(c, { className: r.icon(), icon: N }),
100
+ e.type === "error" && /* @__PURE__ */ o(c, { className: r.icon(), icon: C }),
101
+ /* @__PURE__ */ o("span", { className: r.message(), children: e.message }),
101
102
  /* @__PURE__ */ o("span", { className: r.progress(), style: { width: `${n}%` }, "aria-hidden": "true" })
102
103
  ] });
103
104
  }
104
105
  function Q() {
105
- const t = z(), e = j(
106
+ const e = z(), t = j(
106
107
  "uofg-toaster",
107
108
  "fixed",
108
109
  "right-4",
@@ -114,7 +115,7 @@ function Q() {
114
115
  "items-end",
115
116
  "gap-3"
116
117
  );
117
- return /* @__PURE__ */ o(P, { component: "div", className: e, children: t.map((s) => /* @__PURE__ */ o(J, { toast: s, onRemove: G.remove }, s.id)) });
118
+ return /* @__PURE__ */ o(P, { component: "div", className: t, children: e.map((s) => /* @__PURE__ */ o(J, { toast: s, onRemove: G.remove }, s.id)) });
118
119
  }
119
120
  export {
120
121
  Q as Toaster,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uoguelph/react-components",
3
- "version": "1.10.0-rc.3",
3
+ "version": "1.10.0-rc.4",
4
4
  "description": "University of Guelph React Components Library",
5
5
  "type": "module",
6
6
  "scripts": {