@homefile/components-v2 2.27.1 → 2.27.2
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { DrawerBody, DrawerHeader, DrawerFooter, Box } from '@chakra-ui/react';
|
|
4
|
-
import { PanelHeader, FooterDrawer, ItemFormFooter, Overlay, } from '../../..';
|
|
4
|
+
import { PanelHeader, FooterDrawer, ItemFormFooter, Overlay, Loading, } from '../../..';
|
|
5
5
|
export const ItemFormPanel = ({ children, onClose, onSubmitForm, panelIcon, panelTitle, showOverlay = false, onClearForm, onDuplicate, }) => {
|
|
6
6
|
const { firstChild, otherChildren } = useMemo(() => {
|
|
7
|
-
let firstChild =
|
|
7
|
+
let firstChild = null;
|
|
8
8
|
let otherChildren = children;
|
|
9
9
|
if (Array.isArray(children) && children.length > 0) {
|
|
10
10
|
const header = children[0];
|
|
@@ -15,5 +15,5 @@ export const ItemFormPanel = ({ children, onClose, onSubmitForm, panelIcon, pane
|
|
|
15
15
|
}
|
|
16
16
|
return { firstChild, otherChildren };
|
|
17
17
|
}, [children]);
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsx(DrawerBody, { p: "0", overflowX: "hidden", bg: "lightBlue.1", children: _jsxs(_Fragment, { children: [firstChild, _jsxs(Box, { position: "relative", mb: "200px", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), otherChildren] })] }) }), onSubmitForm && (_jsx(FooterDrawer, { isOpen: !showOverlay, children: _jsx(DrawerFooter, { w: "100%", py: "0", children: _jsx(ItemFormFooter, { onClearForm: onClearForm, onDuplicate: onDuplicate, onSave: onSubmitForm, onCancel: onClose }) }) }))] }));
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsx(DrawerBody, { p: "0", overflowX: "hidden", bg: "lightBlue.1", children: firstChild ? (_jsxs(_Fragment, { children: [firstChild, _jsxs(Box, { position: "relative", mb: "200px", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), otherChildren] })] })) : (_jsx(Loading, {})) }), onSubmitForm && (_jsx(FooterDrawer, { isOpen: !showOverlay, children: _jsx(DrawerFooter, { w: "100%", py: "0", children: _jsx(ItemFormFooter, { onClearForm: onClearForm, onDuplicate: onDuplicate, onSave: onSubmitForm, onCancel: onClose }) }) }))] }));
|
|
19
19
|
};
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export const ItemFormPanel = ({
|
|
|
20
20
|
onDuplicate,
|
|
21
21
|
}: PropsWithChildren<ItemFormPanelI>) => {
|
|
22
22
|
const { firstChild, otherChildren } = useMemo(() => {
|
|
23
|
-
let firstChild: ReactNode =
|
|
23
|
+
let firstChild: ReactNode | null = null
|
|
24
24
|
let otherChildren: ReactNode = children
|
|
25
25
|
|
|
26
26
|
if (Array.isArray(children) && children.length > 0) {
|
|
@@ -45,19 +45,23 @@ export const ItemFormPanel = ({
|
|
|
45
45
|
</DrawerHeader>
|
|
46
46
|
|
|
47
47
|
<DrawerBody p="0" overflowX="hidden" bg="lightBlue.1">
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
{firstChild ? (
|
|
49
|
+
<>
|
|
50
|
+
{firstChild}
|
|
51
|
+
<Box position="relative" mb="200px">
|
|
52
|
+
<Overlay
|
|
53
|
+
showOverlay={showOverlay}
|
|
54
|
+
position="absolute"
|
|
55
|
+
w="inherit"
|
|
56
|
+
h="inherit"
|
|
57
|
+
zIndex="9"
|
|
58
|
+
/>
|
|
59
|
+
{otherChildren}
|
|
60
|
+
</Box>
|
|
61
|
+
</>
|
|
62
|
+
) : (
|
|
63
|
+
<Loading />
|
|
64
|
+
)}
|
|
61
65
|
</DrawerBody>
|
|
62
66
|
{onSubmitForm && (
|
|
63
67
|
<FooterDrawer isOpen={!showOverlay}>
|