@monolith-forensics/monolith-ui 1.2.17 → 1.2.18
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.
|
@@ -9,6 +9,7 @@ interface FormSectionProps {
|
|
|
9
9
|
onOpenChange?: (open: boolean) => void;
|
|
10
10
|
allowCollapse?: boolean;
|
|
11
11
|
size?: Size;
|
|
12
|
+
style?: React.CSSProperties;
|
|
12
13
|
}
|
|
13
|
-
declare const FormSection:
|
|
14
|
+
declare const FormSection: ({ title, children, open, defaultOpen, onOpenChange, allowCollapse, size, style, }: FormSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default FormSection;
|
|
@@ -2,16 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ChevronDownIcon } from "lucide-react";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
setOpen(!openState);
|
|
11
|
-
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!openState);
|
|
12
|
-
}
|
|
13
|
-
}, children: [_jsx("h3", { children: title }), _jsx("div", { className: "section-line" }), !!allowCollapse ? (_jsx(ChevronDownIcon, { size: 18, className: openState ? "open" : "" })) : ("")] }), _jsx("div", { className: "section-content", "data-open": openState, children: children })] }));
|
|
14
|
-
}) `
|
|
5
|
+
const StyledContainer = styled.div `
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
height: 100%;
|
|
9
|
+
|
|
15
10
|
h3 {
|
|
16
11
|
margin: 0;
|
|
17
12
|
font-size: ${({ size = "md" }) => size === "xs"
|
|
@@ -52,10 +47,24 @@ const FormSection = styled(({ className, title, children, open, defaultOpen = tr
|
|
|
52
47
|
}
|
|
53
48
|
|
|
54
49
|
.section-content {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
height: 100%;
|
|
55
53
|
padding: 10px 0px;
|
|
54
|
+
|
|
56
55
|
&[data-open="false"] {
|
|
57
56
|
display: none;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
`;
|
|
60
|
+
const FormSection = ({ title, children, open, defaultOpen = true, onOpenChange, allowCollapse = true, size, style, }) => {
|
|
61
|
+
const [_open, setOpen] = useState(defaultOpen);
|
|
62
|
+
const openState = open !== null && open !== void 0 ? open : _open;
|
|
63
|
+
return (_jsxs(StyledContainer, { className: "mfui-FormSection", size: size, style: style, children: [_jsxs("div", { className: "section-header", onClick: (e) => {
|
|
64
|
+
if (allowCollapse) {
|
|
65
|
+
setOpen(!openState);
|
|
66
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!openState);
|
|
67
|
+
}
|
|
68
|
+
}, children: [_jsx("h3", { children: title }), _jsx("div", { className: "section-line" }), !!allowCollapse ? (_jsx(ChevronDownIcon, { size: 18, className: openState ? "open" : "" })) : ("")] }), _jsx("div", { className: "section-content", "data-open": openState, children: children })] }));
|
|
69
|
+
};
|
|
61
70
|
export default FormSection;
|