@homefile/components-v2 2.39.3 → 2.39.4
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/contacts/ContactCard.d.ts +1 -1
- package/dist/components/contacts/ContactCard.js +4 -4
- package/dist/components/contacts/ContactsContent.d.ts +1 -1
- package/dist/components/contacts/ContactsContent.js +7 -7
- package/dist/components/icons/Share.d.ts +4 -0
- package/dist/components/icons/Share.js +5 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/interfaces/contacts/ContactCard.interface.d.ts +1 -0
- package/dist/interfaces/contacts/ContactsContent.interface.d.ts +1 -0
- package/dist/stories/icons/ShareIcon.stories.d.ts +5 -0
- package/dist/stories/icons/ShareIcon.stories.js +11 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ContactCardI } from '../../interfaces';
|
|
2
|
-
export declare const ContactCard: ({ apiError, contact, index, menuItems, onClick, showAvatar, showHeader, }: ContactCardI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ContactCard: ({ apiError, contact, index, menuItems, onClick, onShare, showAvatar, showHeader, }: ContactCardI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Container, Flex, Stack } from '@chakra-ui/react';
|
|
3
|
-
import { ContactCardHeader, ContactCardInfo, ContactCardAddress, IconMenu, MoreHorizontal, } from '../../components';
|
|
2
|
+
import { Box, Container, Flex, IconButton, Stack } from '@chakra-ui/react';
|
|
3
|
+
import { ContactCardHeader, ContactCardInfo, ContactCardAddress, IconMenu, MoreHorizontal, Share, } from '../../components';
|
|
4
4
|
import { colors } from '../../theme/colors';
|
|
5
|
-
export const ContactCard = ({ apiError, contact, index, menuItems, onClick, showAvatar, showHeader = true, }) => {
|
|
5
|
+
export const ContactCard = ({ apiError, contact, index, menuItems, onClick, onShare, showAvatar, showHeader = true, }) => {
|
|
6
6
|
const hasOnClick = typeof onClick === 'function';
|
|
7
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
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 }) })] }));
|
|
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 })] }) }), Number(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) > 0 && (_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 }) })), onShare && (_jsx(Box, { position: "absolute", right: "2", bottom: "2", children: _jsx(IconButton, { variant: "icon", icon: _jsx(Share, { size: 14 }), onClick: () => onShare(contact), "aria-label": "share-contact" }) }))] }));
|
|
10
10
|
};
|
|
11
11
|
const CardBody = ({ contact, index, showAvatar, }) => {
|
|
12
12
|
return (_jsxs(Flex, { justify: "space-between", align: "end", 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)) })] }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ContactsContentI } from '../../interfaces';
|
|
2
|
-
export declare const ContactsContent: ({ apiError, contacts, menuItems, handleClose, children, handleAdd, disabled, onClick, onDeleteContacts, onShareContacts, showLoadMore, handleLoadMore, loadMoreDisabled }: ContactsContentI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ContactsContent: ({ apiError, contacts, menuItems, handleClose, children, handleAdd, disabled, onClick, onDeleteContacts, onShareContacts, showLoadMore, handleLoadMore, loadMoreDisabled, }: ContactsContentI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { t } from 'i18next';
|
|
3
|
-
import { DrawerContent, DrawerHeader, DrawerBody, Flex, Stack, Checkbox, Box, Text, DrawerFooter, Button } from '@chakra-ui/react';
|
|
3
|
+
import { DrawerContent, DrawerHeader, DrawerBody, Flex, Stack, Checkbox, Box, Text, DrawerFooter, Button, } from '@chakra-ui/react';
|
|
4
4
|
import { Contacts } from '../../assets/images';
|
|
5
5
|
import { ContactCard, FooterButtons, FooterDrawer, LeftButtonAnimated, LetterDivider, PanelHeader, SearchInput, } from '../../components';
|
|
6
6
|
import { useAssignableList, useContactsContent, useWindowDimensions, } from '../../hooks';
|
|
7
|
-
export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, children, handleAdd, disabled, onClick, onDeleteContacts, onShareContacts, showLoadMore, handleLoadMore, loadMoreDisabled }) => {
|
|
7
|
+
export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, children, handleAdd, disabled, onClick, onDeleteContacts, onShareContacts, showLoadMore, handleLoadMore, loadMoreDisabled, }) => {
|
|
8
8
|
const { contactsWithoutFirstOrLastName, handleChange, search, splittedContacts, } = useContactsContent(contacts);
|
|
9
9
|
const { getContactByIds, handleItemSelect, handleSelectAll, isItemSelected, itemsSelected, } = useAssignableList({
|
|
10
10
|
onItemSelectedChange: () => null,
|
|
@@ -17,12 +17,12 @@ export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, ch
|
|
|
17
17
|
const showLetterDivider = idx !== 0;
|
|
18
18
|
return (_jsxs(Stack, { spacing: "0", children: [showLetterDivider && _jsx(LetterDivider, { letter: letter }), _jsx(Stack, { spacing: "2px", children: splittedContacts[letter].map((contact, idx) => {
|
|
19
19
|
const selected = isItemSelected(contact._id);
|
|
20
|
-
return (_jsx(Card, { apiError: apiError, contact: contact, onClick: onClick, index: idx, menuItems: menuItems, selected: selected, onChange: handleItemSelect }, contact._id));
|
|
20
|
+
return (_jsx(Card, { apiError: apiError, contact: contact, onClick: onClick, index: idx, menuItems: menuItems, selected: selected, onChange: handleItemSelect, onShareContact: (contact) => onShareContacts([contact]) }, contact._id));
|
|
21
21
|
}) })] }, letter));
|
|
22
22
|
}) }), Number(contactsWithoutFirstOrLastName.length) > 0 && (_jsx(LetterDivider, { letter: "Others" })), _jsx(Box, { children: contactsWithoutFirstOrLastName.map((contact, idx) => {
|
|
23
23
|
const selected = isItemSelected(contact._id);
|
|
24
|
-
return (_jsx(Card, { apiError: apiError, contact: contact, onClick: onClick, index: idx, menuItems: menuItems, selected: selected, onChange: handleItemSelect }, contact._id));
|
|
25
|
-
}) })] }), children, showLoadMore && (_jsx(Flex, { justifyContent: 'center', bg: "lightBlue.2", p: '1rem', children: _jsx(Button, { onClick: handleLoadMore, variant:
|
|
24
|
+
return (_jsx(Card, { apiError: apiError, contact: contact, onClick: onClick, index: idx, menuItems: menuItems, selected: selected, onChange: handleItemSelect, onShareContact: (contact) => onShareContacts([contact]) }, contact._id));
|
|
25
|
+
}) })] }), children, showLoadMore && (_jsx(Flex, { justifyContent: 'center', bg: "lightBlue.2", p: '1rem', children: _jsx(Button, { onClick: handleLoadMore, variant: 'primaryFooter', disabled: loadMoreDisabled, children: t('buttons.loadMore') }) }))] }), _jsx(DrawerFooter, { p: "0", zIndex: "overlay", children: _jsx(FooterDrawer, { isOpen: !isDisabled, children: _jsx(FooterButtons, { button1: {
|
|
26
26
|
buttonStyle: 'primaryFooter',
|
|
27
27
|
label: t('buttons.share'),
|
|
28
28
|
onClick: () => onShareContacts(getContactByIds(itemsSelected)),
|
|
@@ -32,6 +32,6 @@ export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, ch
|
|
|
32
32
|
onClick: () => onDeleteContacts(itemsSelected),
|
|
33
33
|
} }) }) })] }));
|
|
34
34
|
};
|
|
35
|
-
const Card = ({ apiError, contact, onClick, index, menuItems, selected, onChange, }) => {
|
|
36
|
-
return (_jsxs(Flex, { gap: "3", pl: "base", bg: selected ? 'lightBlue.6' : 'transparent', children: [_jsx(Checkbox, { isChecked: selected, onChange: () => onChange(contact._id) }), _jsx(ContactCard, { apiError: apiError, contact: contact, menuItems: menuItems, onClick: onClick, index: index }, contact._id)] }, contact._id));
|
|
35
|
+
const Card = ({ apiError, contact, onClick, index, menuItems, selected, onChange, onShareContact, }) => {
|
|
36
|
+
return (_jsxs(Flex, { gap: "3", pl: "base", bg: selected ? 'lightBlue.6' : 'transparent', children: [_jsx(Checkbox, { isChecked: selected, onChange: () => onChange(contact._id) }), _jsx(ContactCard, { apiError: apiError, contact: contact, menuItems: menuItems, onClick: onClick, index: index, onShare: onShareContact }, contact._id)] }, contact._id));
|
|
37
37
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { colors } from '../../theme/colors';
|
|
3
|
+
export const Share = ({ stroke = colors.blue[3], size = 24 }) => {
|
|
4
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16.256 17.896", children: _jsxs("g", { id: "Icon_feather-share-2", "data-name": "Icon feather-share-2", transform: "translate(-3.75 -2.25)", children: [_jsx("path", { id: "Caminho_18690", "data-name": "Caminho 18690", d: "M27.419,5.459A2.459,2.459,0,1,1,24.959,3,2.459,2.459,0,0,1,27.419,5.459Z", transform: "translate(-8.163 0)", fill: "none", stroke: stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }), _jsx("path", { id: "Caminho_18691", "data-name": "Caminho 18691", d: "M9.419,15.959A2.459,2.459,0,1,1,6.959,13.5,2.459,2.459,0,0,1,9.419,15.959Z", transform: "translate(0 -4.761)", fill: "none", stroke: stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }), _jsx("path", { id: "Caminho_18692", "data-name": "Caminho 18692", d: "M27.419,26.459A2.459,2.459,0,1,1,24.959,24,2.459,2.459,0,0,1,27.419,26.459Z", transform: "translate(-8.163 -9.523)", fill: "none", stroke: stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }), _jsx("path", { id: "Caminho_18693", "data-name": "Caminho 18693", d: "M12.885,20.265l5.6,3.263", transform: "translate(-3.802 -7.829)", fill: "none", stroke: stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }), _jsx("path", { id: "Caminho_18694", "data-name": "Caminho 18694", d: "M18.476,9.765l-5.591,3.263", transform: "translate(-3.802 -3.068)", fill: "none", stroke: stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" })] }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Center } from '@chakra-ui/react';
|
|
3
|
+
import { Share } from '../../components';
|
|
4
|
+
import { colors } from '../../theme/colors';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Icons',
|
|
7
|
+
component: Share,
|
|
8
|
+
};
|
|
9
|
+
export const ShareComponent = (args) => {
|
|
10
|
+
return (_jsx(Center, { width: "10rem", p: "base", bg: "white", children: _jsx(Share, Object.assign({}, args, { stroke: colors.blue[1] })) }));
|
|
11
|
+
};
|