jcicl 1.0.7 → 1.0.9

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.
@@ -7,7 +7,7 @@ import { k as A, c as P } from "../.chunks/emotion-react.browser.esm.js";
7
7
  import { Button as q } from "../Button/Button.js";
8
8
  import { SlideOut as J, SlideIn as Q, SlideInReverse as z, SlideOutReverse as W } from "../animation/Slide/Slide.js";
9
9
  import { useThemeColors as Z } from "../ThemeContext.js";
10
- import { g as V, a as _, s as g, c as f, u as F, b as O, P as o, d as K, l as rr, j as er, k as tr } from "../.chunks/DefaultPropsProvider.js";
10
+ import { g as V, a as _, s as g, c as f, u as F, b as O, P as o, d as K, l as rr, k as er, m as tr } from "../.chunks/DefaultPropsProvider.js";
11
11
  import { m as w } from "../.chunks/memoTheme.js";
12
12
  import { P as or } from "../.chunks/Paper.js";
13
13
  import { u as ar } from "../.chunks/index.js";
@@ -0,0 +1,8 @@
1
+ export type ToastProps = {
2
+ type?: 'success' | 'warning' | 'error';
3
+ duration?: number;
4
+ onDismiss?: () => void;
5
+ message?: string;
6
+ };
7
+ declare const Toast: React.FC<ToastProps>;
8
+ export default Toast;
package/Toast/Toast.js ADDED
@@ -0,0 +1,154 @@
1
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
2
+ import { useState as f, useEffect as u } from "react";
3
+ import { n as l } from "../.chunks/emotion-styled.browser.esm.js";
4
+ import { c as a } from "../.chunks/emotion-react.browser.esm.js";
5
+ import e from "../theme.js";
6
+ import { c as m } from "../.chunks/createLucideIcon.js";
7
+ import { C as w, X as y } from "../.chunks/x.js";
8
+ /**
9
+ * @license lucide-react v0.525.0 - ISC
10
+ *
11
+ * This source code is licensed under the ISC license.
12
+ * See the LICENSE file in the root directory of this source tree.
13
+ */
14
+ const x = [
15
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
16
+ ["path", { d: "m4.9 4.9 14.2 14.2", key: "1m5liu" }]
17
+ ], k = m("ban", x);
18
+ /**
19
+ * @license lucide-react v0.525.0 - ISC
20
+ *
21
+ * This source code is licensed under the ISC license.
22
+ * See the LICENSE file in the root directory of this source tree.
23
+ */
24
+ const b = [
25
+ [
26
+ "path",
27
+ {
28
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
29
+ key: "wmoenq"
30
+ }
31
+ ],
32
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
33
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
34
+ ], $ = m("triangle-alert", b), T = l("div")(
35
+ ({ backgroundColor: o, open: r }) => ({
36
+ ...a`
37
+ background-color: ${o};
38
+ display: ${r ? "flex" : "none"} !important;
39
+ max-width: 400px;
40
+ font-family: ${e.fonts.roboto};
41
+ position: relative;
42
+ box-shadow: 3px 4px 4px 0 ${e.colors.gray3}80;
43
+ transition: opacity 0.3s ease;
44
+ align-content: center;
45
+
46
+ .close-button {
47
+ color: ${e.colors.charcoal};
48
+ }
49
+
50
+ .close-button:hover {
51
+ color: ${e.colors.gray3};
52
+ transition: stroke-width 0.3s ease;
53
+ stroke-width: 3;
54
+ }
55
+ `
56
+ })
57
+ ), v = l("div")(({ backgroundColor: o }) => ({
58
+ ...a`
59
+ display: flex;
60
+ background-color: ${o};
61
+ padding: 11px;
62
+ `
63
+ })), C = l("p")(() => ({
64
+ ...a`
65
+ color: ${e.colors.charcoal};
66
+ font-size: 11pt;
67
+ padding: 12px 15px;
68
+ margin: 0;
69
+ line-height: 1.5;
70
+ min-width: 70px;
71
+ width: 100%;
72
+ `
73
+ })), S = l("div")(({ duration: o, color: r }) => ({
74
+ ...a`
75
+ position: absolute;
76
+ bottom: 0;
77
+ left: 0;
78
+ width: 0;
79
+ height: 2px;
80
+ background: ${r};
81
+ animation: progress-animation ${o - 300}ms linear forwards;
82
+
83
+ @keyframes progress-animation {
84
+ 0% {
85
+ width: 0;
86
+ }
87
+ 100% {
88
+ width: 100%;
89
+ }
90
+ }
91
+ `
92
+ })), d = ({
93
+ icon: o,
94
+ message: r,
95
+ backgroundColor: c = e.colors.whiteGreenA,
96
+ color: t = e.colors.green,
97
+ onDismiss: s,
98
+ duration: i = 3e3,
99
+ open: p
100
+ }) => /* @__PURE__ */ h(T, { backgroundColor: c, color: t, open: p, children: [
101
+ /* @__PURE__ */ n(v, { backgroundColor: t, children: /* @__PURE__ */ n(o, { size: 25, strokeWidth: 2, style: { color: e.colors.white, alignSelf: "center" } }) }),
102
+ /* @__PURE__ */ h("div", { style: { display: "flex", position: "relative", alignItems: "center", width: "100%" }, children: [
103
+ /* @__PURE__ */ n(C, { children: r }),
104
+ /* @__PURE__ */ n(y, { size: 20, className: "close-button", onClick: s, style: { margin: "8px", minWidth: "20px" } }),
105
+ i > 0 && /* @__PURE__ */ n(S, { duration: i, color: t })
106
+ ] })
107
+ ] }), N = ({ duration: o = 3e3, message: r, type: c = "success", onDismiss: t }) => {
108
+ const [s, i] = f(!0), p = () => {
109
+ i(!1);
110
+ };
111
+ return t == null && (t = p), u(() => {
112
+ i(!0);
113
+ const g = setTimeout(() => {
114
+ o > 0 && i(!1);
115
+ }, o);
116
+ return () => clearTimeout(g);
117
+ }, [o, c]), c == "error" ? /* @__PURE__ */ n(
118
+ d,
119
+ {
120
+ icon: k,
121
+ message: r,
122
+ backgroundColor: e.colors.lighterRed,
123
+ color: e.colors.burgundy,
124
+ onDismiss: t,
125
+ duration: o,
126
+ open: s
127
+ }
128
+ ) : c == "warning" ? /* @__PURE__ */ n(
129
+ d,
130
+ {
131
+ icon: $,
132
+ message: r,
133
+ backgroundColor: e.colors.yellowLight,
134
+ color: e.colors.yellow,
135
+ onDismiss: t,
136
+ duration: o,
137
+ open: s
138
+ }
139
+ ) : /* @__PURE__ */ n(
140
+ d,
141
+ {
142
+ icon: w,
143
+ message: r,
144
+ backgroundColor: e.colors.whiteGreenA,
145
+ color: e.colors.green,
146
+ onDismiss: t,
147
+ duration: o,
148
+ open: s
149
+ }
150
+ );
151
+ };
152
+ export {
153
+ N as default
154
+ };
@@ -0,0 +1,4 @@
1
+ import { ToastItem } from '../../../../../../../../../src/components/composite/Toast/Toaster';
2
+ import { ToastProps } from '../../../../../../../../../src/components/composite/Toast/Toast';
3
+ export declare const handleDismissToast: (id: number, setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
4
+ export declare const showToast: (toast: ToastProps, setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
@@ -0,0 +1,10 @@
1
+ const n = (s, o) => {
2
+ o((t) => t.filter((i) => i.id !== s));
3
+ }, a = (s, o) => {
4
+ const t = Date.now();
5
+ o((i) => [...i, { ...s, id: t }]);
6
+ };
7
+ export {
8
+ n as handleDismissToast,
9
+ a as showToast
10
+ };
@@ -0,0 +1,9 @@
1
+ import { ToastProps } from './Toast';
2
+ export type ToastItem = ToastProps & {
3
+ id: number;
4
+ };
5
+ export type ToasterProps = {
6
+ toastQueue: ToastItem[];
7
+ onDismiss?: (id: number) => void;
8
+ };
9
+ export declare const Toaster: React.FC<ToasterProps>;
@@ -0,0 +1,25 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import m from "./Toast.js";
3
+ const x = ({ toastQueue: s = [], onDismiss: t }) => {
4
+ const r = (o) => {
5
+ t && t(o);
6
+ };
7
+ return /* @__PURE__ */ i(
8
+ "div",
9
+ {
10
+ style: {
11
+ position: "fixed",
12
+ bottom: 20,
13
+ right: 20,
14
+ display: "flex",
15
+ flexDirection: "column",
16
+ gap: "8px",
17
+ zIndex: 9999
18
+ },
19
+ children: s.map(({ id: o, ...e }) => /* @__PURE__ */ i(m, { ...e, onDismiss: () => r(o) }, o))
20
+ }
21
+ );
22
+ };
23
+ export {
24
+ x as Toaster
25
+ };
@@ -0,0 +1,3 @@
1
+ export { default, type ToastProps } from './Toast';
2
+ export { Toaster, type ToastItem } from './Toaster';
3
+ export { handleDismissToast, showToast } from './ToastHelpers';
package/Toast/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import { default as s } from "./Toast.js";
2
+ import { Toaster as e } from "./Toaster.js";
3
+ import { handleDismissToast as f, showToast as m } from "./ToastHelpers.js";
4
+ export {
5
+ e as Toaster,
6
+ s as default,
7
+ f as handleDismissToast,
8
+ m as showToast
9
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "1.0.7",
4
+ "version": "1.0.9",
5
5
  "description": "Component library for the websites of Johnson County Iowa",
6
6
  "license": "MIT",
7
7
  "homepage": "https://devops.jc.net/JCIT/Business%20Solutions%20Delivery/_git/JCComponentLibrary?path=%2FREADME.md&version=GBmaster",
package/theme.d.ts CHANGED
@@ -55,6 +55,8 @@ export interface ThemeColors {
55
55
  whiteGreenC: string;
56
56
  whiteGreenD: string;
57
57
  whiteBlue: string;
58
+ yellow: string;
59
+ yellowLight: string;
58
60
  }
59
61
  export interface ThemeBoxShadows extends Partial<ThemeColors> {
60
62
  black63?: string;
package/theme.js CHANGED
@@ -60,7 +60,9 @@ const e = {
60
60
  whiteGreenB: "#f0f8f0",
61
61
  whiteGreenC: "#e8f5e8",
62
62
  whiteGreenD: "#f8fff8",
63
- whiteBlue: "#f8f9fa"
63
+ whiteBlue: "#f8f9fa",
64
+ yellow: "#e3b50e",
65
+ yellowLight: "#f4edcd"
64
66
  },
65
67
  constants: {
66
68
  appHeaderHeight: 58,
@@ -83,21 +85,21 @@ const e = {
83
85
  };
84
86
  e.boxShadows = {
85
87
  ...Object.fromEntries(
86
- Object.keys(e.colors).map((r) => [
87
- r,
88
- `0 0 8px -2px ${e.colors[r]}`
88
+ Object.keys(e.colors).map((o) => [
89
+ o,
90
+ `0 0 8px -2px ${e.colors[o]}`
89
91
  ])
90
92
  ),
91
93
  ...Object.fromEntries(
92
- Object.keys(e.colors).map((r) => [
93
- `${r}Thick`,
94
- `0 0 2px 1px ${e.colors[r]}`
94
+ Object.keys(e.colors).map((o) => [
95
+ `${o}Thick`,
96
+ `0 0 2px 1px ${e.colors[o]}`
95
97
  ])
96
98
  ),
97
99
  black63: "0px 0px 2px 1px rgba(0, 0, 0, 0.63)",
98
100
  gray63: "0px 0px 2px 1px rgba(100, 100, 100, 0.63)"
99
101
  };
100
- const o = {
102
+ const r = {
101
103
  themeColor: e.colors.green,
102
104
  themeDark: e.colors.darkGreen,
103
105
  themeMediumA: e.colors.mint,
@@ -137,5 +139,5 @@ const o = {
137
139
  };
138
140
  export {
139
141
  e as default,
140
- o as defaultTheme
142
+ r as defaultTheme
141
143
  };