jcicl 0.0.233 → 0.0.235
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.
|
@@ -6,6 +6,7 @@ export interface LabeledCurrencyInputProps extends InputProps {
|
|
|
6
6
|
label: string;
|
|
7
7
|
grid?: boolean;
|
|
8
8
|
noLabel?: boolean;
|
|
9
|
+
defaultValue?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare const LabeledCurrencyInput: React.FC<LabeledCurrencyInputProps>;
|
|
11
12
|
export default LabeledCurrencyInput;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { n as
|
|
4
|
-
import { c as
|
|
5
|
-
import { Input as
|
|
6
|
-
const
|
|
7
|
-
...
|
|
1
|
+
import { jsxs as p, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
import { n as w } from "../.chunks/emotion-styled.browser.esm.js";
|
|
4
|
+
import { c as x } from "../.chunks/emotion-react.browser.esm.js";
|
|
5
|
+
import { Input as y } from "../Input/Input.js";
|
|
6
|
+
const I = w("div")(({ grid: r }) => ({
|
|
7
|
+
...x`
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-wrap: nowrap;
|
|
10
10
|
gap: 9px;
|
|
@@ -20,29 +20,35 @@ const w = d("div")(({ grid: t }) => ({
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.MuiCurrencyInputBase-root {
|
|
23
|
-
width: ${
|
|
23
|
+
width: ${r && "100%"};
|
|
24
24
|
}
|
|
25
25
|
`
|
|
26
26
|
})), j = ({
|
|
27
|
-
label:
|
|
27
|
+
label: r,
|
|
28
28
|
grid: l = !0,
|
|
29
|
-
noLabel:
|
|
30
|
-
onChange:
|
|
31
|
-
|
|
29
|
+
noLabel: m = !1,
|
|
30
|
+
onChange: a,
|
|
31
|
+
defaultValue: n,
|
|
32
|
+
...c
|
|
32
33
|
}) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
let t = (n == null ? void 0 : n.replace(/[^0-9.-]+/g, "")) ?? "";
|
|
35
|
+
t && (t = new Intl.NumberFormat("en-US", {
|
|
36
|
+
style: "decimal",
|
|
37
|
+
maximumFractionDigits: 2
|
|
38
|
+
}).format(Number(t)));
|
|
39
|
+
const [u, o] = d(t);
|
|
40
|
+
return /* @__PURE__ */ p(I, { grid: l, className: "jcLabeledCurrencyInput", children: [
|
|
41
|
+
!m && /* @__PURE__ */ p("span", { children: [
|
|
42
|
+
r,
|
|
37
43
|
":"
|
|
38
44
|
] }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
const { value:
|
|
45
|
+
/* @__PURE__ */ g(y, { ...c, onChange: (i) => {
|
|
46
|
+
const { value: f } = i.target, e = f.replace(/[^0-9.-]+/g, ""), s = new Intl.NumberFormat("en-US", {
|
|
41
47
|
style: "decimal",
|
|
42
48
|
maximumFractionDigits: 2
|
|
43
49
|
}).format(Number(e) || 0);
|
|
44
|
-
e && e.length > 1 && e[e.length - 1] === "." ?
|
|
45
|
-
}, value: `$${
|
|
50
|
+
e && e.length > 1 && e[e.length - 1] === "." ? o(s + ".") : o(e ? s : ""), a && a(i);
|
|
51
|
+
}, value: `$${u}` })
|
|
46
52
|
] });
|
|
47
53
|
};
|
|
48
54
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcicl",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.235",
|
|
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",
|