@homefile/components-v2 2.9.2 → 2.9.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.
Files changed (26) hide show
  1. package/dist/assets/locales/en/index.json +2 -1
  2. package/dist/components/contacts/ContactsContent.d.ts +1 -1
  3. package/dist/components/contacts/ContactsContent.js +3 -3
  4. package/dist/components/homeBoard/HomeBoard.js +1 -1
  5. package/dist/components/launchpad/Launchpad.js +1 -1
  6. package/dist/components/myHomes/MyHomes.d.ts +1 -1
  7. package/dist/components/myHomes/MyHomes.js +3 -3
  8. package/dist/interfaces/contacts/ContactsContent.interface.d.ts +3 -0
  9. package/dist/interfaces/myHomes/MyHomes.interface.d.ts +3 -0
  10. package/dist/interfaces/myProfile/details/TwoFactorDialog.interface.d.ts +1 -1
  11. package/dist/interfaces/pages/TwoFactor.interface.d.ts +1 -1
  12. package/dist/stories/contacts/ContactsContent.stories.js +1 -0
  13. package/dist/stories/myHomes/MyHomes.stories.d.ts +3 -0
  14. package/dist/stories/myHomes/MyHomes.stories.js +3 -0
  15. package/package.json +1 -1
  16. package/src/assets/locales/en/index.json +2 -1
  17. package/src/components/contacts/ContactsContent.tsx +13 -0
  18. package/src/components/homeBoard/HomeBoard.tsx +3 -0
  19. package/src/components/launchpad/Launchpad.tsx +3 -0
  20. package/src/components/myHomes/MyHomes.tsx +13 -1
  21. package/src/interfaces/contacts/ContactsContent.interface.ts +3 -0
  22. package/src/interfaces/myHomes/MyHomes.interface.ts +3 -0
  23. package/src/interfaces/myProfile/details/TwoFactorDialog.interface.ts +1 -1
  24. package/src/interfaces/pages/TwoFactor.interface.ts +1 -1
  25. package/src/stories/contacts/ContactsContent.stories.tsx +1 -0
  26. package/src/stories/myHomes/MyHomes.stories.tsx +3 -0
@@ -113,7 +113,8 @@
113
113
  "share": "Share",
114
114
  "skip": "Skip for now",
115
115
  "saveStep": "Save Step",
116
- "finish": "Finish"
116
+ "finish": "Finish",
117
+ "loadMore": "Load More"
117
118
  },
118
119
  "createDocument": {
119
120
  "tabs": {
@@ -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, }: 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, } 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 '..';
6
6
  import { useAssignableList, useContactsContent, useWindowDimensions, } from '../../hooks';
7
- export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, children, handleAdd, disabled, onClick, onDeleteContacts, onShareContacts, }) => {
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,
@@ -22,7 +22,7 @@ export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, ch
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
24
  return (_jsx(Card, { apiError: apiError, contact: contact, onClick: onClick, index: idx, menuItems: menuItems, selected: selected, onChange: handleItemSelect }, contact._id));
25
- }) })] }), children] }), _jsx(DrawerFooter, { p: "0", zIndex: "overlay", children: _jsx(FooterDrawer, { isOpen: !isDisabled, children: _jsx(FooterButtons, { button1: {
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)),
@@ -45,7 +45,7 @@ export const HomeBoard = () => {
45
45
  label: 'Edit Contact',
46
46
  handleClick: () => null,
47
47
  },
48
- ], onShareContacts: () => null, onDeleteContacts: () => null })),
48
+ ], onShareContacts: () => null, onDeleteContacts: () => null, handleLoadMore: () => null, showLoadMore: false, loadMoreDisabled: false })),
49
49
  PartnerCatalog: (_jsx(PartnerCatalogPanel, { onClose: onRightClose, onPartnerAdd: () => null, partners: partnerCatalogMock })),
50
50
  AddHouseholdItem: (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Painting, title: "Add Household Item" }) }), _jsx(DrawerBody, { children: _jsx(DynamicForm, { form: formFieldsMock }) })] })),
51
51
  HomeAssistant: (_jsx(HomeAssistantPanel, { currentStep: homeAssistantCurrentStep, currentForm: currentHomeAssistantForm, onNext: handleHomeAssistantFormChange, onBack: handleHomeAssistantBack, onApplianceClick: () => null, onClose: onRightClose, onSave: () => { }, backDisabled: false, nextDisabled: false, hasCompleted: true, isLoading: false })),
