jcicl 1.0.3 → 1.0.7

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 (36) hide show
  1. package/CircularIconButton/CircularIconButton.js +22 -18
  2. package/DefaultTemplate/DefaultTemplate.js +3 -3
  3. package/DetailItemWithIcon/DetailItemWithIcon.js +31 -19
  4. package/DetailPageComponents/DetailPageComponents.d.ts +12 -4
  5. package/DetailPageComponents/DetailPageComponents.js +44 -28
  6. package/EditableDetailItemWithIcon/EditableDetailItemWithIcon.d.ts +1 -0
  7. package/EditableDetailItemWithIcon/EditableDetailItemWithIcon.js +63 -62
  8. package/EditableInfoCard/EditableInfoCard.js +107 -103
  9. package/FormComponents/FormComponents.d.ts +17 -10
  10. package/FormComponents/FormComponents.js +52 -46
  11. package/Icon/Icon.js +23 -22
  12. package/InfoCard/InfoCard.js +37 -33
  13. package/Input/Input.js +19 -15
  14. package/LabeledCheckbox/LabeledCheckbox.js +58 -55
  15. package/LabeledDropdown/LabeledDropdown.js +370 -366
  16. package/LabeledInput/LabeledInput.js +13 -13
  17. package/LabeledTextArea/LabeledTextArea.js +20 -13
  18. package/List/List.js +19 -18
  19. package/ListButton/ListButton.d.ts +2 -4
  20. package/ListButton/ListButton.js +21 -12
  21. package/Loading/Loading.js +14 -9
  22. package/Memo/Memo.js +16 -15
  23. package/Pill/Pill.js +13 -12
  24. package/Search/Search.js +64 -62
  25. package/SquareIcon/SquareIcon.js +28 -25
  26. package/SquareIconButton/SquareIconButton.js +24 -11
  27. package/Stepper/Stepper.js +166 -146
  28. package/Table/Table.js +233 -221
  29. package/WithLoading/WithLoading.js +16 -11
  30. package/package.json +1 -1
  31. package/theme.d.ts +17 -9
  32. package/theme.js +4 -0
  33. package/themeUtils.d.ts +5 -0
  34. package/themeUtils.js +81 -69
  35. package/utils.d.ts +1 -0
  36. package/utils.js +27 -7
@@ -1,17 +1,22 @@
1
- import { jsx as r, Fragment as e } from "react/jsx-runtime";
2
- import { n as m } from "../.chunks/emotion-styled.browser.esm.js";
1
+ import { jsx as r, Fragment as m } from "react/jsx-runtime";
2
+ import { n as c } from "../.chunks/emotion-styled.browser.esm.js";
3
3
  import { c as i } from "../.chunks/emotion-react.browser.esm.js";
4
- import a from "../theme.js";
5
- import { C as c } from "../.chunks/CircularProgress.js";
6
- const n = m(c)({
4
+ import { useThemeColors as a } from "../ThemeContext.js";
5
+ import { C as n } from "../.chunks/CircularProgress.js";
6
+ const u = c(n, {
7
+ shouldForwardProp: (o) => !["customTheme"].includes(o)
8
+ })(({ customTheme: o }) => ({
7
9
  ...i`
8
- color: ${a.colors.green};
10
+ color: ${o.themeIconBackgroundA};
9
11
  `
10
- }), d = ({
12
+ })), g = ({
11
13
  loading: o,
12
- children: t,
13
- ...s
14
- }) => o ? /* @__PURE__ */ r(n, { size: 47, ...s }) : /* @__PURE__ */ r(e, { children: t });
14
+ children: s,
15
+ ...e
16
+ }) => {
17
+ const t = a();
18
+ return o ? /* @__PURE__ */ r(u, { size: 47, ...e, customTheme: t }) : /* @__PURE__ */ r(m, { children: s });
19
+ };
15
20
  export {
16
- d as default
21
+ g as default
17
22
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.7",
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
@@ -104,6 +104,15 @@ export interface TemplateThemeProps {
104
104
  backgroundColor: string;
105
105
  };
106
106
  }
