@homefile/components-v2 2.8.10 → 2.8.12

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,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Container, Flex, Stack } from '@chakra-ui/react';
3
- import { ContactCardHeader, ContactCardInfo, ContactCardAddress, } from '..';
3
+ import { ContactCardHeader, ContactCardInfo, ContactCardAddress, IconMenu, MoreHorizontal, } from '..';
4
4
  import { colors } from '../../theme/colors';
5
5
  export const ContactCard = ({ apiError, contact, index, menuItems, onClick, showAvatar, showHeader = true, }) => {
6
6
  const hasOnClick = typeof onClick === 'function';
7
- return (_jsx(Container, { maxW: "none", textAlign: "start", onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(Object.assign(Object.assign({}, contact), { index })), transition: "background-color 0.3s", _hover: {
8
- bg: hasOnClick ? 'lightGreen.1' : 'neutral.white',
9
- }, cursor: hasOnClick ? 'pointer' : 'default', children: _jsxs(Stack, { pb: "base", pt: "1", px: "base", spacing: "base", children: [showHeader && (_jsx(ContactCardHeader, { apiError: apiError, contact: contact, menuItems: menuItems })), _jsx(CardBody, { contact, index, showAvatar })] }) }));
7
+ return (_jsxs(Box, { position: "relative", w: "100%", children: [_jsx(Container, { maxW: "none", textAlign: "start", onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(Object.assign(Object.assign({}, contact), { index })), transition: "background-color 0.3s", _hover: {
8
+ bg: hasOnClick ? 'lightGreen.1' : 'neutral.white',
9
+ }, cursor: hasOnClick ? 'pointer' : 'default', children: _jsxs(Stack, { pb: "base", pt: "1", px: "base", spacing: "base", children: [showHeader && (_jsx(ContactCardHeader, { apiError: apiError, contact: contact })), _jsx(CardBody, { contact, index, showAvatar })] }) }), _jsx(Box, { position: "absolute", right: "1", top: "0", zIndex: "overlay", children: _jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: Number(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) < 1 }) })] }));
10
10
  };
11
11
  const CardBody = ({ contact, index, showAvatar, }) => {
12
12
  return (_jsxs(Flex, { justify: "space-between", align: "stretch", gap: "base", children: [_jsx(ContactCardInfo, Object.assign({}, contact, { index, showAvatar })), _jsx(Box, { borderLeft: `1px solid ${colors.lightBlue[1]}`, w: "45%", pl: "base", children: _jsx(ContactCardAddress, Object.assign({}, contact)) })] }));
@@ -6,5 +6,5 @@ import { IconMenu, MoreHorizontal } from '..';
6
6
  export const ContactCardHeader = ({ contact, menuItems = [], }) => {
7
7
  var _a;
8
8
  const { category, title } = contact;
9
- return (_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: Contacts, boxSize: "1rem", "aria-label": (_a = t('ariaLabels.contact')) !== null && _a !== void 0 ? _a : ' ' }), _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Text, { fontSize: "xs", children: category.toUpperCase() }), title && (_jsx(Text, { fontSize: "xs", color: "gray.4", children: "|" })), _jsx(Text, { fontSize: "xs", children: title.toUpperCase() })] })] }), _jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: menuItems.length < 1 })] }));
9
+ return (_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: Contacts, boxSize: "1rem", "aria-label": (_a = t('ariaLabels.contact')) !== null && _a !== void 0 ? _a : ' ' }), _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Text, { fontSize: "xs", children: category.toUpperCase() }), title && (_jsx(Text, { fontSize: "xs", color: "gray.4", children: "|" })), _jsx(Text, { fontSize: "xs", children: title.toUpperCase() })] })] }), !!menuItems.length && (_jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: menuItems.length < 1 }))] }));
10
10
  };