@@ -6,6 +6,6 @@ import { useLaunchpad } from '../../hooks';
6
6
  import { videoMock } from '../../mocks';
7
7
  export const Launchpad = () => {
8
8
  const { activeTour, currentStep, firstName, handleCardClick, handleClose, handleStep, homes, isLeftOpen, isRightOpen, onLeftClose, onLeftOpen, onRightClose, setActiveTour, showOverlay, } = useLaunchpad();
9
- return (_jsxs(_Fragment, { children: [_jsxs(Box, { w: "full", children: [_jsx(LeftPanel, { children: _jsx(AddHomeContent, { handleSkipClick: onLeftClose, userFirstName: firstName, handleCreateHomeClick: onLeftClose, isFirstHome: false }), isOpen: isLeftOpen, onClose: onLeftClose, overlay: showOverlay }), _jsx(RightPanel, { children: _jsx(CreateDocumentContent, { handleDateRange: homes.handleDateRange, handleSelectHome: homes.handleSelectHome, homes: homes.homes, initialHome: homes.initialHome, onCloseButton: onRightClose }), isOpen: isRightOpen, onClose: onRightClose, size: "lg" }), _jsx(AppBarComponent, { setActiveTour: setActiveTour }), _jsxs(Box, { children: [_jsx(Header, { firstName: firstName }), _jsxs(Flex, { direction: ['column-reverse', 'row'], gap: "base", w: "full", px: [0, 'base'], children: [_jsx(Box, { w: "full", children: _jsx(MyHomes, { handleFilterClick: (_) => null, cardList: HomeCards, cardMenuItems: MenuItems, handleCardClick: handleCardClick, handleNewHomeClick: onLeftOpen, headerMenuItems: MyHomeMenuItems, addImage: () => null, loading: false, loadingId: "" }) }), _jsxs(Stack, { spacing: "base", children: [_jsx(Subscription, { availableStorage: 8, state: "paid", totalStorage: 10, totalUsed: 2 }), _jsx(LaunchpadReceiptAutofiler, { onClick: () => { }, totalReceipts: 5, totalTitle: "To be assigned" })] })] })] })] }), _jsx(LaunchpadTour, { currentStep: currentStep, handleStep: handleStep, handleClose: handleClose, meetStepUrl: videoMock, isActive: activeTour })] }));
9
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, { w: "full", children: [_jsx(LeftPanel, { children: _jsx(AddHomeContent, { handleSkipClick: onLeftClose, userFirstName: firstName, handleCreateHomeClick: onLeftClose, isFirstHome: false }), isOpen: isLeftOpen, onClose: onLeftClose, overlay: showOverlay }), _jsx(RightPanel, { children: _jsx(CreateDocumentContent, { handleDateRange: homes.handleDateRange, handleSelectHome: homes.handleSelectHome, homes: homes.homes, initialHome: homes.initialHome, onCloseButton: onRightClose }), isOpen: isRightOpen, onClose: onRightClose, size: "lg" }), _jsx(AppBarComponent, { setActiveTour: setActiveTour }), _jsxs(Box, { children: [_jsx(Header, { firstName: firstName }), _jsxs(Flex, { direction: ['column-reverse', 'row'], gap: "base", w: "full", px: [0, 'base'], children: [_jsx(Box, { w: "full", children: _jsx(MyHomes, { handleFilterClick: (_) => null, cardList: HomeCards, cardMenuItems: MenuItems, handleCardClick: handleCardClick, handleNewHomeClick: onLeftOpen, headerMenuItems: MyHomeMenuItems, addImage: () => null, loading: false, loadingId: "", handleLoadMore: () => null, showLoadMore: false, loadMoreDisabled: false }) }), _jsxs(Stack, { spacing: "base", children: [_jsx(Subscription, { availableStorage: 8, state: "paid", totalStorage: 10, totalUsed: 2 }), _jsx(LaunchpadReceiptAutofiler, { onClick: () => { }, totalReceipts: 5, totalTitle: "To be assigned" })] })] })] })] }), _jsx(LaunchpadTour, { currentStep: currentStep, handleStep: handleStep, handleClose: handleClose, meetStepUrl: videoMock, isActive: activeTour })] }));
10
10
  };