107
+ export interface ThemeOptions {
108
+ green: string;
109
+ blue: string;
110
+ red: string;
111
+ grayscale: string;
112
+ custom: string;
113
+ }
114
+ declare const theme: Theme;
115
+ export default theme;
107
116
  export interface CustomThemeProps {
108
117
  themeColor: string;
109
118
  themeDark: string;
@@ -118,6 +127,10 @@ export interface CustomThemeProps {
118
127
  themeShadowA: string;
119
128
  themeShadowB: string;
120
129
  themeShadowC: string;
130
+ themeIconBackgroundA: string;
131
+ themeIconBackgroundB: string;
132
+ themeIconColorA: string;
133
+ themeIconColorB: string;
121
134
  highlightPrimary: string;
122
135
  highlightSecondary: string;
123
136
  highlightTertiary: string;
@@ -137,15 +150,6 @@ export interface CustomThemeProps {
137
150
  darkGray1: string;
138
151
  black: string;
139
152
  }
140
- export interface ThemeOptions {
141
- green: string;
142
- blue: string;
143
- red: string;
144
- grayscale: string;
145
- custom: string;
146
- }
147
- declare const theme: Theme;
148
- export default theme;
149
153
  export declare const defaultTheme: {
150
154
  themeColor: string;
151
155
  themeDark: string;
@@ -160,6 +164,10 @@ export declare const defaultTheme: {
160
164
  themeShadowA: string;
161
165
  themeShadowB: string;
162
166
  themeShadowC: string;
167
+ themeIconBackgroundA: string;
168
+ themeIconBackgroundB: string;
169
+ themeIconColorA: string;
170
+ themeIconColorB: string;
163
171
  highlightPrimary: string;
164
172
  highlightSecondary: string;
165
173
  highlightTertiary: string;
package/theme.js CHANGED
@@ -111,6 +111,10 @@ const o = {
111
111
  themeShadowA: e.colors.darkGreenO99,
112
112
  themeShadowB: e.boxShadows.darkGreen,
113
113
  themeShadowC: e.boxShadows.darkGreenThick,
114
+ themeIconBackgroundA: e.colors.green,
115
+ themeIconBackgroundB: e.colors.whiteGreenA,
116
+ themeIconColorA: e.colors.white,
117
+ themeIconColorB: e.colors.darkGreen,
114
118
  // These colors always stay the same, no custom theme updating
115
119
  highlightPrimary: e.colors.sunlight,
116
120
  highlightSecondary: e.colors.dandelion,
package/themeUtils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export declare const getHueFromHex: (hex: string) => number;
2
+ export declare const getSaturationFromHex: (hex: string) => number;
2
3
  export declare const substituteHue: (themeColor: string, hue: number) => string;
3
4
  export declare const updateTheme: (newHue?: number) => {
4
5
  themeColor: string;
@@ -14,6 +15,10 @@ export declare const updateTheme: (newHue?: number) => {
14
15
  themeShadowA: string;
15
16
  themeShadowB: string;
16
17
  themeShadowC: string;
18
+ themeIconBackgroundA: string;
19
+ themeIconBackgroundB: string;
20
+ themeIconColorA: string;
21
+ themeIconColorB: string;
17
22
  highlightPrimary: string;
18
23
  highlightSecondary: string;
19
24
  highlightTertiary: string;
package/themeUtils.js CHANGED
@@ -1,88 +1,100 @@
1
- import i, { defaultTheme as S } from "./theme.js";
2
- function T(o) {
3
- const r = parseInt(o.substring(1, 3), 16), e = parseInt(o.substring(3, 5), 16), t = parseInt(o.substring(5, 7), 16);
4
- return [r, e, t];
1
+ import n, { defaultTheme as C } from "./theme.js";
2
+ function a(o) {
3
+ const r = parseInt(o.substring(1, 3), 16), t = parseInt(o.substring(3, 5), 16), e = parseInt(o.substring(5, 7), 16);
4
+ return [r, t, e];
5
5
  }
6
- function w(o, r, e) {
7
- o /= 255, r /= 255, e /= 255;
8
- const t = Math.max(o, r, e), n = Math.min(o, r, e), m = (t + n) / 2;
9
- if (t === n)
10
- return [0, 0, m];
11
- const h = t - n;
12
- let u = m > 0.5 ? h / (2 - t - n) : h / (t + n), c;
13
- return t === o ? c = (r - e) / h + (r < e ? 6 : 0) : t === r ? c = (e - o) / h + 2 : c = (o - r) / h + 4, c /= 6, [c, u, m];
6
+ function d(o, r, t) {
7
+ o /= 255, r /= 255, t /= 255;
8
+ const e = Math.max(o, r, t), h = Math.min(o, r, t), c = (e + h) / 2;
9
+ if (e === h)
10
+ return [0, 0, c];
11
+ const i = e - h;
12
+ let l = c > 0.5 ? i / (2 - e - h) : i / (e + h), m;
13
+ return e === o ? m = (r - t) / i + (r < t ? 6 : 0) : e === r ? m = (t - o) / i + 2 : m = (o - r) / i + 4, m /= 6, [m, l, c];
14
14
  }
15
- function M(o, r, e) {
16
- let t, n, m;
15
+ function I(o, r, t) {
16
+ let e, h, c;
17
17
  if (r === 0)
18
- t = n = m = e;
18
+ e = h = c = t;
19
19
  else {
20
- const h = e < 0.5 ? e * (1 + r) : e + r - e * r, u = 2 * e - h;
21
- t = a(u, h, o + 1 / 3), n = a(u, h, o), m = a(u, h, o - 1 / 3);
20
+ const i = t < 0.5 ? t * (1 + r) : t + r - t * r, l = 2 * t - i;
21
+ e = g(l, i, o + 1 / 3), h = g(l, i, o), c = g(l, i, o - 1 / 3);
22
22
  }
23
- return [Math.round(t * 255), Math.round(n * 255), Math.round(m * 255)];
23
+ return [Math.round(e * 255), Math.round(h * 255), Math.round(c * 255)];
24
24
  }
25
- function a(o, r, e) {
26
- return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? o + (r - o) * 6 * e : e < 1 / 2 ? r : e < 2 / 3 ? o + (r - o) * (2 / 3 - e) * 6 : o;
25
+ function g(o, r, t) {
26
+ return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? o + (r - o) * 6 * t : t < 1 / 2 ? r : t < 2 / 3 ? o + (r - o) * (2 / 3 - t) * 6 : o;
27
27
  }
28
- function L(o, r, e) {
29
- var t = o.toString(16).length == 1 ? "0" + o.toString(16) : o.toString(16), n = r.toString(16).length == 1 ? "0" + r.toString(16) : r.toString(16), m = e.toString(16).length == 1 ? "0" + e.toString(16) : e.toString(16);
30
- return "#" + t + n + m;
28
+ function T(o, r, t) {
29
+ var e = o.toString(16).length == 1 ? "0" + o.toString(16) : o.toString(16), h = r.toString(16).length == 1 ? "0" + r.toString(16) : r.toString(16), c = t.toString(16).length == 1 ? "0" + t.toString(16) : t.toString(16);
30
+ return "#" + e + h + c;
31
31
  }
32
- const B = (o) => {
33
- const [r, e, t] = T(o), [n, m, h] = w(r, e, t);
34
- return n;
32
+ const k = (o) => {
33
+ const [r, t, e] = a(o), [h, c, i] = d(r, t, e);
34
+ return h;
35
+ }, _ = (o) => {
36
+ const [r, t, e] = a(o), [h, c, i] = d(r, t, e);
37
+ return c;
35
38
  }, s = (o, r) => {
36
- const [e, t, n] = T(o), [m, h, u] = w(e, t, n);
37
- let c = h + 0.1;
38
- c >= 1 && (c = 0.99);
39
- let g = u;
40
- g > 0.5 && (g -= 0.08), g > 0.8 && (c = 1, g += 0.03), r < 0 && (c = 0);
41
- const [l, d, f] = M(r, c, g);
42
- return L(l, d, f);
43
- }, A = (o) => {
44
- const r = localStorage.getItem("theme") || "green", e = localStorage.getItem("hue") || B(i.themeOptions.green).toString();
45
- if (r == "green") return S;
46
- var t = parseFloat(e);
47
- o != null && (t = o);
39
+ const [t, e, h] = a(o), [c, i, l] = d(t, e, h);
40
+ let m = i + 0.1;
41
+ m >= 1 && (m = 0.99);
42
+ let u = l;
43
+ u > 0.5 && (u -= 0.08), u > 0.8 && (m = 1, u += 0.03), r < 0 && (m = 0);
44
+ const [f, S, B] = I(r, m, u);
45
+ return T(f, S, B);
46
+ }, F = (o) => {
47
+ const r = localStorage.getItem("theme") || "green", t = localStorage.getItem("hue") || k(n.themeOptions.green).toString();
48
+ if (r == "green") return C;
49
+ var e = parseFloat(t);
50
+ o != null && (e = o);
48
51
  const {
49
- themeColor: n,
50
- themeDark: m,
51
- themeMediumA: h,
52
- themeMediumB: u,
53
- themeMediumC: c,
54
- themeLight: g,
55
- themeLightA: l,
56
- themeLightB: d,
57
- themeLightC: f,
58
- themeLightD: C,
59
- themeShadowA: G,
60
- themeShadowB: b,
61
- themeShadowC: x,
62
- ...p
63
- } = S;
52
+ themeColor: h,
53
+ themeDark: c,
54
+ themeMediumA: i,
55
+ themeMediumB: l,
56
+ themeMediumC: m,
57
+ themeLight: u,
58
+ themeLightA: f,
59
+ themeLightB: S,
60
+ themeLightC: B,
61
+ themeLightD: w,
62
+ themeShadowA: A,
63
+ themeShadowB: p,
64
+ themeShadowC: M,
65
+ themeIconBackgroundA: L,
66
+ themeIconBackgroundB: b,
67
+ themeIconColorA: x,
68
+ themeIconColorB: v,
69
+ ...G
70
+ } = C;
64
71
  return {
65
- themeColor: s(i.colors.green, t),
66
- themeDark: s(i.colors.darkGreen, t),
67
- themeMediumA: s(i.colors.whiteGreenB, t),
72
+ themeColor: s(n.colors.green, e),
73
+ themeDark: s(n.colors.darkGreen, e),
74
+ themeMediumA: s(n.colors.whiteGreenB, e),
68
75
  // mint
69
- themeMediumB: s(i.colors.moss, t),
70
- themeMediumC: s(i.colors.sage, t),
71
- themeLight: s(i.colors.whiteGreenB, t),
76
+ themeMediumB: s(n.colors.moss, e),
77
+ themeMediumC: s(n.colors.sage, e),
78
+ themeLight: s(n.colors.whiteGreenB, e),
72
79
  // whiteGreen
73
- themeLightA: s(i.colors.moss, t),
80
+ themeLightA: s(n.colors.moss, e),
74
81
  // whiteGreenA
75
- themeLightB: s(i.colors.whiteGreenB, t),
76
- themeLightC: s(i.colors.whiteGreenC, t),
77
- themeLightD: s(i.colors.whiteGreenD, t),
78
- themeShadowA: s(i.colors.darkGreenO99, t) + "99",
79
- themeShadowB: "0 0 8px -2px " + s(i.colors.darkGreen, t),
80
- themeShadowC: "0 0 2px 1px " + s(i.colors.darkGreen, t),
81
- ...p
82
+ themeLightB: s(n.colors.whiteGreenB, e),
83
+ themeLightC: s(n.colors.whiteGreenC, e),
84
+ themeLightD: s(n.colors.whiteGreenD, e),
85
+ themeShadowA: s(n.colors.darkGreenO99, e) + "99",
86
+ themeShadowB: "0 0 8px -2px " + s(n.colors.darkGreen, e),
87
+ themeShadowC: "0 0 2px 1px " + s(n.colors.darkGreen, e),
88
+ themeIconBackgroundA: e < 0 ? n.colors.green : s(n.colors.green, e),
89
+ themeIconBackgroundB: e < 0 ? n.colors.whiteGreenA : s(n.colors.whiteGreenA, e),
90
+ themeIconColorA: n.colors.white,
91
+ themeIconColorB: e < 0 ? n.colors.darkGreen : s(n.colors.darkGreen, e),
92
+ ...G
82
93
  };
83
94
  };
84
95
  export {
85
- B as getHueFromHex,
96
+ k as getHueFromHex,
97
+ _ as getSaturationFromHex,
86
98
  s as substituteHue,
87
- A as updateTheme
99
+ F as updateTheme
88
100
  };
package/utils.d.ts CHANGED
@@ -6,3 +6,4 @@ export declare const formatAddress: (address: {
6
6
  state?: string | null;
7
7
  zip?: string | null;
8
8
  }) => string;
9
+ export declare const formatTimestamp: (timestamp: string) => string;
package/utils.js CHANGED
@@ -1,13 +1,33 @@
1
- const a = (t, r = "mmddyyyy") => r === "mmddyyyy" ? new Date(t).toLocaleDateString("en-US", {
1
+ const d = (t, e = "mmddyyyy") => e === "mmddyyyy" ? new Date(t).toLocaleDateString("en-US", {
2
2
  month: "numeric",
3
3
  day: "numeric",
4
4
  year: "numeric"
5
- }) : t, o = (t) => {
6
- const { line1: r, line2: n, city: i, state: y, zip: m } = t;
7
- let e = r;
8
- return n && (e += `, ${n}`), i && (e += `, ${i}`), y && (e += `, ${y}`), m && (e += ` ${m}`), e;
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) {
12
+ case 1:
13
+ return "st";
14
+ case 2:
15
+ return "nd";
16
+ case 3:
17
+ return "rd";
18
+ default:
19
+ return "th";
20
+ }
21
+ }, f = (t) => {
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}`;
25
+ } catch {
26
+ return t;
27
+ }
9
28
  };
10
29
  export {
11
- o as formatAddress,
12
- a as formatDate
30
+ y as formatAddress,
31
+ d as formatDate,
32
+ f as formatTimestamp
13
33
  };