jcicl 1.0.61 → 1.0.63

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.
@@ -819,6 +819,10 @@ const Pe = de(/* @__PURE__ */ i("path", {
819
819
  top: ${r.constants.appHeaderHeight}px;
820
820
  background-color: transparent;
821
821
  }
822
+
823
+ .MuiDrawer-root {
824
+ z-index: 13000;
825
+ }
822
826
  `
823
827
  })), rr = ({
824
828
  navProps: e,
@@ -1,38 +1,46 @@
1
- import { useState as n, useRef as R, useEffect as b, useCallback as d } from "react";
1
+ import { useState as r, useRef as R, useEffect as F, useCallback as d } from "react";
2
2
  const g = Symbol("DataPageResult");
3
- function S(e, a) {
4
- return { [g]: !0, data: e, warnings: a };
3
+ function P(t, u) {
4
+ return { [g]: !0, data: t, warnings: u };
5
5
  }
6
- const x = (e) => e == null ? !0 : Array.isArray(e) ? e.length === 0 : !1;
7
- function F({ fetchFn: e, deps: a = [] }) {
8
- const [y, c] = n(null), [h, u] = n(!0), [w, o] = n(null), [A, l] = n([]), [E, m] = n(0), f = R(e);
9
- f.current = e, b(() => {
10
- let t = !1;
11
- return u(!0), o(null), l([]), (async () => {
6
+ const S = (t) => t == null ? !0 : Array.isArray(t) ? t.length === 0 : !1;
7
+ function W({ fetchFn: t, deps: u = [] }) {
8
+ const [h, c] = r(null), [y, i] = r(!0), [w, a] = r(null), [m, f] = r([]), [A, E] = r(0), l = R(t);
9
+ l.current = t, F(() => {
10
+ let n = !1;
11
+ return i(!0), a(null), f([]), (async () => {
12
12
  try {
13
- const r = await f.current();
14
- if (t) return;
15
- if (r && typeof r == "object" && g in r) {
16
- const i = r;
17
- c(i.data), l(i.warnings);
13
+ const e = await l.current();
14
+ if (n) return;
15
+ if (e === void 0) {
16
+ a("fetchFn returned undefined — did you forget a return statement?");
17
+ return;
18
+ }
19
+ if (e && typeof e == "object" && g in e) {
20
+ const o = e;
21
+ if (o.data === void 0) {
22
+ a("fetchFn returned undefined data inside withWarnings()");
23
+ return;
24
+ }
25
+ c(o.data), f(o.warnings);
18
26
  } else
19
- c(r);
20
- } catch (r) {
21
- t || o(r instanceof Error ? r.message : "An unexpected error occurred");
27
+ c(e);
28
+ } catch (e) {
29
+ n || a(e instanceof Error ? e.message : "An unexpected error occurred");
22
30
  } finally {
23
- t || u(!1);
31
+ n || i(!1);
24
32
  }
25
33
  })(), () => {
26
- t = !0;
34
+ n = !0;
27
35
  };
28
- }, [...a, E]);
29
- const p = d((t) => {
30
- c((s) => s !== null ? t(s) : s);
31
- }, []), D = d(() => m((t) => t + 1), []);
32
- return { data: y, loading: h, error: w, warnings: A, setData: p, refetch: D };
36
+ }, [...u, A]);
37
+ const p = d((n) => {
38
+ c((s) => s !== null ? n(s) : s);
39
+ }, []), D = d(() => E((n) => n + 1), []);
40
+ return { data: h, loading: y, error: w, warnings: m, setData: p, refetch: D };
33
41
  }
34
42
  export {
35
- F as default,
36
- x as defaultIsEmpty,
37
- S as withWarnings
43
+ W as default,
44
+ S as defaultIsEmpty,
45
+ P as withWarnings
38
46
  };
@@ -19,6 +19,8 @@ export type DefaultTemplateProps = AppContainerProps & {
19
19
  hasPagination?: boolean;
20
20
  fade?: boolean;
21
21
  siteBannerText?: string;
22
+ siteBannerBackgroundColor?: string;
23
+ siteBannerTextColor?: string;
22
24
  };
23
25
  declare const DefaultTemplate: React.FC<PropsWithChildren<DefaultTemplateProps>>;
24
26
  export default DefaultTemplate;
@@ -1,25 +1,25 @@
1
- import { jsx as r, jsxs as g, Fragment as $ } from "react/jsx-runtime";
2
- import { useState as S, useMemo as z } from "react";
1
+ import { jsx as r, jsxs as g, Fragment as O } from "react/jsx-runtime";
2
+ import { useState as b, useMemo as A } from "react";
3
3
  import { n as y } from "../.chunks/emotion-styled.browser.esm.js";
4
4
  import { c as C } from "../.chunks/emotion-react.browser.esm.js";
5
- import t, { defaultTheme as T } from "../theme.js";
5
+ import o, { defaultTheme as T } from "../theme.js";
6
6
  import { getHueFromHex as u, updateTheme as p } from "../themeUtils.js";
7
- import { ThemeContext as O } from "../ThemeContext.js";
8
- import A from "../AppContainer/AppContainer.js";
9
- import L from "../WithLoading/WithLoading.js";
10
- import { TopFade as j, BottomFade as D } from "../Overlays/Overlays.js";
11
- import { SiteBanner as W } from "../SiteBanner/SiteBanner.js";
12
- import { P as B } from "../.chunks/AppHeader.js";
13
- import { u as b } from "../.chunks/useMediaQuery.js";
14
- const H = ["loading", "hasPagination", "loadingColor", "hasFade", "isTablet"], G = y("div", { shouldForwardProp: (o) => !H.includes(o) })(({ loading: o, hasPagination: i, hasFade: m, loadingColor: l = t.colors.green }) => ({
7
+ import { ThemeContext as L } from "../ThemeContext.js";
8
+ import j from "../AppContainer/AppContainer.js";
9
+ import D from "../WithLoading/WithLoading.js";
10
+ import { TopFade as W, BottomFade as B } from "../Overlays/Overlays.js";
11
+ import { SiteBanner as H } from "../SiteBanner/SiteBanner.js";
12
+ import { P as G } from "../.chunks/AppHeader.js";
13
+ import { u as S } from "../.chunks/useMediaQuery.js";
14
+ const Q = ["loading", "hasPagination", "loadingColor", "hasFade", "isTablet"], N = y("div", { shouldForwardProp: (t) => !Q.includes(t) })(({ loading: t, hasPagination: i, hasFade: m, loadingColor: l = o.colors.green }) => ({
15
15
  ...C`
16
- color: ${t.colors.midnight};
17
- height: ${o ? "100%" : "auto"};
16
+ color: ${o.colors.midnight};
17
+ height: ${t ? "100%" : "auto"};
18
18
  padding: 19px;
19
19
  padding-top: 36px;
20
20
  display: flex;
21
21
  flex-direction: column;
22
- justify-content: ${o ? "center" : "start"};
22
+ justify-content: ${t ? "center" : "start"};
23
23
  align-items: center;
24
24
  width: 100%;
25
25
  min-height: 100%;
@@ -33,7 +33,7 @@ const H = ["loading", "hasPagination", "loadingColor", "hasFade", "isTablet"], G
33
33
  color: ${l};
34
34
  }
35
35
  `
36
- })), Q = y("div")(() => ({
36
+ })), q = y("div")(() => ({
37
37
  ...C`
38
38
  border-radius: 8px;
39
39
  padding: 0;
@@ -47,25 +47,27 @@ const H = ["loading", "hasPagination", "loadingColor", "hasFade", "isTablet"], G
47
47
  box-sizing: border-box;
48
48
  `
49
49
  }));
50
- function N(o, i) {
51
- return o == "green" ? T : p(i);
50
+ function E(t, i) {
51
+ return t == "green" ? T : p(i);
52
52
  }
53
- const oe = ({
54
- children: o,
53
+ const ie = ({
54
+ children: t,
55
55
  loading: i = !1,
56
56
  hasPagination: m = !1,
57
57
  fade: l = !0,
58
58
  siteBannerText: n,
59
- userProfileMenuItems: w,
59
+ siteBannerBackgroundColor: w,
60
+ siteBannerTextColor: k,
61
+ userProfileMenuItems: I,
60
62
  ...s
61
63
  }) => {
62
- const I = localStorage.getItem("theme") || "green", f = localStorage.getItem("hue") || u(t.themeOptions.green).toString(), x = b(`(max-width: ${t.screenSizes.mobile})`), M = b(`(max-width: ${t.screenSizes.tablet})`), [e, d] = S(
63
- () => N(I, parseFloat(f))
64
- ), [P, c] = S({ h: Math.max(parseFloat(f), 0) * 360, s: 0, v: 68, a: 1 }), k = [
64
+ const M = localStorage.getItem("theme") || "green", f = localStorage.getItem("hue") || u(o.themeOptions.green).toString(), x = S(`(max-width: ${o.screenSizes.mobile})`), P = S(`(max-width: ${o.screenSizes.tablet})`), [e, d] = b(
65
+ () => E(M, parseFloat(f))
66
+ ), [v, c] = b({ h: Math.max(parseFloat(f), 0) * 360, s: 0, v: 68, a: 1 }), F = [
65
67
  {
66
68
  label: "Default Theme",
67
69
  onClick: () => {
68
- localStorage.setItem("theme", "green"), localStorage.setItem("hue", u(t.themeOptions.green).toString()), c((h) => ({ ...h, h: u(t.themeOptions.green) * 360 })), d(T);
70
+ localStorage.setItem("theme", "green"), localStorage.setItem("hue", u(o.themeOptions.green).toString()), c((h) => ({ ...h, h: u(o.themeOptions.green) * 360 })), d(T);
69
71
  }
70
72
  },
71
73
  {
@@ -78,15 +80,15 @@ const oe = ({
78
80
  },
79
81
  {
80
82
  label: "Hue",
81
- hue: P.h,
83
+ hue: v.h,
82
84
  onChange: (a) => {
83
- localStorage.setItem("theme", "custom"), localStorage.setItem("hue", (a.h / 360).toString()), c((F) => ({ ...F, h: a.h }));
85
+ localStorage.setItem("theme", "custom"), localStorage.setItem("hue", (a.h / 360).toString()), c((z) => ({ ...z, h: a.h }));
84
86
  const h = p(a.h / 360);
85
87
  d(h);
86
88
  }
87
89
  },
88
- ...w || []
89
- ], v = z(
90
+ ...I || []
91
+ ], $ = A(
90
92
  () => ({
91
93
  backgroundPrimary: e.themeLight,
92
94
  backgroundSecondary: e.themeLightA,
@@ -100,9 +102,9 @@ const oe = ({
100
102
  scrollColor: e.themeShadowA,
101
103
  loadingColor: e.themeColor,
102
104
  iconColors: {
103
- icon: /* @__PURE__ */ r(B, {}),
104
- iconColor: e.themeDark ?? t.colors.darkGreen,
105
- backgroundColor: e.themeMediumA ?? t.colors.mint
105
+ icon: /* @__PURE__ */ r(G, {}),
106
+ iconColor: e.themeDark ?? o.colors.darkGreen,
107
+ backgroundColor: e.themeMediumA ?? o.colors.mint
106
108
  },
107
109
  highlightPrimary: e.highlightPrimary,
108
110
  highlightSecondary: e.highlightSecondary,
@@ -110,30 +112,37 @@ const oe = ({
110
112
  }),
111
113
  [e]
112
114
  );
113
- return /* @__PURE__ */ g(O.Provider, { value: e, children: [
114
- n && /* @__PURE__ */ r(W, { text: n }),
115
+ return /* @__PURE__ */ g(L.Provider, { value: e, children: [
116
+ n && /* @__PURE__ */ r(
117
+ H,
118
+ {
119
+ text: n,
120
+ backgroundColor: w,
121
+ textColor: k
122
+ }
123
+ ),
115
124
  /* @__PURE__ */ r(
116
- A,
125
+ j,
117
126
  {
118
127
  ...s,
119
- userProfileMenuItems: k,
120
- themeColors: v ?? (s == null ? void 0 : s.themeColors),
128
+ userProfileMenuItems: F,
129
+ themeColors: $ ?? (s == null ? void 0 : s.themeColors),
121
130
  hasSiteBanner: !!n,
122
131
  children: /* @__PURE__ */ r(
123
- G,
132
+ N,
124
133
  {
125
134
  className: "jcPageWrapper",
126
135
  loading: i,
127
136
  loadingColor: e.themeColor,
128
137
  hasPagination: m,
129
138
  hasFade: l,
130
- isTablet: M,
131
- children: /* @__PURE__ */ g(L, { loading: i, size: x ? 114 : 201, children: [
132
- l && /* @__PURE__ */ g($, { children: [
133
- /* @__PURE__ */ r(j, { color: e.themeLight, hasSiteBanner: !!n }),
134
- /* @__PURE__ */ r(D, { hasPagination: m, isMobile: x, color: e.themeLight })
139
+ isTablet: P,
140
+ children: /* @__PURE__ */ g(D, { loading: i, size: x ? 114 : 201, children: [
141
+ l && /* @__PURE__ */ g(O, { children: [
142
+ /* @__PURE__ */ r(W, { color: e.themeLight, hasSiteBanner: !!n }),
143
+ /* @__PURE__ */ r(B, { hasPagination: m, isMobile: x, color: e.themeLight })
135
144
  ] }),
136
- /* @__PURE__ */ r(Q, { children: o })
145
+ /* @__PURE__ */ r(q, { children: t })
137
146
  ] })
138
147
  }
139
148
  )
@@ -142,7 +151,7 @@ const oe = ({
142
151
  ] });
143
152
  };
144
153
  export {
145
- Q as MainContentContainer,
146
- G as PageWrapper,
147
- oe as default
154
+ q as MainContentContainer,
155
+ N as PageWrapper,
156
+ ie as default
148
157
  };
@@ -1,6 +1,8 @@
1
1
  import { default as React } from 'react';
2
2
  export interface SiteBannerProps {
3
3
  text: string;
4
+ backgroundColor?: string;
5
+ textColor?: string;
4
6
  }
5
7
  export declare const SiteBanner: React.FC<SiteBannerProps>;
6
8
  export default SiteBanner;
@@ -2,8 +2,8 @@ import { jsx as e } from "react/jsx-runtime";
2
2
  import { n as t } from "../.chunks/emotion-styled.browser.esm.js";
3
3
  import { c as r } from "../.chunks/emotion-react.browser.esm.js";
4
4
  import n from "../theme.js";
5
- import { useThemeColors as i } from "../ThemeContext.js";
6
- const a = t("div")(({ backgroundColor: o }) => ({
5
+ import { useThemeColors as c } from "../ThemeContext.js";
6
+ const m = t("div")(({ $backgroundColor: o }) => ({
7
7
  ...r`
8
8
  width: 100%;
9
9
  height: 54px;
@@ -14,20 +14,20 @@ const a = t("div")(({ backgroundColor: o }) => ({
14
14
  justify-content: center;
15
15
  box-sizing: border-box;
16
16
  `
17
- })), c = t("span")(() => ({
17
+ })), l = t("span")(({ $textColor: o }) => ({
18
18
  ...r`
19
- color: ${n.colors.white};
19
+ color: ${o};
20
20
  font-family: Roboto, sans-serif;
21
21
  font-size: 19px;
22
22
  font-weight: 500;
23
23
  text-align: center;
24
24
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5);
25
25
  `
26
- })), f = ({ text: o }) => {
27
- const s = i();
28
- return /* @__PURE__ */ e(a, { backgroundColor: s.themeColor, children: /* @__PURE__ */ e(c, { children: o }) });
26
+ })), b = ({ text: o, backgroundColor: s, textColor: i }) => {
27
+ const a = c();
28
+ return /* @__PURE__ */ e(m, { $backgroundColor: s ?? a.themeColor, children: /* @__PURE__ */ e(l, { $textColor: i ?? n.colors.white, children: o }) });
29
29
  };
30
30
  export {
31
- f as SiteBanner,
32
- f as default
31
+ b as SiteBanner,
32
+ b as default
33
33
  };
package/api.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ export interface ApiResponse<T> {
2
+ success: boolean;
3
+ data?: T | null;
4
+ error?: {
5
+ status: number;
6
+ statusText: string;
7
+ message: string;
8
+ };
9
+ }
10
+ /**
11
+ * Base API client for JCIT applications.
12
+ *
13
+ * Provides a generic `request<T>()` method with timeout, JSON parsing,
14
+ * and standardized error wrapping into `ApiResponse<T>`.
15
+ *
16
+ * Consumers extend this class, pass the base URL via `super()`, and
17
+ * add app-specific endpoint methods:
18
+ *
19
+ * ```typescript
20
+ * import { BaseApiClient } from 'jcicl/api';
21
+ *
22
+ * class MyAppApi extends BaseApiClient {
23
+ * constructor() {
24
+ * super(import.meta.env.VITE_API_BASE_URL);
25
+ * }
26
+ * async getItems() {
27
+ * return this.request<Item[]>('/api/Items/GetItems');
28
+ * }
29
+ * }
30
+ *
31
+ * export const api = new MyAppApi();
32
+ * ```
33
+ */
34
+ export declare class BaseApiClient {
35
+ protected baseUrl: string;
36
+ constructor(baseUrl: string);
37
+ protected request<T>(endpoint: string, method?: 'GET' | 'POST' | 'PUT' | 'DELETE', body?: unknown, options?: {
38
+ timeoutMs?: number;
39
+ headers?: Record<string, string>;
40
+ }): Promise<ApiResponse<T>>;
41
+ }
package/api.js ADDED
@@ -0,0 +1,79 @@
1
+ var T = Object.defineProperty;
2
+ var h = (s, e, r) => e in s ? T(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
+ var m = (s, e, r) => h(s, typeof e != "symbol" ? e + "" : e, r);
4
+ class x {
5
+ constructor(e) {
6
+ m(this, "baseUrl");
7
+ if (!e)
8
+ throw new Error(
9
+ "BaseApiClient: baseUrl is required. Pass import.meta.env.VITE_API_BASE_URL or equivalent."
10
+ );
11
+ this.baseUrl = e.endsWith("/") ? e.slice(0, -1) : e;
12
+ }
13
+ async request(e, r = "GET", n, a) {
14
+ const o = (a == null ? void 0 : a.timeoutMs) ?? 3e4, l = new AbortController(), d = setTimeout(() => l.abort(), o);
15
+ try {
16
+ const f = {
17
+ method: r,
18
+ headers: {
19
+ ...n !== void 0 ? { "Content-Type": "application/json" } : {},
20
+ ...a == null ? void 0 : a.headers
21
+ },
22
+ credentials: "include",
23
+ // Required for Windows Authentication with CORS
24
+ signal: l.signal
25
+ };
26
+ n !== void 0 && (f.body = JSON.stringify(n));
27
+ const t = await fetch(`${this.baseUrl}${e}`, f);
28
+ if (clearTimeout(d), !t.ok)
29
+ return {
30
+ success: !1,
31
+ error: {
32
+ status: t.status,
33
+ statusText: t.statusText,
34
+ message: `HTTP ${t.status}: ${t.statusText}`
35
+ }
36
+ };
37
+ if (t.status === 204)
38
+ return {
39
+ success: !0,
40
+ data: void 0
41
+ };
42
+ const c = await t.text();
43
+ if (!c || c === "null")
44
+ return {
45
+ success: !0,
46
+ data: null
47
+ };
48
+ let i;
49
+ try {
50
+ i = JSON.parse(c);
51
+ } catch {
52
+ i = c;
53
+ }
54
+ return {
55
+ success: !0,
56
+ data: i
57
+ };
58
+ } catch (u) {
59
+ return clearTimeout(d), u instanceof Error && u.name === "AbortError" ? {
60
+ success: !1,
61
+ error: {
62
+ status: 0,
63
+ statusText: "Timeout",
64
+ message: `Request timed out after ${o}ms`
65
+ }
66
+ } : {
67
+ success: !1,
68
+ error: {
69
+ status: 0,
70
+ statusText: "Network Error",
71
+ message: u instanceof Error ? u.message : "Unknown error occurred"
72
+ }
73
+ };
74
+ }
75
+ }
76
+ }
77
+ export {
78
+ x as BaseApiClient
79
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "1.0.61",
4
+ "version": "1.0.63",
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",