11
11
  export default Launchpad;
@@ -1,2 +1,2 @@
1
1
  import { MyHomesI } from '../../interfaces';
2
- export declare const MyHomes: ({ cardList, cardMenuItems, handleCardClick, handleFilterClick, handleNewHomeClick, headerMenuItems, addImage, loading, loadingId, }: MyHomesI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MyHomes: ({ cardList, cardMenuItems, handleCardClick, handleFilterClick, handleNewHomeClick, headerMenuItems, addImage, loading, loadingId, showLoadMore, handleLoadMore, loadMoreDisabled }: MyHomesI) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { t } from 'i18next';
3
- import { Box, Container, Wrap, WrapItem } from '@chakra-ui/react';
3
+ import { Box, Container, Wrap, WrapItem, Button, Flex } from '@chakra-ui/react';
4
4
  import { MyHomesHeader, MyHomeCard, ContainerHeader, MoreHorizontal, TileTooltip, InviteRolesStep, BaseStep, } from '..';
5
5
  import { House } from '../../assets/images';
6
6
  import { useState } from 'react';
7
- export const MyHomes = ({ cardList = [], cardMenuItems = [], handleCardClick, handleFilterClick, handleNewHomeClick, headerMenuItems, addImage, loading, loadingId, }) => {
7
+ export const MyHomes = ({ cardList = [], cardMenuItems = [], handleCardClick, handleFilterClick, handleNewHomeClick, headerMenuItems, addImage, loading, loadingId, showLoadMore, handleLoadMore, loadMoreDisabled }) => {
8
8
  const [showChildren, setShowChildren] = useState(false);
9
9
  const handleHelpClick = () => setShowChildren(!showChildren);
10
10
  return (_jsx(TileTooltip, { label: "myHomes", children: _jsxs(Container, { variant: "launchpad", maxW: "none", pb: "3rem", position: "relative", children: [showChildren && (_jsx(BaseStep, { top: "60px", right: "60px", onClose: handleHelpClick, children: _jsx(InviteRolesStep, {}) })), _jsx(ContainerHeader, { disabled: true, menuItems: headerMenuItems, title: t('myHomes.title'), icon: _jsx(MoreHorizontal, { size: 38 }), titleIcon: House, showHelp: true, onHelpClick: handleHelpClick }), _jsx(MyHomesHeader, { onFilterClick: handleFilterClick, onNewHomeClick: handleNewHomeClick }), _jsx(Wrap, { spacing: "base", px: "base", alignItems: "start", children: cardList.length > 0 &&
11
11
  (cardList === null || cardList === void 0 ? void 0 : cardList.map(({ accountType, address, active, _id, image, name }, index) => (_jsx(WrapItem, { children: _jsxs(Container, { w: "179px", position: "relative", transition: "all 0.3s ease-in-out", _hover: {
12
12
  boxShadow: 'xl',
13
- }, id: index === 0 ? 'homeCard' : '', children: [_jsx(ContainerHeader, { menuItems: accountType === "Member" ? [] : cardMenuItems, itemForm: { _id, name }, icon: _jsx(MoreHorizontal, {}), isThin: true, index: index }), _jsx(Box, { w: "179px", textAlign: "left", children: _jsx(MyHomeCard, { accountType: accountType, address: address, image: image, name: name, active: active, _id: _id, index: index, handleCardClick: handleCardClick, addImage: addImage, loading: loading, loadingId: loadingId }) })] }) }, _id)))) })] }) }));
13
+ }, id: index === 0 ? 'homeCard' : '', children: [_jsx(ContainerHeader, { menuItems: accountType === "Member" ? [] : cardMenuItems, itemForm: { _id, name }, icon: _jsx(MoreHorizontal, {}), isThin: true, index: index }), _jsx(Box, { w: "179px", textAlign: "left", children: _jsx(MyHomeCard, { accountType: accountType, address: address, image: image, name: name, active: active, _id: _id, index: index, handleCardClick: handleCardClick, addImage: addImage, loading: loading, loadingId: loadingId }) })] }) }, _id)))) }), showLoadMore && (_jsx(Flex, { justifyContent: 'center', mt: '2rem', children: _jsx(Button, { onClick: handleLoadMore, variant: "primaryFooter", disabled: loadMoreDisabled, children: t('buttons.loadMore') }) }))] }) }));
14
14
  };
