jcicl 1.0.9 → 1.0.11

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.
package/Toast/Toast.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { jsx as n, jsxs as h } from "react/jsx-runtime";
2
- import { useState as f, useEffect as u } from "react";
2
+ import { useState as g, useEffect as u } from "react";
3
3
  import { n as l } from "../.chunks/emotion-styled.browser.esm.js";
4
4
  import { c as a } from "../.chunks/emotion-react.browser.esm.js";
5
5
  import e from "../theme.js";
6
6
  import { c as m } from "../.chunks/createLucideIcon.js";
7
- import { C as w, X as y } from "../.chunks/x.js";
7
+ import { C as w } from "../.chunks/check.js";
8
+ import { X as y } from "../.chunks/x.js";
8
9
  /**
9
10
  * @license lucide-react v0.525.0 - ISC
10
11
  *
@@ -104,16 +105,16 @@ const b = [
104
105
  /* @__PURE__ */ n(y, { size: 20, className: "close-button", onClick: s, style: { margin: "8px", minWidth: "20px" } }),
105
106
  i > 0 && /* @__PURE__ */ n(S, { duration: i, color: t })
106
107
  ] })
107
- ] }), N = ({ duration: o = 3e3, message: r, type: c = "success", onDismiss: t }) => {
108
- const [s, i] = f(!0), p = () => {
108
+ ] }), B = ({ duration: o = 3e3, message: r, type: c = "success", onDismiss: t }) => {
109
+ const [s, i] = g(!0), p = () => {
109
110
  i(!1);
110
111
  };
111
112
  return t == null && (t = p), u(() => {
112
113
  i(!0);
113
- const g = setTimeout(() => {
114
+ const f = setTimeout(() => {
114
115
  o > 0 && i(!1);
115
116
  }, o);
116
- return () => clearTimeout(g);
117
+ return () => clearTimeout(f);
117
118
  }, [o, c]), c == "error" ? /* @__PURE__ */ n(
118
119
  d,
119
120
  {
@@ -150,5 +151,5 @@ const b = [
150
151
  );
151
152
  };
152
153
  export {
153
- N as default
154
+ B as default
154
155
  };
@@ -2,3 +2,5 @@ import { ToastItem } from '../../../../../../../../../src/components/composite/T
2
2
  import { ToastProps } from '../../../../../../../../../src/components/composite/Toast/Toast';
3
3
  export declare const handleDismissToast: (id: number, setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
4
4
  export declare const showToast: (toast: ToastProps, setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
5
+ export declare const saveToastForRedirect: (toast: ToastProps) => void;
6
+ export declare const showSavedToast: (setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
@@ -1,10 +1,25 @@
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 }]);
1
+ const a = (t, s) => {
2
+ s((e) => e.filter((o) => o.id !== t));
3
+ }, n = (t, s) => {
4
+ const e = Date.now();
5
+ s((o) => [...o, { ...t, id: e }]);
6
+ }, r = (t) => {
7
+ const s = {
8
+ type: t.type ?? "warning",
9
+ message: t.message ?? "Action complete",
10
+ duration: String(t.duration ?? 3e3)
11
+ };
12
+ sessionStorage.setItem("savedToast", JSON.stringify(s));
13
+ }, i = (t) => {
14
+ const s = JSON.parse(sessionStorage.getItem("savedToast") || "{}");
15
+ if (s.type !== "success" && s.type !== "warning" && s.type !== "error")
16
+ return;
17
+ const e = Date.now();
18
+ t((o) => [...o, { ...s, id: e }]), sessionStorage.removeItem("savedToast");
6
19
  };
7
20
  export {
8
- n as handleDismissToast,
9
- a as showToast
21
+ a as handleDismissToast,
22
+ r as saveToastForRedirect,
23
+ i as showSavedToast,
24
+ n as showToast
10
25
  };
package/Toast/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { default, type ToastProps } from './Toast';
2
2
  export { Toaster, type ToastItem } from './Toaster';
3
- export { handleDismissToast, showToast } from './ToastHelpers';
3
+ export { handleDismissToast, showToast, saveToastForRedirect, showSavedToast } from './ToastHelpers';
package/Toast/index.js CHANGED
@@ -1,9 +1,11 @@
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";
1
+ import { default as e } from "./Toast.js";
2
+ import { Toaster as a } from "./Toaster.js";
3
+ import { handleDismissToast as T, saveToastForRedirect as d, showSavedToast as f, showToast as m } from "./ToastHelpers.js";
4
4
  export {
5
- e as Toaster,
6
- s as default,
7
- f as handleDismissToast,
5
+ a as Toaster,
6
+ e as default,
7
+ T as handleDismissToast,
8
+ d as saveToastForRedirect,
9
+ f as showSavedToast,
8
10
  m as showToast
9
11
  };
@@ -1,14 +1,12 @@
1
1
  import { jsxs as Pe, jsx as C } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
3
  import { a as Qe, g as Ze, s as Y, c as Me, e as Ee, u as eo, b as I, P as o, d as oo } from "../.chunks/DefaultPropsProvider.js";
4
- import { u as to } from "../.chunks/index.js";
5
- import { a as ro } from "../.chunks/useTheme.js";
4
+ import { u as to, a as j } from "../.chunks/index.js";
5
+ import { a as ro, b as po, g as no, G as Re, e as so } from "../.chunks/Portal.js";
6
6
  import { m as G } from "../.chunks/memoTheme.js";
7
7
  import { P as $e } from "../.chunks/Popper.js";
8
- import { b as j, c as Re, a as po, T as no } from "../.chunks/TransitionGroupContext.js";
9
- import { u as so } from "../.chunks/useControlled.js";
10
- import { u as ao, g as io, G as Ce, e as lo } from "../.chunks/Portal.js";
11
- import { a as A } from "../.chunks/resolveComponentProps.js";
8
+ import { b as A, c as Ce, a as ao, T as io } from "../.chunks/TransitionGroupContext.js";
9
+ import { u as lo } from "../.chunks/useControlled.js";
12
10
  import { i as xe } from "../.chunks/isFocusVisible.js";
13
11
  function co(r) {
14
12
  return Ze("MuiTooltip", r);
@@ -278,7 +276,7 @@ const uo = (r) => {
278
276
  }
279
277
  })));
280
278
  let S = !1;
281
- const Oe = new no();
279
+ const Oe = new io();
282
280
  let R = {
283
281
  x: 0,
284
282
  y: 0
@@ -320,12 +318,12 @@ const Ne = /* @__PURE__ */ s.forwardRef(function(e, n) {
320
318
  slotProps: b = {},
321
319
  slots: O = {},
322
320
  title: f,
323
- TransitionComponent: Fe = Ce,
321
+ TransitionComponent: Fe = Re,
324
322
  TransitionProps: Ue,
325
323
  ...pe
326
324
  } = c, m = /* @__PURE__ */ s.isValidElement(h) ? h : /* @__PURE__ */ C("span", {
327
325
  children: h
328
- }), ne = ro(), We = to(), [a, se] = s.useState(), [F, Be] = s.useState(null), M = s.useRef(!1), U = je || k, ae = j(), W = j(), E = j(), ie = j(), [Ve, le] = so({
326
+ }), ne = ro(), We = to(), [a, se] = s.useState(), [F, Be] = s.useState(null), M = s.useRef(!1), U = je || k, ae = A(), W = A(), E = A(), ie = A(), [Ve, le] = lo({
329
327
  controlled: oe,
330
328
  default: !1,
331
329
  name: "Tooltip",
@@ -341,13 +339,13 @@ const Ne = /* @__PURE__ */ s.forwardRef(function(e, n) {
341
339
  `));
342
340
  }, [f, a, t]);
343
341
  }
344
- const B = ao(De), y = s.useRef(), $ = Re(() => {
342
+ const B = po(De), y = s.useRef(), $ = Ce(() => {
345
343
  y.current !== void 0 && (document.body.style.WebkitUserSelect = y.current, y.current = void 0), ie.clear();
346
344
  });
347
345
  s.useEffect(() => $, [$]);
348
346
  const ce = (t) => {
349
347
  Oe.clear(), S = !0, le(!0), ee && !d && ee(t);
350
- }, N = Re(
348
+ }, N = Ce(
351
349
  /**
352
350
  * @param {React.SyntheticEvent | Event} event
353
351
  */
@@ -393,7 +391,7 @@ const Ne = /* @__PURE__ */ s.forwardRef(function(e, n) {
393
391
  document.removeEventListener("keydown", t);
394
392
  };
395
393
  }, [N, d]);
396
- const He = po(io(m), se, n);
394
+ const He = ao(no(m), se, n);
397
395
  !f && f !== 0 && (d = !1);
398
396
  const z = s.useRef(), Ye = (t) => {
399
397
  const l = m.props;
@@ -443,17 +441,17 @@ const Ne = /* @__PURE__ */ s.forwardRef(function(e, n) {
443
441
  placement: te,
444
442
  PopperComponentProp: re,
445
443
  touch: M.current
446
- }, H = uo(P), he = O.popper ?? x.Popper ?? fo, ge = O.transition ?? x.Transition ?? Fe ?? Ce, be = O.tooltip ?? x.Tooltip ?? ho, Te = O.arrow ?? x.Arrow ?? go, qe = A(he, {
444
+ }, H = uo(P), he = O.popper ?? x.Popper ?? fo, ge = O.transition ?? x.Transition ?? Fe ?? Re, be = O.tooltip ?? x.Tooltip ?? ho, Te = O.arrow ?? x.Arrow ?? go, qe = j(he, {
447
445
  ...u,
448
446
  ...b.popper ?? g.popper,
449
447
  className: I(H.popper, u == null ? void 0 : u.className, (ye = b.popper ?? g.popper) == null ? void 0 : ye.className)
450
- }, P), Ke = A(ge, {
448
+ }, P), Ke = j(ge, {
451
449
  ...Ue,
452
450
  ...b.transition ?? g.transition
453
- }, P), Xe = A(be, {
451
+ }, P), Xe = j(be, {
454
452
  ...b.tooltip ?? g.tooltip,
455
453
  className: I(H.tooltip, (we = b.tooltip ?? g.tooltip) == null ? void 0 : we.className)
456
- }, P), Je = A(Te, {
454
+ }, P), Je = j(Te, {
457
455
  ...b.arrow ?? g.arrow,
458
456
  className: I(H.arrow, (ve = b.arrow ?? g.arrow) == null ? void 0 : ve.className)
459
457
  }, P);
@@ -508,7 +506,7 @@ process.env.NODE_ENV !== "production" && (Ne.propTypes = {
508
506
  /**
509
507
  * Tooltip reference element.
510
508
  */
511
- children: lo.isRequired,
509
+ children: so.isRequired,
512
510
  /**
513
511
  * Override or extend the styles applied to the component.
514
512
  */
@@ -686,7 +684,7 @@ process.env.NODE_ENV !== "production" && (Ne.propTypes = {
686
684
  */
687
685
  TransitionProps: o.object
688
686
  });
689
- const Eo = ({
687
+ const Oo = ({
690
688
  title: r,
691
689
  children: e,
692
690
  arrow: n = !0,
@@ -697,6 +695,6 @@ const Eo = ({
697
695
  return /* @__PURE__ */ C(Ne, { ...h, children: e });
698
696
  };
699
697
  export {
700
- Eo as Tooltip,
701
- Eo as default
698
+ Oo as Tooltip,
699
+ Oo as default
702
700
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "1.0.9",
4
+ "version": "1.0.11",
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/utils.d.ts CHANGED
@@ -7,3 +7,4 @@ export declare const formatAddress: (address: {
7
7
  zip?: string | null;
8
8
  }) => string;
9
9
  export declare const formatTimestamp: (timestamp: string) => string;
10
+ export declare const formatPhoneNumber: (number: string | undefined) => [string, string | undefined];
package/utils.js CHANGED
@@ -1,14 +1,14 @@
1
- const d = (t, e = "mmddyyyy") => e === "mmddyyyy" ? new Date(t).toLocaleDateString("en-US", {
1
+ const h = (e, t = "mmddyyyy") => t === "mmddyyyy" ? new Date(e).toLocaleDateString("en-US", {
2
2
  month: "numeric",
3
3
  day: "numeric",
4
4
  year: "numeric"
5
- }) : t, y = (t) => {
6
- const { line1: e, line2: o, city: n, state: a, zip: s } = t;
7
- let r = e;
8
- return o && (r += `, ${o}`), n && (r += `, ${n}`), a && (r += `, ${a}`), s && (r += ` ${s}`), r;
9
- }, m = (t) => {
10
- if (t > 3 && t < 21) return "th";
11
- switch (t % 10) {
5
+ }) : e, g = (e) => {
6
+ const { line1: t, line2: o, city: i, state: n, zip: c } = e;
7
+ let r = t;
8
+ return o && (r += `, ${o}`), i && (r += `, ${i}`), n && (r += `, ${n}`), c && (r += ` ${c}`), r;
9
+ }, $ = (e) => {
10
+ if (e > 3 && e < 21) return "th";
11
+ switch (e % 10) {
12
12
  case 1:
13
13
  return "st";
14
14
  case 2:
@@ -18,16 +18,35 @@ const d = (t, e = "mmddyyyy") => e === "mmddyyyy" ? new Date(t).toLocaleDateStri
18
18
  default:
19
19
  return "th";
20
20
  }
21
- }, f = (t) => {
21
+ }, p = (e) => {
22
22
  try {
23
- const e = new Date(t), o = e.toLocaleDateString("en-US", { month: "short" }) + ".", n = e.getDate(), a = m(n), s = e.getFullYear(), r = e.getHours(), c = e.getMinutes().toString().padStart(2, "0"), i = r % 12 || 12, u = r >= 12 ? "pm" : "am";
24
- return `${o} ${n}${a}, ${s}, ${i}:${c}${u}`;
23
+ const t = /* @__PURE__ */ new Date(e.replace(" ", "T") + "Z"), i = new Intl.DateTimeFormat("en-US", {
24
+ timeZone: "America/Chicago",
25
+ month: "short",
26
+ day: "numeric",
27
+ year: "numeric",
28
+ hour: "numeric",
29
+ minute: "2-digit",
30
+ hour12: !0
31
+ }).formatToParts(t), n = (l) => {
32
+ var a;
33
+ return ((a = i.find((y) => y.type === l)) == null ? void 0 : a.value) ?? "";
34
+ }, c = n("month") + ".", r = Number(n("day")), s = n("year"), m = n("hour"), u = n("minute"), d = n("dayPeriod").toLowerCase(), f = $(r);
35
+ return `${c} ${r}${f}, ${s}, ${m}:${u}${d}`;
25
36
  } catch {
26
- return t;
37
+ return e;
27
38
  }
39
+ }, D = (e) => {
40
+ if (e == null) return ["", void 0];
41
+ let t = e.replace(/\D/g, "") || "";
42
+ t.at(0) == "1" && (t = t.slice(1));
43
+ const o = t.slice(0, 3), i = t.slice(3, 6), n = t.slice(6, 10), c = t.slice(10);
44
+ let r = t;
45
+ return t.length >= 4 && (r = `(${o}) ${t.slice(3)}`), t.length >= 7 && (r = `(${o}) ${i}-${t.slice(6)}`), t.length > 10 && (r = `(${o}) ${i}-${n} ext. ${c}`), [r, t];
28
46
  };
29
47
  export {
30
- y as formatAddress,
31
- d as formatDate,
32
- f as formatTimestamp
48
+ g as formatAddress,
49
+ h as formatDate,
50
+ D as formatPhoneNumber,
51
+ p as formatTimestamp
33
52
  };
@@ -1,80 +0,0 @@
1
- import { b as l } from "./DefaultPropsProvider.js";
2
- function O(s) {
3
- return typeof s == "string";
4
- }
5
- function A(s, c, e) {
6
- return s === void 0 || O(s) ? c : {
7
- ...c,
8
- ownerState: {
9
- ...c.ownerState,
10
- ...e
11
- }
12
- };
13
- }
14
- function k(s, c = []) {
15
- if (s === void 0)
16
- return {};
17
- const e = {};
18
- return Object.keys(s).filter((n) => n.match(/^on[A-Z]/) && typeof s[n] == "function" && !c.includes(n)).forEach((n) => {
19
- e[n] = s[n];
20
- }), e;
21
- }
22
- function a(s) {
23
- if (s === void 0)
24
- return {};
25
- const c = {};
26
- return Object.keys(s).filter((e) => !(e.match(/^on[A-Z]/) && typeof s[e] == "function")).forEach((e) => {
27
- c[e] = s[e];
28
- }), c;
29
- }
30
- function R(s) {
31
- const {
32
- getSlotProps: c,
33
- additionalProps: e,
34
- externalSlotProps: n,
35
- externalForwardedProps: t,
36
- className: i
37
- } = s;
38
- if (!c) {
39
- const g = l(e == null ? void 0 : e.className, i, t == null ? void 0 : t.className, n == null ? void 0 : n.className), h = {
40
- ...e == null ? void 0 : e.style,
41
- ...t == null ? void 0 : t.style,
42
- ...n == null ? void 0 : n.style
43
- }, m = {
44
- ...e,
45
- ...t,
46
- ...n
47
- };
48
- return g.length > 0 && (m.className = g), Object.keys(h).length > 0 && (m.style = h), {
49
- props: m,
50
- internalRef: void 0
51
- };
52
- }
53
- const v = k({
54
- ...t,
55
- ...n
56
- }), E = a(n), H = a(t), f = c(v), y = l(f == null ? void 0 : f.className, e == null ? void 0 : e.className, i, t == null ? void 0 : t.className, n == null ? void 0 : n.className), N = {
57
- ...f == null ? void 0 : f.style,
58
- ...e == null ? void 0 : e.style,
59
- ...t == null ? void 0 : t.style,
60
- ...n == null ? void 0 : n.style
61
- }, u = {
62
- ...f,
63
- ...e,
64
- ...H,
65
- ...E
66
- };
67
- return y.length > 0 && (u.className = y), Object.keys(N).length > 0 && (u.style = N), {
68
- props: u,
69
- internalRef: f.ref
70
- };
71
- }
72
- function W(s, c, e) {
73
- return typeof s == "function" ? s(c, e) : s;
74
- }
75
- export {
76
- A as a,
77
- k as e,
78
- R as m,
79
- W as r
80
- };
@@ -1,23 +0,0 @@
1
- import * as n from "react";
2
- import { h as s, T as o, i as u } from "./DefaultPropsProvider.js";
3
- import { T as r } from "./emotion-styled.browser.esm.js";
4
- function m(e) {
5
- return Object.keys(e).length === 0;
6
- }
7
- function a(e = null) {
8
- const t = n.useContext(r);
9
- return !t || m(t) ? e : t;
10
- }
11
- const c = s();
12
- function h(e = c) {
13
- return a(e);
14
- }
15
- function f() {
16
- const e = h(u);
17
- return process.env.NODE_ENV !== "production" && n.useDebugValue(e), e[o] || e;
18
- }
19
- export {
20
- f as a,
21
- h as b,
22
- a as u
23
- };