jcicl 0.0.345 → 1.0.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.
@@ -0,0 +1,3 @@
1
+ import { CustomThemeProps } from '../../../../../../../src/components/theme';
2
+ export declare const ThemeContext: import('react').Context<CustomThemeProps | null>;
3
+ export declare const useThemeColors: () => CustomThemeProps;
@@ -0,0 +1,10 @@
1
+ import { createContext as t, useContext as o } from "react";
2
+ const r = t(null), s = () => {
3
+ const e = o(r);
4
+ if (!e) throw new Error("useThemeColors must be used inside ThemeContext.Provider");
5
+ return e;
6
+ };
7
+ export {
8
+ r as ThemeContext,
9
+ s as useThemeColors
10
+ };
package/index.js CHANGED
@@ -6,8 +6,8 @@ import { Grid as l } from "./Grid/Grid.js";
6
6
  import { default as i } from "./Icon/Icon.js";
7
7
  import { Input as s } from "./Input/Input.js";
8
8
  import { LabeledValue as I } from "./LabeledValue/LabeledValue.js";
9
- import { default as c } from "./ListButton/ListButton.js";
10
- import { default as A } from "./Loading/Loading.js";
9
+ import { default as b } from "./ListButton/ListButton.js";
10
+ import { default as g } from "./Loading/Loading.js";
11
11
  import { default as h } from "./ScrollContainer/ScrollContainer.js";
12
12
  import { Accordion as B } from "./Accordion/Accordion.js";
13
13
  import { default as E } from "./ErrorBoundary/ErrorBoundary.js";
@@ -18,7 +18,7 @@ import { default as T } from "./LogoLoop/LogoLoop.js";
18
18
  import { Tooltip as j } from "./Tooltip/Tooltip.js";
19
19
  import { default as q } from "./WithLabel/WithLabel.js";
20
20
  import { default as z } from "./WithLoading/WithLoading.js";
21
- import { default as K } from "./AppHeader/AppHeader.js";
21
+ import { A as K } from "./.chunks/AppHeader.js";
22
22
  import { EditableInfoCard as O } from "./EditableInfoCard/EditableInfoCard.js";
23
23
  import { Nav as Q } from "./Nav/Nav.js";
24
24
  import { default as U } from "./AppContainer/AppContainer.js";
