@homefile/components-v2 2.8.31 → 2.8.33
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/dist/components/forms/dynamicForm/ItemFormPanel/ItemFormPanel.d.ts +1 -1
- package/dist/components/forms/dynamicForm/ItemFormPanel/ItemFormPanel.js +15 -13
- package/dist/components/rooms/RoomsMenu.js +1 -1
- package/dist/components/rooms/RoomsMenuMobile.js +1 -1
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/ItemFormPanel/ItemFormPanel.tsx +34 -22
- package/src/components/rooms/RoomsMenu.tsx +1 -1
- package/src/components/rooms/RoomsMenuMobile.tsx +1 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { ItemFormPanelI } from '../../../../interfaces';
|
|
3
|
-
export declare const ItemFormPanel: ({ children, onClose, onSubmitForm, panelIcon, panelTitle, showOverlay, }: PropsWithChildren<ItemFormPanelI>) => import("react/jsx-runtime").JSX.Element
|
|
3
|
+
export declare const ItemFormPanel: ({ children, onClose, onSubmitForm, panelIcon, panelTitle, showOverlay, }: PropsWithChildren<ItemFormPanelI>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { DrawerBody, DrawerHeader, DrawerContent, DrawerFooter, Box, } from '@chakra-ui/react';
|
|
3
|
-
import { PanelHeader, FooterDrawer, ItemFormFooter, Overlay, } from '../../..';
|
|
4
|
+
import { PanelHeader, FooterDrawer, ItemFormFooter, Overlay, Loading } from '../../..';
|
|
4
5
|
export const ItemFormPanel = ({ children, onClose, onSubmitForm, panelIcon, panelTitle, showOverlay = false, }) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const { firstChild, otherChildren } = useMemo(() => {
|
|
7
|
+
let firstChild = null;
|
|
8
|
+
let otherChildren = children;
|
|
9
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
10
|
+
const header = children[0];
|
|
11
|
+
if (header.props && header.props.id === 'item-name-header') {
|
|
12
|
+
firstChild = header;
|
|
13
|
+
otherChildren = children.slice(1);
|
|
14
|
+
}
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsxs(DrawerBody, { p: "0", overflowX: "hidden", bg: "lightBlue.1", children: [firstChild, _jsxs(Box, { position: "relative", mb: "200px", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), otherChildren] })] }), _jsx(FooterDrawer, { isOpen: !showOverlay, children: _jsx(DrawerFooter, { w: "100%", py: "0", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
|
|
16
|
+
return { firstChild, otherChildren };
|
|
17
|
+
}, [children]);
|
|
18
|
+
return (_jsxs(DrawerContent, { bg: "lightBlue.1", 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, {})) }), _jsx(FooterDrawer, { isOpen: !showOverlay, children: _jsx(DrawerFooter, { w: "100%", py: "0", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
|
|
17
19
|
};
|
|
@@ -7,7 +7,7 @@ import { House } from '../../assets/images';
|
|
|
7
7
|
export const RoomsMenu = ({ activeRoom, rooms, roomsToAdd, onClick, onHomeClick, onAddRoom, disabled, }) => {
|
|
8
8
|
const { handleDragStart, handleDrop, newRooms } = useRoomList(rooms);
|
|
9
9
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
10
|
-
return (_jsx(Show, { breakpoint: "(min-width: 600px)", children: _jsxs(Box, { bg: "neutral.white", minW: "fit-content", children: [_jsxs(Box, { w: "container.roomIcon", minW: "container.roomIcon", transition: "all 0.2s ease-in-out", bg: "lightBlue.4", children: [_jsx(Box, { overflow: "hidden", children: _jsx(Tooltip, { hasArrow: true, isDisabled: false, label: t('addRoom.addBtn'), placement: "right", children: _jsx(Box, { as: "button", w: "full", h: "container.masthead", onClick: onOpen, transition: "all 0.2s ease-in-out", bg: "blue.2", disabled: disabled, overflow: "hidden", _hover: { backgroundColor: 'blue.3' }, _disabled: {
|
|
10
|
+
return (_jsx(Show, { breakpoint: "(min-width: 600px)", children: _jsxs(Box, { bg: "neutral.white", minW: "fit-content", "data-testid": "rooms-menu", children: [_jsxs(Box, { w: "container.roomIcon", minW: "container.roomIcon", transition: "all 0.2s ease-in-out", bg: "lightBlue.4", children: [_jsx(Box, { overflow: "hidden", children: _jsx(Tooltip, { hasArrow: true, isDisabled: false, label: t('addRoom.addBtn'), placement: "right", children: _jsx(Box, { as: "button", w: "full", h: "container.masthead", onClick: onOpen, transition: "all 0.2s ease-in-out", bg: "blue.2", disabled: disabled, overflow: "hidden", _hover: { backgroundColor: 'blue.3' }, _disabled: {
|
|
11
11
|
filter: 'grayscale(100%)',
|
|
12
12
|
pointerEvents: 'none',
|
|
13
13
|
}, children: _jsx(Center, { minW: "container.roomIcon", children: _jsx(Plus, {}) }) }) }) }), _jsx(Tooltip, { hasArrow: true, isDisabled: activeRoom === 'homeboard', label: t('rooms.homeboard'), placement: "right", children: _jsx(Box, { w: "full", as: "button", h: "3.2rem", bg: activeRoom === 'homeboard' ? 'lightGreen.3' : 'neutral.white', onClick: onHomeClick, children: _jsx(Center, { minW: "container.roomIcon", children: _jsx(Image, { src: House, alt: t('ariaLabels.returnHomeBoard'), w: "1.5rem", h: "auto" }) }) }) }), _jsx(Box, { children: newRooms.map((room, i) => {
|
|
@@ -8,7 +8,7 @@ import { House } from '../../assets/images';
|
|
|
8
8
|
export const RoomsMenuMobile = ({ activeRoom, rooms, roomsToAdd, onClick, onHomeClick, onAddRoom, }) => {
|
|
9
9
|
const { newRooms } = useRoomList(rooms);
|
|
10
10
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
11
|
-
return (_jsx(Show, { breakpoint: "(max-width: 590px)", children: _jsxs(Box, { mt: "2", w: "full", position: "fixed", bottom: "0", shadow: "0 0 8px 1px #00000010", zIndex: "dropdown", overflow: "hidden", overflowX: "auto", css: {
|
|
11
|
+
return (_jsx(Show, { breakpoint: "(max-width: 590px)", children: _jsxs(Box, { "data-testid": "rooms-menu-mobile", mt: "2", w: "full", position: "fixed", bottom: "0", shadow: "0 0 8px 1px #00000010", zIndex: "dropdown", overflow: "hidden", overflowX: "auto", css: {
|
|
12
12
|
'&::-webkit-scrollbar': {
|
|
13
13
|
height: '0px',
|
|
14
14
|
},
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from 'react'
|
|
1
|
+
import { PropsWithChildren, ReactNode, useMemo } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
DrawerBody,
|
|
4
4
|
DrawerHeader,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
FooterDrawer,
|
|
12
12
|
ItemFormFooter,
|
|
13
13
|
Overlay,
|
|
14
|
+
Loading
|
|
14
15
|
} from '@/components'
|
|
15
16
|
import { ItemFormPanelI } from '@/interfaces'
|
|
16
17
|
|
|
@@ -22,18 +23,21 @@ export const ItemFormPanel = ({
|
|
|
22
23
|
panelTitle,
|
|
23
24
|
showOverlay = false,
|
|
24
25
|
}: PropsWithChildren<ItemFormPanelI>) => {
|
|
25
|
-
let firstChild: ReactNode | null = null
|
|
26
|
-
let otherChildren: ReactNode = children
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
firstChild = header
|
|
32
|
-
otherChildren = children.slice(1)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
27
|
+
const { firstChild, otherChildren } = useMemo(() => {
|
|
28
|
+
let firstChild: ReactNode | null = null
|
|
29
|
+
let otherChildren: ReactNode = children
|
|
35
30
|
|
|
36
|
-
|
|
31
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
32
|
+
const header = children[0]
|
|
33
|
+
if (header.props && header.props.id === 'item-name-header') {
|
|
34
|
+
firstChild = header
|
|
35
|
+
otherChildren = children.slice(1)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { firstChild, otherChildren }
|
|
40
|
+
}, [children])
|
|
37
41
|
|
|
38
42
|
return (
|
|
39
43
|
<DrawerContent bg="lightBlue.1">
|
|
@@ -46,17 +50,25 @@ export const ItemFormPanel = ({
|
|
|
46
50
|
</DrawerHeader>
|
|
47
51
|
|
|
48
52
|
<DrawerBody p="0" overflowX="hidden" bg="lightBlue.1">
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
{
|
|
54
|
+
firstChild ? (
|
|
55
|
+
<>
|
|
56
|
+
{firstChild}
|
|
57
|
+
<Box position="relative" mb="200px">
|
|
58
|
+
<Overlay
|
|
59
|
+
showOverlay={showOverlay}
|
|
60
|
+
position="absolute"
|
|
61
|
+
w="inherit"
|
|
62
|
+
h="inherit"
|
|
63
|
+
zIndex="9"
|
|
64
|
+
/>
|
|
65
|
+
{otherChildren}
|
|
66
|
+
</Box>
|
|
67
|
+
</>
|
|
68
|
+
) : (
|
|
69
|
+
<Loading />
|
|
70
|
+
)
|
|
71
|
+
}
|
|
60
72
|
</DrawerBody>
|
|
61
73
|
<FooterDrawer isOpen={!showOverlay}>
|
|
62
74
|
<DrawerFooter w="100%" py="0">
|
|
@@ -26,7 +26,7 @@ export const RoomsMenu = ({
|
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<Show breakpoint="(min-width: 600px)">
|
|
29
|
-
<Box bg="neutral.white" minW="fit-content">
|
|
29
|
+
<Box bg="neutral.white" minW="fit-content" data-testid="rooms-menu">
|
|
30
30
|
<Box
|
|
31
31
|
w="container.roomIcon"
|
|
32
32
|
minW="container.roomIcon"
|