jcicl 0.0.211 → 0.0.215
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/FormInput/FormInput.d.ts +3 -2
- package/FormInput/FormInput.js +8 -7
- package/LabeledCurrencyInput/LabeledCurrencyInput.d.ts +11 -0
- package/LabeledCurrencyInput/LabeledCurrencyInput.js +51 -0
- package/LabeledCurrencyInput/index.d.ts +1 -0
- package/LabeledCurrencyInput/index.js +4 -0
- package/package.json +1 -1
package/FormInput/FormInput.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { LabeledInputProps } from '../../../../../../../../../src/components/composite/LabeledInput';
|
|
2
|
+
import { LabeledCurrencyInputProps } from '../../../../../../../../../src/components/composite/LabeledCurrencyInput';
|
|
2
3
|
import { LabeledCheckboxProps } from '../../../../../../../../../src/components/composite/LabeledCheckbox';
|
|
3
4
|
import { LabeledDropdownProps } from '../../../../../../../../../src/components/composite/LabeledDropdown';
|
|
4
|
-
export type AllInputProps = LabeledInputProps | LabeledCheckboxProps | LabeledDropdownProps;
|
|
5
|
+
export type AllInputProps = LabeledInputProps | LabeledCheckboxProps | LabeledDropdownProps | LabeledCurrencyInputProps;
|
|
5
6
|
export type FormInputProps = AllInputProps & {
|
|
6
|
-
type?: 'text' | 'dropdown' | 'date' | 'number' | 'checkbox' | 'radio' | 'textarea';
|
|
7
|
+
type?: 'text' | 'dropdown' | 'date' | 'number' | 'checkbox' | 'radio' | 'textarea' | 'currency';
|
|
7
8
|
};
|
|
8
9
|
export declare const FormInput: React.FC<LabeledInputProps>;
|
|
9
10
|
export default FormInput;
|
package/FormInput/FormInput.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { LabeledInput as t } from "../LabeledInput/LabeledInput.js";
|
|
3
|
-
import {
|
|
3
|
+
import { LabeledCurrencyInput as m } from "../LabeledCurrencyInput/LabeledCurrencyInput.js";
|
|
4
|
+
import { LabeledCheckbox as n } from "../LabeledCheckbox/LabeledCheckbox.js";
|
|
4
5
|
import { LabeledDropdown as d } from "../LabeledDropdown/LabeledDropdown.js";
|
|
5
|
-
const
|
|
6
|
-
const { type:
|
|
7
|
-
return
|
|
6
|
+
const l = (r) => {
|
|
7
|
+
const { type: e = "text" } = r;
|
|
8
|
+
return e === "dropdown" || e === "multiDropdown" ? /* @__PURE__ */ o(d, { ...r }) : e === "checkbox" ? /* @__PURE__ */ o(n, { ...r }) : e === "currency" ? /* @__PURE__ */ o(m, { ...r }) : /* @__PURE__ */ o(t, { ...r, type: e });
|
|
8
9
|
};
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
l as FormInput,
|
|
12
|
+
l as default
|
|
12
13
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputProps } from '../../../../../../../../../src/components/base/Input';
|
|
2
|
+
export interface StyleProps {
|
|
3
|
+
grid?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface LabeledCurrencyInputProps extends InputProps {
|
|
6
|
+
label: string;
|
|
7
|
+
grid?: boolean;
|
|
8
|
+
noLabel?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const LabeledCurrencyInput: React.FC<LabeledCurrencyInputProps>;
|
|
11
|
+
export default LabeledCurrencyInput;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsxs as s, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f } from "react";
|
|
3
|
+
import { n as d } from "../.chunks/emotion-styled.browser.esm.js";
|
|
4
|
+
import { c as g } from "../.chunks/emotion-react.browser.esm.js";
|
|
5
|
+
import { Input as h } from "../Input/Input.js";
|
|
6
|
+
const w = d("div")(({ grid: t }) => ({
|
|
7
|
+
...g`
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: nowrap;
|
|
10
|
+
gap: 9px;
|
|
11
|
+
font-family: 'Roboto', sans-serif;
|
|
12
|
+
|
|
13
|
+
span {
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.MuiTextField-root {
|
|
19
|
+
flex-grow: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.MuiCurrencyInputBase-root {
|
|
23
|
+
width: ${t && "100%"};
|
|
24
|
+
}
|
|
25
|
+
`
|
|
26
|
+
})), j = ({
|
|
27
|
+
label: t,
|
|
28
|
+
grid: l = !0,
|
|
29
|
+
noLabel: p = !1,
|
|
30
|
+
onChange: r,
|
|
31
|
+
...u
|
|
32
|
+
}) => {
|
|
33
|
+
const [i, n] = f("");
|
|
34
|
+
return /* @__PURE__ */ s(w, { grid: l, className: "jcLabeledCurrencyInput", children: [
|
|
35
|
+
!p && /* @__PURE__ */ s("span", { children: [
|
|
36
|
+
t,
|
|
37
|
+
":"
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ m(h, { ...u, onChange: (a) => {
|
|
40
|
+
const { value: c } = a.target, e = c.replace(/[^0-9.-]+/g, ""), o = new Intl.NumberFormat("en-US", {
|
|
41
|
+
style: "decimal",
|
|
42
|
+
maximumFractionDigits: 2
|
|
43
|
+
}).format(Number(e) || 0);
|
|
44
|
+
e && e.length > 1 && e[e.length - 1] === "." ? n(o + ".") : n(o), r && r(a);
|
|
45
|
+
}, value: `$${i}` })
|
|
46
|
+
] });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
j as LabeledCurrencyInput,
|
|
50
|
+
j as default
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type LabeledCurrencyInputProps } from './LabeledCurrencyInput';
|
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.215",
|
|
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",
|