@@ -39,8 +39,8 @@ export {
39
39
  G as LabeledInput,
40
40
  I as LabeledValue,
41
41
  N as List,
42
- c as ListButton,
43
- A as Loading,
42
+ b as ListButton,
43
+ g as Loading,
44
44
  T as LogoLoop,
45
45
  Q as Nav,
46
46
  h as ScrollContainer,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "0.0.345",
4
+ "version": "1.0.1",
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",
@@ -20,6 +20,7 @@
20
20
  "@mui/icons-material": "^6.1.3",
21
21
  "@mui/material": "^6.1.1",
22
22
  "@react-hook/resize-observer": "^2.0.2",
23
+ "@uiw/react-color": "^2.9.2",
23
24
  "lucide-react": "^0.525.0",
24
25
  "overlayscrollbars-react": "^0.5.6",
25
26
  "react-device-detect": "^2.2.3"
package/theme.d.ts CHANGED
@@ -17,7 +17,6 @@ export interface ThemeColors {
17
17
  darkGreenO99: string;
18
18
  darkRed: string;
19
19
  emerald: string;
20
- formBorder: string;
21
20
  gold: string;
22
21
  goldBrown: string;
23
22
  goldHover: string;
@@ -83,6 +82,7 @@ export interface Theme {
83
82
  constants: ThemeConstants;
84
83
  fonts: ThemeFonts;
85
84
  screenSizes: ThemeScreenSizes;
85
+ themeOptions: ThemeOptions;
86
86
  }
87
87
  export interface TemplateThemeProps {
88
88
  backgroundPrimary: string;
@@ -98,6 +98,84 @@ export interface TemplateThemeProps {
98
98
  shadowPrimary: string;
99
99
  shadowSecondary: string;
100
100
  shadowTertiary: string;
101
+ loadingColor: string;
102
+ iconColors?: {
103
+ iconColor: string;
104
+ backgroundColor: string;
105
+ };
106
+ }
107
+ export interface CustomThemeProps {
108
+ themeColor: string;
109
+ themeDark: string;
110
+ themeMediumA: string;
111
+ themeMediumB: string;
112
+ themeMediumC: string;
113
+ themeLight: string;
114
+ themeLightA: string;
115
+ themeLightB: string;
116
+ themeLightC: string;
117
+ themeLightD: string;
118
+ themeShadowA: string;
119
+ themeShadowB: string;
120
+ themeShadowC: string;
121
+ highlightPrimary: string;
122
+ highlightSecondary: string;
123
+ highlightTertiary: string;
124
+ white: string;
125
+ lightGray1: string;
126
+ lightGray33: string;
127
+ lightGray2: string;
128
+ lightGray3: string;
129
+ lightGray4: string;
130
+ lightGray5: string;
131
+ gray1: string;
132
+ gray44: string;
133
+ gray2: string;
134
+ gray3: string;
135
+ gray4: string;
136
+ darkGray99: string;
137
+ darkGray1: string;
138
+ black: string;
139
+ }
140
+ export interface ThemeOptions {
141
+ green: string;
142
+ blue: string;
143
+ red: string;
144
+ grayscale: string;
145
+ custom: string;
101
146
  }
102
147
  declare const theme: Theme;
103
148
  export default theme;
149
+ export declare const defaultTheme: {
150
+ themeColor: string;
151
+ themeDark: string;
152
+ themeMediumA: string;
153
+ themeMediumB: string;
154
+ themeMediumC: string;
155
+ themeLight: string;
156
+ themeLightA: string;
157
+ themeLightB: string;
158
+ themeLightC: string;
159
+ themeLightD: string;
160
+ themeShadowA: string;
161
+ themeShadowB: string;
162
+ themeShadowC: string;
163
+ highlightPrimary: string;
164
+ highlightSecondary: string;
165
+ highlightTertiary: string;
166
+ white: string;
167
+ lightGray1: string;
168
+ lightGray33: string;
169
+ lightGray2: string;
170
+ lightGray3: string;
171
+ lightGray4: string;
172
+ lightGray5: string;
173
+ gray1: string;
174
+ gray44: string;
175
+ gray2: string;
176
+ gray3: string;
177
+ gray4: string;
178
+ darkGray99: string;
179
+ darkGray1: string;
180
+ black: string;
181
+ };
package/theme.js CHANGED
@@ -1,4 +1,4 @@
1
- const a = {
1
+ const e = {
2
2
  fonts: {
3
3
  roboto: "Roboto, sans-serif"
4
4
  },
@@ -22,7 +22,7 @@ const a = {
22
22
  darkGreenO99: "#005c0099",
23
23
  darkRed: "#800000",
24
24
  emerald: "#004d24",
25
- formBorder: "rgb(114,114,114)",
25
+ // formBorder: 'rgb(114,114,114)', // shouldn't need this anymore, same as gray: '#727272'
26
26
  gold: "#fab62d",
27
27
  goldBrown: "#85611b",
28
28
  goldHover: "#e0a022",
@@ -72,24 +72,66 @@ const a = {
72
72
  mobile: "533px",
73
73
  // Testing range for tablets: 533px - 1080px
74
74
  tablet: "1080px"
75
+ },
76
+ themeOptions: {
77
+ green: "#009200",
78
+ blue: "#000092",
79
+ red: "#920000",
80
+ grayscale: "#000000",
81
+ custom: ""
75
82
  }
76
83
  };
77
- a.boxShadows = {
84
+ e.boxShadows = {
78
85
  ...Object.fromEntries(
79
- Object.keys(a.colors).map((e) => [
80
- e,
81
- `0 0 8px -2px ${a.colors[e]}`
86
+ Object.keys(e.colors).map((r) => [
87
+ r,
88
+ `0 0 8px -2px ${e.colors[r]}`
82
89
  ])
83
90
  ),
84
91
  ...Object.fromEntries(
85
- Object.keys(a.colors).map((e) => [
86
- `${e}Thick`,
87
- `0 0 2px 1px ${a.colors[e]}`
92
+ Object.keys(e.colors).map((r) => [
93
+ `${r}Thick`,
94
+ `0 0 2px 1px ${e.colors[r]}`
88
95
  ])
89
96
  ),
90
97
  black63: "0px 0px 2px 1px rgba(0, 0, 0, 0.63)",
91
98
  gray63: "0px 0px 2px 1px rgba(100, 100, 100, 0.63)"
92
99
  };
100
+ const o = {
101
+ themeColor: e.colors.green,
102
+ themeDark: e.colors.darkGreen,
103
+ themeMediumA: e.colors.mint,
104
+ themeMediumB: e.colors.moss,
105
+ themeMediumC: e.colors.sage,
106
+ themeLight: e.colors.whiteGreen,
107
+ themeLightA: e.colors.whiteGreenA,
108
+ themeLightB: e.colors.whiteGreenB,
109
+ themeLightC: e.colors.whiteGreenC,
110
+ themeLightD: e.colors.whiteGreenD,
111
+ themeShadowA: e.colors.darkGreenO99,
112
+ themeShadowB: e.boxShadows.darkGreen,
113
+ themeShadowC: e.boxShadows.darkGreenThick,
114
+ // These colors always stay the same, no custom theme updating
115
+ highlightPrimary: e.colors.sunlight,
116
+ highlightSecondary: e.colors.dandelion,
117
+ highlightTertiary: `${e.colors.dandelion}99`,
118
+ white: e.colors.white,
119
+ lightGray1: e.colors.veryLightGray,
120
+ lightGray33: e.colors.veryLightGrayO33,
121
+ lightGray2: e.colors.whiteBlue,
122
+ lightGray3: e.colors.almostWhite,
123
+ lightGray4: e.colors.gray4,
124
+ lightGray5: e.colors.gray2,
125
+ gray1: e.colors.gray,
126
+ gray44: e.colors.grayO44,
127
+ gray2: e.colors.gray3,
128
+ gray3: e.colors.charcoal,
129
+ gray4: e.colors.slate,
130
+ darkGray99: e.colors.modalBackdrop,
131
+ darkGray1: e.colors.midnight,
132
+ black: e.colors.black
133
+ };
93
134
  export {
94
- a as default
135
+ e as default,
136
+ o as defaultTheme
95
137
  };
@@ -0,0 +1,35 @@
1
+ export declare const getHueFromHex: (hex: string) => number;
2
+ export declare const substituteHue: (themeColor: string, hue: number) => string;
3
+ export declare const updateTheme: (newHue?: number) => {
4
+ themeColor: string;
5
+ themeDark: string;
6
+ themeMediumA: string;
7
+ themeMediumB: string;
8
+ themeMediumC: string;
9
+ themeLight: string;
10
+ themeLightA: string;
11
+ themeLightB: string;
12
+ themeLightC: string;
13
+ themeLightD: string;
14
+ themeShadowA: string;
15
+ themeShadowB: string;
16
+ themeShadowC: string;
17
+ highlightPrimary: string;
18
+ highlightSecondary: string;
19
+ highlightTertiary: string;
20
+ white: string;
21
+ lightGray1: string;
22
+ lightGray33: string;
23
+ lightGray2: string;
24
+ lightGray3: string;
25
+ lightGray4: string;
26
+ lightGray5: string;
27
+ gray1: string;
28
+ gray44: string;
29
+ gray2: string;
30
+ gray3: string;
31
+ gray4: string;
32
+ darkGray99: string;
33
+ darkGray1: string;
34
+ black: string;
35
+ };
package/themeUtils.js ADDED
@@ -0,0 +1,88 @@
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];
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];
14
+ }
15
+ function M(o, r, e) {
16
+ let t, n, m;
17
+ if (r === 0)
18
+ t = n = m = e;
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);
22
+ }
23
+ return [Math.round(t * 255), Math.round(n * 255), Math.round(m * 255)];
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;
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;
31
+ }
32
+ const B = (o) => {
33
+ const [r, e, t] = T(o), [n, m, h] = w(r, e, t);
34
+ return n;
35
+ }, 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);
48
+ 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;
64
+ return {
65
+ themeColor: s(i.colors.green, t),
66
+ themeDark: s(i.colors.darkGreen, t),
67
+ themeMediumA: s(i.colors.whiteGreenB, t),
68
+ // mint
69
+ themeMediumB: s(i.colors.moss, t),
70
+ themeMediumC: s(i.colors.sage, t),
71
+ themeLight: s(i.colors.whiteGreenB, t),
72
+ // whiteGreen
73
+ themeLightA: s(i.colors.moss, t),
74
+ // 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
+ };
83
+ };
84
+ export {
85
+ B as getHueFromHex,
86
+ s as substituteHue,
87
+ A as updateTheme
88
+ };