jcicl 1.0.22 → 1.0.24
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/FormFields/FormFields.d.ts +2 -2
- package/Timer/Timer.d.ts +8 -0
- package/Timer/Timer.js +60 -0
- package/Timer/index.d.ts +1 -0
- package/Timer/index.js +4 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export type FormField = {
|
|
|
8
8
|
options?: DropdownOption[];
|
|
9
9
|
limit?: number;
|
|
10
10
|
defaultValue?: string | number;
|
|
11
|
-
}
|
|
11
|
+
} & Partial<AllInputProps>;
|
|
12
12
|
export type FormFieldsProps = {
|
|
13
13
|
title?: string;
|
|
14
14
|
fields: FormField[];
|
|
@@ -19,6 +19,6 @@ export type FormFieldsProps = {
|
|
|
19
19
|
checkboxContainer?: boolean;
|
|
20
20
|
formDefaults: Record<string, any>;
|
|
21
21
|
onChange: (key: string, e: React.ChangeEvent<HTMLInputElement>, type?: string) => void;
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
declare const FormFields: React.FC<FormFieldsProps>;
|
|
24
24
|
export default FormFields;
|
package/Timer/Timer.d.ts
ADDED
package/Timer/Timer.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { n as S } from "../.chunks/emotion-styled.browser.esm.js";
|
|
3
|
+
import { c as g } from "../.chunks/emotion-react.browser.esm.js";
|
|
4
|
+
import { useState as h, useEffect as a } from "react";
|
|
5
|
+
import w from "../theme.js";
|
|
6
|
+
const u = (e) => {
|
|
7
|
+
try {
|
|
8
|
+
const n = (/* @__PURE__ */ new Date(e.replace(" ", "T").replace("Z", "") + "Z")).getTime(), o = (/* @__PURE__ */ new Date()).getTime();
|
|
9
|
+
return Math.round((o - n) / 1e3);
|
|
10
|
+
} catch {
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
}, f = (e) => {
|
|
14
|
+
const n = Math.floor(e / 60), o = Math.floor(n / 60), s = n - o * 60, t = e % 60;
|
|
15
|
+
return `${o}:${String(s).padStart(2, "0")}:${String(t).padStart(2, "0")}`;
|
|
16
|
+
}, d = S("span")(({ textColor: e }) => ({
|
|
17
|
+
...g`
|
|
18
|
+
color: ${e || "inherit"};
|
|
19
|
+
|
|
20
|
+
.blink {
|
|
21
|
+
animation: blinker 1.5s linear infinite;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@keyframes blinker {
|
|
25
|
+
50% {
|
|
26
|
+
opacity: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`
|
|
30
|
+
})), x = ({ timeStart: e, timeEnd: n, duration: o, type: s = "countdown" }) => {
|
|
31
|
+
if (s == "elapsed") {
|
|
32
|
+
const [r, c] = h(0);
|
|
33
|
+
return a(() => {
|
|
34
|
+
const i = u(e || (/* @__PURE__ */ new Date()).toISOString());
|
|
35
|
+
c(i >= 0 ? i : 0);
|
|
36
|
+
}, [e, n, s, o]), a(() => {
|
|
37
|
+
const i = setTimeout(() => {
|
|
38
|
+
c((p) => p + 1);
|
|
39
|
+
}, 1e3);
|
|
40
|
+
return () => clearTimeout(i);
|
|
41
|
+
}, [r, s]), /* @__PURE__ */ l(d, { children: f(r) });
|
|
42
|
+
}
|
|
43
|
+
const [t, m] = h(o || 30);
|
|
44
|
+
return a(() => {
|
|
45
|
+
var r;
|
|
46
|
+
console.log(n, e), n != null ? r = u(n) * -1 : e != null && o != null ? r = o - u(e) : r = o || 30, m(r);
|
|
47
|
+
}, [o, s, e, n]), a(() => {
|
|
48
|
+
const r = setTimeout(() => {
|
|
49
|
+
m((c) => c - 1);
|
|
50
|
+
}, 1e3);
|
|
51
|
+
return () => clearTimeout(r);
|
|
52
|
+
}, [t, s]), s != "overdue" && t <= 0 ? /* @__PURE__ */ l(d, { children: /* @__PURE__ */ l("span", { className: "blink", children: f(0) }) }) : s == "overdue" && t < 0 ? /* @__PURE__ */ T(d, { textColor: w.colors.qalb, children: [
|
|
53
|
+
"– ",
|
|
54
|
+
f(-1 * t)
|
|
55
|
+
] }) : /* @__PURE__ */ l(d, { children: f(t) });
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
x as Timer,
|
|
59
|
+
x as default
|
|
60
|
+
};
|
package/Timer/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type TimerProps } from './Timer';
|
package/Timer/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcicl",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
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",
|