@uoguelph/react-components 1.10.3-rc.0 → 1.10.3-rc.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,6 +1,7 @@
1
1
  import { toast } from './toaster-store';
2
2
  export type ToasterProps = {
3
3
  limit?: number;
4
+ className?: string;
4
5
  };
5
- export declare function Toaster({ limit }: ToasterProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Toaster({ limit, className }: ToasterProps): import("react/jsx-runtime").JSX.Element;
6
7
  export { toast };
package/dist/toaster.js CHANGED
@@ -1,34 +1,34 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import { jsx as o, jsxs as d } from "react/jsx-runtime";
3
3
  import { e as h, d as y, o as x, g as w } from "./solid-CpJcQLq3.js";
4
- import { FontAwesomeIcon as i } from "@fortawesome/react-fontawesome";
4
+ import { FontAwesomeIcon as n } from "@fortawesome/react-fontawesome";
5
5
  import { useEffect as f, useRef as S, useState as b } from "react";
6
6
  import { TransitionGroup as C, CSSTransition as T } from "react-transition-group";
7
- import { twJoin as v } from "tailwind-merge";
7
+ import { twMerge as v } from "tailwind-merge";
8
8
  import { tv as N } from "tailwind-variants";
9
9
  import { useToaster as A, toast as F } from "./toaster-store.js";
10
- function X({ toast: t, onRemove: n, ...r }) {
11
- const a = S(null);
12
- return /* @__PURE__ */ e(T, { ...r, nodeRef: a, timeout: 300, classNames: "uofg-toast-transition", children: /* @__PURE__ */ e(k, { toast: t, onRemove: n, nodeRef: a }) });
10
+ function X({ toast: t, onRemove: a, ...r }) {
11
+ const s = S(null);
12
+ return /* @__PURE__ */ o(T, { ...r, nodeRef: s, timeout: 300, classNames: "uofg-toast-transition", children: /* @__PURE__ */ o(k, { toast: t, onRemove: a, nodeRef: s }) });
13
13
  }
14
14
  function k({
15
15
  toast: t,
16
- onRemove: n,
16
+ onRemove: a,
17
17
  nodeRef: r
18
18
  }) {
19
- const [a, o] = b(100);
19
+ const [s, i] = b(100);
20
20
  f(() => {
21
21
  const u = performance.now();
22
22
  let c;
23
23
  const m = (p) => {
24
24
  const g = p - u, l = Math.max(0, 100 - g / t.timeout * 100);
25
- o(l), l > 0 && (c = requestAnimationFrame(m));
25
+ i(l), l > 0 && (c = requestAnimationFrame(m));
26
26
  };
27
27
  return c = requestAnimationFrame(m), () => {
28
28
  cancelAnimationFrame(c);
29
29
  };
30
30
  }, [t.timeout]);
31
- const s = N({
31
+ const e = N({
32
32
  slots: {
33
33
  toast: "uofg-toast relative flex w-full max-w-[50ch] gap-2 overflow-hidden p-6 text-left text-lg sm:w-fit",
34
34
  progress: "uofg-toast-progress absolute right-0 bottom-0 left-0 h-1 origin-left bg-current opacity-70",
@@ -52,13 +52,13 @@ function k({
52
52
  }
53
53
  }
54
54
  })({ type: t.type });
55
- return /* @__PURE__ */ d("button", { onClick: () => n(t.id), ref: r, className: s.toast(), children: [
56
- t.type === "info" && /* @__PURE__ */ e(i, { className: s.icon(), icon: h }),
57
- t.type === "success" && /* @__PURE__ */ e(i, { className: s.icon(), icon: y }),
58
- t.type === "warning" && /* @__PURE__ */ e(i, { className: s.icon(), icon: x }),
59
- t.type === "error" && /* @__PURE__ */ e(i, { className: s.icon(), icon: w }),
60
- /* @__PURE__ */ e("span", { className: s.message(), children: t.message }),
61
- /* @__PURE__ */ e("span", { className: s.progress(), style: { width: `${a}%` }, "aria-hidden": "true" })
55
+ return /* @__PURE__ */ d("button", { onClick: () => a(t.id), ref: r, className: e.toast(), children: [
56
+ t.type === "info" && /* @__PURE__ */ o(n, { className: e.icon(), icon: h }),
57
+ t.type === "success" && /* @__PURE__ */ o(n, { className: e.icon(), icon: y }),
58
+ t.type === "warning" && /* @__PURE__ */ o(n, { className: e.icon(), icon: x }),
59
+ t.type === "error" && /* @__PURE__ */ o(n, { className: e.icon(), icon: w }),
60
+ /* @__PURE__ */ o("span", { className: e.message(), children: t.message }),
61
+ /* @__PURE__ */ o("span", { className: e.progress(), style: { width: `${s}%` }, "aria-hidden": "true" })
62
62
  ] });
63
63
  }
64
64
  const P = `
@@ -86,16 +86,16 @@ const P = `
86
86
  transform 300ms ease;
87
87
  }
88
88
  `;
89
- function M({ limit: t = 5 }) {
90
- const r = A().slice(-t);
89
+ function $({ limit: t = 5, className: a }) {
90
+ const s = A().slice(-t);
91
91
  f(() => {
92
92
  "CSSStyleSheet" in window || console.error(
93
93
  "@uoguelph/react-components: Toaster animations will not work because Constructable Stylesheets is not supported in this browser"
94
94
  );
95
- const o = new CSSStyleSheet();
96
- o.replaceSync(P), document.adoptedStyleSheets.push(o);
95
+ const e = new CSSStyleSheet();
96
+ e.replaceSync(P), document.adoptedStyleSheets.push(e);
97
97
  }, []);
98
- const a = v(
98
+ const i = v(
99
99
  "uofg-toaster",
100
100
  "fixed",
101
101
  "h-fit",
@@ -112,11 +112,12 @@ function M({ limit: t = 5 }) {
112
112
  "w-full",
113
113
  "flex-col",
114
114
  "items-end",
115
- "gap-3"
115
+ "gap-3",
116
+ a
116
117
  );
117
- return /* @__PURE__ */ e(C, { component: "div", className: a, children: r.map((o) => /* @__PURE__ */ e(X, { toast: o, onRemove: F.remove }, o.id)) });
118
+ return /* @__PURE__ */ o(C, { component: "div", className: i, children: s.map((e) => /* @__PURE__ */ o(X, { toast: e, onRemove: F.remove }, e.id)) });
118
119
  }
119
120
  export {
120
- M as Toaster,
121
+ $ as Toaster,
121
122
  F as toast
122
123
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uoguelph/react-components",
3
- "version": "1.10.3-rc.0",
3
+ "version": "1.10.3-rc.1",
4
4
  "description": "University of Guelph React Components Library",
5
5
  "type": "module",
6
6
  "scripts": {