@@ -14,6 +14,9 @@ export interface ContactsContentI {
14
14
  onClick?: (contact: ContactAndIndexForm) => void;
15
15
  onDeleteContacts: (contactsIds: string[]) => void;
16
16
  onShareContacts: (contacts: InfoContactCardI[]) => void;
17
+ showLoadMore: boolean;
18
+ handleLoadMore: () => void;
19
+ loadMoreDisabled: boolean;
17
20
  }
18
21
  export interface CardOnContactListI {
19
22
  apiError: ContactsContentI['apiError'];
@@ -13,4 +13,7 @@ export interface MyHomesI {
13
13
  addImage: (img: HomeImageI) => void;
14
14
  loading: boolean;
15
15
  loadingId: string;
16
+ showLoadMore: boolean;
17
+ handleLoadMore: () => void;
18
+ loadMoreDisabled: boolean;
16
19
  }
@@ -4,5 +4,5 @@ export interface TwoFactorDialogI {
4
4
  onClose: () => void;
5
5
  onResend?: () => void;
6
6
  onReset: (code: string) => void;
7
- twoFactorMethod: 'sms' | 'email';
7
+ twoFactorMethod: 'sms' | 'email' | "";
8
8
  }
@@ -3,5 +3,5 @@ export interface TwoFactorI {
3
3
  onReset: (code: string) => void;
4
4
  isDialog?: boolean;
5
5
  isLoading: boolean;
6
- twoFactorMethod: 'sms' | 'email';
6
+ twoFactorMethod: 'sms' | 'email' | "";
7
7
  }
@@ -11,6 +11,7 @@ export default {
11
11
  onClick: action('onClick'),
12
12
  contacts: ContactsMock,
13
13
  menuItems: menuMock,
14
+ showLoadMore: true
14
15
  },
15
16
  };
16
17
  export const ContactsContentComponent = (args) => {
@@ -47,5 +47,8 @@ export declare const MyHomesComponent: {
47
47
  loading: boolean;
48
48
  loadingId: string;
49
49
  handleFilterClick: import("@storybook/addon-actions").HandlerFunction;
50
+ showLoadMore: boolean;
51
+ handleLoadMore: import("@storybook/addon-actions").HandlerFunction;
52
+ loadMoreDisabled: boolean;
50
53
  };
51
54
  };
@@ -16,4 +16,7 @@ MyHomesComponent.args = {
16
16
  loading: true,
17
17
  loadingId: '2',
18
18
  handleFilterClick: action('Filter Clicked'),
19
+ showLoadMore: true,
20
+ handleLoadMore: action("Load More Clicked"),
21
+ loadMoreDisabled: false
19
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.9.2",
3
+ "version": "2.9.4",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -113,7 +113,8 @@
113
113
  "share": "Share",
114
114
  "skip": "Skip for now",
115
115
  "saveStep": "Save Step",
116
- "finish": "Finish"
116
+ "finish": "Finish",
117
+ "loadMore": "Load More"
117
118
  },
