@monolith-forensics/monolith-ui 1.0.0
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/.gitattributes +2 -0
- package/package.json +19 -0
- package/src/Calendar/Calendar.js +329 -0
- package/src/Calendar/CalendarStyles.js +168 -0
- package/src/Calendar/calendarHelpers.js +194 -0
- package/src/CheckBox.js +49 -0
- package/src/DataGrid/DataGrid.js +729 -0
- package/src/DateBox.js +77 -0
- package/src/Form.js +116 -0
- package/src/Input.js +160 -0
- package/src/Menu.js +196 -0
- package/src/NumberBox.js +121 -0
- package/src/OptionButton.js +89 -0
- package/src/SelectBox.js +252 -0
- package/src/TagBox/TagBox.js +75 -0
- package/src/TagBox/TagBoxStyles.js +122 -0
- package/src/TextArea.js +85 -0
- package/src/TextAreaBox.js +43 -0
- package/src/TextBox.js +10 -0
- package/src/TimeBox.js +0 -0
- package/src/Timeline.js +153 -0
- package/src/index.js +0 -0
package/src/CheckBox.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import CheckBoxOutlineBlankOutlinedIcon from "@mui/icons-material/CheckBoxOutlineBlankOutlined";
|
|
3
|
+
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
|
|
7
|
+
const CheckBox = styled(
|
|
8
|
+
({ className, checked = true, onChange = () => {}, style = {} }) => {
|
|
9
|
+
const [checkedState, setCheckedState] = useState(checked);
|
|
10
|
+
|
|
11
|
+
const handleChange = (e) => {
|
|
12
|
+
e.stopPropagation();
|
|
13
|
+
setCheckedState(!checkedState);
|
|
14
|
+
onChange({ newValue: !checkedState, previousValue: checkedState });
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setCheckedState(checked);
|
|
19
|
+
}, [checked]);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={className} onClick={handleChange}>
|
|
23
|
+
{checkedState === true ? (
|
|
24
|
+
<CheckBoxIcon className="checkbox checked" />
|
|
25
|
+
) : (
|
|
26
|
+
<CheckBoxOutlineBlankOutlinedIcon className="checkbox unchecked" />
|
|
27
|
+
)}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
)((props) => ({
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
width: 20,
|
|
35
|
+
cursor: "pointer",
|
|
36
|
+
".checkbox": {
|
|
37
|
+
color: props.theme.palette.primary.main,
|
|
38
|
+
...props.style,
|
|
39
|
+
fontSize: (() => {
|
|
40
|
+
if (props.size === "small") return 16;
|
|
41
|
+
if (props.size === "medium") return 20;
|
|
42
|
+
if (props.size === "large") return 24;
|
|
43
|
+
return 16;
|
|
44
|
+
})(),
|
|
45
|
+
// padding: 5,
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
export default CheckBox;
|