@@ -1,3 +1,3 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ItemFormPanelI } from '../../../../interfaces';
3
- export declare const ItemFormPanel: ({ children, itemName, onClose, onSaveItemName, onSubmitForm, panelIcon, panelTitle, showFooter, showOverlay, }: PropsWithChildren<ItemFormPanelI>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const ItemFormPanel: ({ children, itemName, onClose, onSaveItemName, onSubmitForm, panelIcon, panelTitle, showOverlay, }: PropsWithChildren<ItemFormPanelI>) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { DrawerBody, DrawerHeader, DrawerContent, DrawerFooter, Box, } from '@chakra-ui/react';
3
3
  import { PanelHeader, FooterDrawer, ItemNameHeader, ItemFormFooter, Overlay, } from '../../..';
4
- export const ItemFormPanel = ({ children, itemName, onClose, onSaveItemName, onSubmitForm, panelIcon, panelTitle, showFooter = false, showOverlay = false, }) => {
5
- return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsxs(DrawerBody, { p: "0", pb: "12", overflowX: "hidden", bg: "lightBlue.1", children: [_jsx(ItemNameHeader, { id: "item-name", onSave: onSaveItemName, value: itemName }), _jsxs(Box, { position: "relative", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), children] })] }), _jsx(FooterDrawer, { isOpen: showFooter, children: _jsx(DrawerFooter, { w: "100%", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
4
+ export const ItemFormPanel = ({ children, itemName, onClose, onSaveItemName, onSubmitForm, panelIcon, panelTitle, showOverlay = false, }) => {
5
+ 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: [_jsx(ItemNameHeader, { id: "item-name", onSave: onSaveItemName, value: itemName }), _jsxs(Box, { position: "relative", mb: "200px", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), children] })] }), _jsx(FooterDrawer, { isOpen: !showOverlay, children: _jsx(DrawerFooter, { w: "100%", py: "0", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
6
6
  };
@@ -5,6 +5,5 @@ export interface ItemFormPanelI {
5
5
  onSubmitForm: () => void;
6
6
  panelIcon: string;
7
7
  panelTitle: string;
8
- showFooter?: boolean;
9
8
  showOverlay?: boolean;
10
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.8.10",
3
+ "version": "2.8.12",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -4,6 +4,8 @@ import {
4
4
  ContactCardHeader,
5
5
  ContactCardInfo,
6
6
  ContactCardAddress,
7
+ IconMenu,
8
+ MoreHorizontal,
7
9
  } from '@/components'
8
10
  import { colors } from '@/theme/colors'
9
11
 
@@ -18,27 +20,33 @@ export const ContactCard = ({
18
20
  }: ContactCardI) => {
19
21
  const hasOnClick = typeof onClick === 'function'
20
22
  return (
21
- <Container
22
- maxW="none"
23
- textAlign="start"
24
- onClick={() => onClick?.({ ...contact, index })}
25
- transition="background-color 0.3s"
26
- _hover={{
27
- bg: hasOnClick ? 'lightGreen.1' : 'neutral.white',
28
- }}
29
- cursor={hasOnClick ? 'pointer' : 'default'}
30
- >
31
- <Stack pb="base" pt="1" px="base" spacing="base">
32
- {showHeader && (
33
- <ContactCardHeader
34
- apiError={apiError}
35
- contact={contact}
36
- menuItems={menuItems}
37
- />
38
- )}
39
- <CardBody {...{ contact, index, showAvatar }} />
40
- </Stack>
41
- </Container>
23
+ <Box position="relative" w="100%">
24
+ <Container
25
+ maxW="none"
26
+ textAlign="start"
27
+ onClick={() => onClick?.({ ...contact, index })}
28
+ transition="background-color 0.3s"
29
+ _hover={{
30
+ bg: hasOnClick ? 'lightGreen.1' : 'neutral.white',
31
+ }}
32
+ cursor={hasOnClick ? 'pointer' : 'default'}
33
+ >
34
+ <Stack pb="base" pt="1" px="base" spacing="base">
35
+ {showHeader && (
36
+ <ContactCardHeader apiError={apiError} contact={contact} />
37
+ )}
38
+ <CardBody {...{ contact, index, showAvatar }} />
39
+ </Stack>
40
+ </Container>
41
+ <Box position="absolute" right="1" top="0" zIndex="overlay">
42
+ <IconMenu
43
+ icon={<MoreHorizontal size={32} />}
44
+ itemForm={contact}
45
+ menuItems={menuItems}
46
+ disabled={Number(menuItems?.length) < 1}
47
+ />
48
+ </Box>
49
+ </Box>
42
50
  )
43
51
  }
44
52
 
@@ -27,12 +27,14 @@ export const ContactCardHeader = ({
27
27
  <Text fontSize="xs">{title.toUpperCase()}</Text>
28
28
  </Flex>
29
29
  </Flex>
30
- <IconMenu
31
- icon={<MoreHorizontal size={32} />}
32
- itemForm={contact}
33
- menuItems={menuItems}
34
- disabled={menuItems.length < 1}
35
- />
30
+ {!!menuItems.length && (
31
+ <IconMenu
32
+ icon={<MoreHorizontal size={32} />}
33
+ itemForm={contact}
34
+ menuItems={menuItems}
35
+ disabled={menuItems.length < 1}
36
+ />
37
+ )}
36
38
  </Flex>
37
39
  )
38
40
  }
@@ -23,7 +23,6 @@ export const ItemFormPanel = ({
23
23
  onSubmitForm,
24
24
  panelIcon,
25
25
  panelTitle,
26
- showFooter = false,
27
26
  showOverlay = false,
28
27
  }: PropsWithChildren<ItemFormPanelI>) => {
29
28
  return (
@@ -36,13 +35,13 @@ export const ItemFormPanel = ({
36
35
  />
37
36
  </DrawerHeader>
38
37
 
39
- <DrawerBody p="0" pb="12" overflowX="hidden" bg="lightBlue.1">
38
+ <DrawerBody p="0" overflowX="hidden" bg="lightBlue.1">
40
39
  <ItemNameHeader
41
40
  id="item-name"
42
41
  onSave={onSaveItemName}
43
42
  value={itemName}
44
43
  />
45
- <Box position="relative">
44
+ <Box position="relative" mb="200px">
46
45
  <Overlay
47
46
  showOverlay={showOverlay}
48
47
  position="absolute"
@@ -53,8 +52,8 @@ export const ItemFormPanel = ({
53
52
  {children}
54
53
  </Box>
55
54
  </DrawerBody>
56
- <FooterDrawer isOpen={showFooter}>
57
- <DrawerFooter w="100%">
55
+ <FooterDrawer isOpen={!showOverlay}>
56
+ <DrawerFooter w="100%" py="0">
58
57
  <ItemFormFooter onSave={onSubmitForm} onCancel={onClose} />
59
58
  </DrawerFooter>
60
59
  </FooterDrawer>
@@ -5,6 +5,5 @@ export interface ItemFormPanelI {
5
5
  onSubmitForm: () => void
6
6
  panelIcon: string
7
7
  panelTitle: string
8
- showFooter?: boolean
9
8
  showOverlay?: boolean
10
9
  }