118
119
  "createDocument": {
119
120
  "tabs": {
@@ -9,6 +9,7 @@ import {
9
9
  Box,
10
10
  Text,
11
11
  DrawerFooter,
12
+ Button
12
13
  } from '@chakra-ui/react'
13
14
  import { Contacts } from '@/assets/images'
14
15
  import {
@@ -42,6 +43,9 @@ export const ContactsContent = ({
42
43
  onClick,
43
44
  onDeleteContacts,
44
45
  onShareContacts,
46
+ showLoadMore,
47
+ handleLoadMore,
48
+ loadMoreDisabled
45
49
  }: ContactsContentI) => {
46
50
  const {
47
51
  contactsWithoutFirstOrLastName,
@@ -155,6 +159,15 @@ export const ContactsContent = ({
155
159
  </Box>
156
160
  </Stack>
157
161
  {children}
162
+ {
163
+ showLoadMore && (
164
+ <Flex justifyContent={'center'} bg="lightBlue.2" p={'1rem'}>
165
+ <Button onClick={handleLoadMore} variant={"primaryFooter"} disabled={loadMoreDisabled}>
166
+ {t('buttons.loadMore')}
167
+ </Button>
168
+ </Flex>
169
+ )
170
+ }
158
171
  </DrawerBody>
159
172
  <DrawerFooter p="0" zIndex="overlay">
160
173
  <FooterDrawer isOpen={!isDisabled}>
@@ -244,6 +244,9 @@ export const HomeBoard = () => {
244
244
  ]}
245
245
  onShareContacts={() => null}
246
246
  onDeleteContacts={() => null}
247
+ handleLoadMore={() => null}
248
+ showLoadMore={false}
249
+ loadMoreDisabled={false}
247
250
  />
248
251
  ),
249
252
  PartnerCatalog: (
@@ -83,6 +83,9 @@ export const Launchpad = () => {
83
83
  addImage={() => null}
84
84
  loading={false}
85
85
  loadingId=""
86
+ handleLoadMore={() => null}
87
+ showLoadMore={false}
88
+ loadMoreDisabled={false}
86
89
  />
87
90
  </Box>
88
91
  <Stack spacing="base">
@@ -1,5 +1,5 @@
1
1
  import { t } from 'i18next'
2
- import { Box, Container, Wrap, WrapItem } from '@chakra-ui/react'
2
+ import { Box, Container, Wrap, WrapItem, Button, Flex } from '@chakra-ui/react'
3
3
  import {
4
4
  MyHomesHeader,
5
5
  MyHomeCard,
@@ -23,6 +23,9 @@ export const MyHomes = ({
23
23
  addImage,
24
24
  loading,
25
25
  loadingId,
26
+ showLoadMore,
27
+ handleLoadMore,
28
+ loadMoreDisabled
26
29
  }: MyHomesI) => {
27
30
  const [showChildren, setShowChildren] = useState(false)
28
31
  const handleHelpClick = () => setShowChildren(!showChildren)
@@ -88,6 +91,15 @@ export const MyHomes = ({
88
91
  )
89
92
  )}
90
93
  </Wrap>
94
+ {
95
+ showLoadMore && (
96
+ <Flex justifyContent={'center'} mt={'2rem'}>
97
+ <Button onClick={handleLoadMore} variant={"primaryFooter"} disabled={loadMoreDisabled}>
98
+ {t('buttons.loadMore')}
99
+ </Button>
100
+ </Flex>
101
+ )
102
+ }
91
103
  </Container>
92
104
  </TileTooltip>
93
105
  )
@@ -14,6 +14,9 @@ export interface ContactsContentI {
14
14
  onClick?: (contact: ContactAndIndexForm) => void
15
15
  onDeleteContacts: (contactsIds: string[]) => void
16
16
  onShareContacts: (contacts: InfoContactCardI[]) => void
17
+ showLoadMore: boolean
18
+ handleLoadMore: () => void
19
+ loadMoreDisabled: boolean
17
20
  }
18
21
 
19
22
  export interface CardOnContactListI {
@@ -15,4 +15,7 @@ export interface MyHomesI {
15
15
  addImage: (img: HomeImageI) => void
16
16
  loading: boolean
17
17
  loadingId: string
18
+ showLoadMore: boolean
19
+ handleLoadMore: () => void
20
+ loadMoreDisabled: boolean
18
21
  }
@@ -4,5 +4,5 @@ export interface TwoFactorDialogI {
4
4
  onClose: () => void
5
5
  onResend?: () => void
6
6
  onReset: (code: string) => void
7
- twoFactorMethod: 'sms' | 'email'
7
+ twoFactorMethod: 'sms' | 'email' | ""
8
8
  }
@@ -3,5 +3,5 @@ export interface TwoFactorI {
3
3
  onReset: (code: string) => void
4
4
  isDialog?: boolean
5
5
  isLoading: boolean
6
- twoFactorMethod: 'sms' | 'email'
6
+ twoFactorMethod: 'sms' | 'email' | ""
7
7
  }
@@ -13,6 +13,7 @@ export default {
13
13
  onClick: action('onClick'),
14
14
  contacts: ContactsMock,
15
15
  menuItems: menuMock,
16
+ showLoadMore: true
16
17
  },
17
18
  } as Meta<ContactsContentI>
18
19
 
@@ -20,4 +20,7 @@ MyHomesComponent.args = {
20
20
  loading: true,
21
21
  loadingId: '2',
22
22
  handleFilterClick: action('Filter Clicked'),
23
+ showLoadMore: true,
24
+ handleLoadMore: action("Load More Clicked"),
25
+ loadMoreDisabled: false
23
26
  }