@homefile/components-v2 2.14.29 → 2.14.31
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/appBar/TourButton.js +8 -1
- package/dist/components/forms/dynamicForm/fields/SingleImage.d.ts +2 -2
- package/dist/components/forms/dynamicForm/fields/SingleImage.js +1 -3
- package/dist/components/homeAssistant/HomeAssistantSteps.js +6 -14
- package/dist/components/homeAssistant/HomeMonitorSteps.js +3 -12
- package/dist/components/homeAssistant/panel/HomeAssistantPanel.d.ts +1 -1
- package/dist/components/homeAssistant/panel/HomeAssistantPanel.js +25 -11
- package/dist/components/homeBoard/HomeBoard.js +1 -1
- package/dist/components/tour/BubbleArrow.js +1 -1
- package/dist/components/tour/HomeBoardTour.js +13 -5
- package/dist/components/tour/LaunchpadTour.js +14 -6
- package/dist/components/tour/RoomsBoardTour.js +7 -3
- package/dist/helpers/tour/Highlights.helper.d.ts +1 -0
- package/dist/helpers/tour/Highlights.helper.js +42 -0
- package/dist/helpers/tour/index.d.ts +1 -0
- package/dist/helpers/tour/index.js +1 -0
- package/dist/hooks/forms/useDynamicForm.d.ts +2 -2
- package/dist/hooks/forms/useSimpleDynamicForm.js +1 -1
- package/dist/hooks/homeBoard/useHomeBoard.js +1 -0
- package/dist/hooks/useComponentStyles.d.ts +2 -3
- package/dist/hooks/useComponentStyles.js +7 -3
- package/dist/interfaces/forms/ItemFormPanel/ItemFormTabs.interface.d.ts +1 -1
- package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +1 -1
- package/dist/interfaces/forms/dynamicForm/fields/FileField.interface.d.ts +3 -0
- package/dist/interfaces/forms/dynamicForm/fields/GridField.interface.d.ts +3 -3
- package/dist/proxies/homes/homeAssistant.proxy.d.ts +8 -0
- package/dist/proxies/homes/homeAssistant.proxy.js +9 -0
- package/dist/proxies/homes/index.d.ts +1 -0
- package/dist/proxies/homes/index.js +1 -0
- package/package.json +1 -1
- package/src/components/appBar/TourButton.tsx +8 -1
- package/src/components/forms/dynamicForm/fields/AIGridField.tsx +2 -2
- package/src/components/forms/dynamicForm/fields/SingleImage.tsx +3 -5
- package/src/components/homeAssistant/HomeAssistantSteps.tsx +6 -14
- package/src/components/homeAssistant/HomeMonitorSteps.tsx +4 -12
- package/src/components/homeAssistant/panel/HomeAssistantPanel.tsx +34 -13
- package/src/components/homeBoard/HomeBoard.tsx +15 -13
- package/src/components/tour/BubbleArrow.tsx +4 -0
- package/src/components/tour/HomeBoardTour.tsx +14 -9
- package/src/components/tour/LaunchpadTour.tsx +15 -10
- package/src/components/tour/RoomsBoardTour.tsx +7 -7
- package/src/helpers/tour/Highlights.helper.ts +44 -0
- package/src/helpers/tour/index.ts +2 -1
- package/src/hooks/forms/useDynamicForm.ts +2 -2
- package/src/hooks/forms/useSimpleDynamicForm.ts +1 -1
- package/src/hooks/homeBoard/useHomeBoard.ts +1 -0
- package/src/hooks/useComponentStyles.ts +11 -7
- package/src/interfaces/forms/ItemFormPanel/ItemFormTabs.interface.ts +7 -2
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +1 -1
- package/src/interfaces/forms/dynamicForm/fields/FileField.interface.ts +4 -0
- package/src/interfaces/forms/dynamicForm/fields/GridField.interface.ts +2 -2
- package/src/proxies/homes/homeAssistant.proxy.ts +18 -0
- package/src/proxies/homes/index.ts +1 -0
|
@@ -2,6 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { t } from 'i18next';
|
|
3
3
|
import { Box, Flex, Image } from '@chakra-ui/react';
|
|
4
4
|
import { Flag } from '../../assets/images';
|
|
5
|
+
import { useComponentStyles } from '../../hooks';
|
|
6
|
+
import { homeAssistantProxy } from '../../proxies';
|
|
5
7
|
export const TourButton = ({ label, onClick }) => {
|
|
6
|
-
|
|
8
|
+
const { setHighlight } = homeAssistantProxy;
|
|
9
|
+
useComponentStyles({});
|
|
10
|
+
return (_jsx(Box, { "data-testid": "tour-button", as: "button", boxShadow: "none", borderRadius: "full", bg: "lightGreen.5", fontFamily: "secondary", transition: "all 0.2s ease-in-out", _hover: { bg: 'lightGreen.4' }, onClick: () => {
|
|
11
|
+
setHighlight(true);
|
|
12
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
13
|
+
}, flexShrink: 0, overflow: "hidden", children: _jsxs(Flex, { align: "center", pr: "base", py: "1", children: [_jsx(Image, { src: Flag, w: "40px", h: "auto", alt: "tour", position: "relative", bottom: "-4px" }), label !== null && label !== void 0 ? label : t('help.buttonTour')] }) }));
|
|
7
14
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const SingleImage: ({ onRemove, onUpload, uploading, value, }:
|
|
1
|
+
import { SingleImageI } from '../../../../interfaces';
|
|
2
|
+
export declare const SingleImage: ({ onRemove, onUpload, uploading, value, }: SingleImageI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,15 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { AspectRatio, Box, Flex, IconButton, Image } from '@chakra-ui/react';
|
|
3
3
|
import { colors } from '../../../../theme/colors';
|
|
4
4
|
import { Close, MobileFileUploader } from '../../..';
|
|
5
|
-
import { handleMapFile } from '../../../../utils';
|
|
6
5
|
export const SingleImage = ({ onRemove, onUpload, uploading = false, value, }) => {
|
|
7
6
|
const handleInputChange = (event) => {
|
|
8
7
|
var _a;
|
|
9
8
|
const fileList = (_a = event.target.files) !== null && _a !== void 0 ? _a : [];
|
|
10
9
|
const files = Array.from(fileList);
|
|
11
10
|
if (files.length > 0) {
|
|
12
|
-
|
|
13
|
-
onUpload === null || onUpload === void 0 ? void 0 : onUpload(selectedFiles);
|
|
11
|
+
onUpload === null || onUpload === void 0 ? void 0 : onUpload(files);
|
|
14
12
|
}
|
|
15
13
|
};
|
|
16
14
|
return (_jsxs(Flex, { gap: "2", align: "center", h: "input.md", children: [_jsx(MobileFileUploader, { handleInputChange: handleInputChange, "aria-label": "upload image", minW: "72px" }), value && (_jsxs(Box, { position: "relative", minW: "30px", children: [_jsx(IconButton, { variant: "ghost", "aria-label": "close", maxW: "fit-content", onClick: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(value), icon: _jsx(Close, { size: 11, stroke: colors.error['2'] }), disabled: uploading, position: "absolute", bg: "neutral.white", p: "0.5", borderRadius: "full", top: "-2", right: "-2", zIndex: "1" }), _jsx(AspectRatio, { maxW: "100%", ratio: 1, children: _jsx(Image, { src: value, objectFit: "cover", alt: "image" }) })] }))] }));
|
|
@@ -2,21 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Center, SimpleGrid, Stack } from '@chakra-ui/react';
|
|
3
3
|
import { HomeAssistantButton, HomeAssistantStepper } from '..';
|
|
4
4
|
import { homeAssistantSteps } from '../../helpers';
|
|
5
|
-
import {
|
|
5
|
+
import { homeAssistantProxy } from '../../proxies';
|
|
6
6
|
export const HomeAssistantSteps = ({ currentStep, onStepClick, currentPanel, }) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'homeAssistantButton-3',
|
|
13
|
-
'homeAssistantButton-4',
|
|
14
|
-
'homeAssistantButton-5',
|
|
15
|
-
'homeAssistantButton-6',
|
|
16
|
-
]
|
|
17
|
-
: [];
|
|
18
|
-
useComponentStyles({ ids: componentIds, selectedId: stepId, zIndex: '2' });
|
|
19
|
-
return (_jsxs(Stack, { spacing: "8", w: "fit-content", position: "relative", top: ['-10px', '-30px'], children: [_jsx(HomeAssistantStepper, { currentStep: currentStep, totalSteps: 6 }), _jsx(SimpleGrid, { columns: [2, 3], spacing: "base", children: homeAssistantSteps.map((step, index) => (_jsx(Center, { w: "100%", children: _jsx(HomeAssistantButton, { currentStep: index + 1, onStepClick: onStepClick, status: getStatus(index + 1, currentStep), step: step }) }, step.title))) })] }));
|
|
7
|
+
const { setSelectedId } = homeAssistantProxy;
|
|
8
|
+
return (_jsxs(Stack, { spacing: "8", w: "fit-content", position: "relative", top: ['-10px', '-30px'], children: [_jsx(HomeAssistantStepper, { currentStep: currentStep, totalSteps: 6 }), _jsx(SimpleGrid, { columns: [2, 3], spacing: "base", children: homeAssistantSteps.map((step, index) => (_jsx(Center, { w: "100%", children: _jsx(HomeAssistantButton, { currentStep: index + 1, onStepClick: (step) => {
|
|
9
|
+
onStepClick(step);
|
|
10
|
+
setSelectedId(`homeAssistantButton-${index + 1}`);
|
|
11
|
+
}, status: getStatus(index + 1, currentStep), step: step }) }, step.title))) })] }));
|
|
20
12
|
};
|
|
21
13
|
const getStatus = (index, currentStep) => {
|
|
22
14
|
if (index === currentStep)
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
2
3
|
import { Box, Flex } from '@chakra-ui/react';
|
|
3
4
|
import { HomeMonitorButton, IconMenu, MoreHorizontal } from '..';
|
|
4
5
|
import { homeAssistantSteps } from '../../helpers';
|
|
5
|
-
import {
|
|
6
|
-
import { Fragment, useState } from 'react';
|
|
6
|
+
import { homeAssistantProxy } from '../../proxies';
|
|
7
7
|
export const HomeMonitorSteps = ({ menuItems = [], onStepClick, stepsWithAlerts, }) => {
|
|
8
|
-
const
|
|
9
|
-
'homeMonitorButton-1',
|
|
10
|
-
'homeMonitorButton-2',
|
|
11
|
-
'homeMonitorButton-3',
|
|
12
|
-
'homeMonitorButton-4',
|
|
13
|
-
'homeMonitorButton-5',
|
|
14
|
-
'homeMonitorButton-6',
|
|
15
|
-
];
|
|
16
|
-
const [selectedId, setSelectedId] = useState('');
|
|
8
|
+
const { setSelectedId } = homeAssistantProxy;
|
|
17
9
|
const isDisabled = menuItems.length === 0;
|
|
18
|
-
useComponentStyles({ ids, selectedId, zIndex: '2' });
|
|
19
10
|
const handleStepClick = (step) => onStepClick(step);
|
|
20
11
|
return (_jsx(Flex, { gap: "base", justify: "center", children: homeAssistantSteps.map((step, index) => (_jsx(Box, { position: "relative", flex: "1", children: _jsxs(Fragment, { children: [_jsx(HomeMonitorButton, { currentStep: index + 1, onStepClick: handleStepClick, status: getStatus(index + 1, stepsWithAlerts), step: step }), _jsx(Box, { position: "absolute", top: "-2px", right: "4px", zIndex: "1400", children: _jsx(IconMenu, { zIndex: "2", icon: _jsx(MoreHorizontal, { size: 26 }), itemForm: index + 1, menuItems: menuItems, disabled: isDisabled, onClick: () => setSelectedId(`homeMonitorButton-${index + 1}`) }) })] }) }, step === null || step === void 0 ? void 0 : step.title))) }));
|
|
21
12
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { HomeAssistantPanelI } from '../../../interfaces';
|
|
3
|
-
export declare const HomeAssistantPanel: ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading }: PropsWithChildren<HomeAssistantPanelI>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const HomeAssistantPanel: ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading, }: PropsWithChildren<HomeAssistantPanelI>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,17 +4,20 @@ import { FormProvider } from 'react-hook-form';
|
|
|
4
4
|
import { t } from 'i18next';
|
|
5
5
|
import { DrawerHeader, DrawerBody, Stack, Text, DrawerFooter, } from '@chakra-ui/react';
|
|
6
6
|
import { IA } from '../../../assets/images';
|
|
7
|
-
import { ApplianceSteps, SimpleDynamicForm, FooterButtons, HomeAssistantPanelStep, PanelHeader, Loading } from '../..';
|
|
7
|
+
import { ApplianceSteps, SimpleDynamicForm, FooterButtons, HomeAssistantPanelStep, PanelHeader, Loading, } from '../..';
|
|
8
8
|
import { homeAssistantSteps } from '../../../helpers';
|
|
9
9
|
import { useSimpleDynamicForm } from '../../../hooks';
|
|
10
|
-
|
|
10
|
+
import { homeAssistantProxy } from '../../../proxies';
|
|
11
|
+
export const HomeAssistantPanel = ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading, }) => {
|
|
11
12
|
var _a, _b;
|
|
12
13
|
const [addedAppliances, updateAddedAppliances] = useState([]);
|
|
13
|
-
const title = (_b = (_a = homeAssistantSteps === null || homeAssistantSteps === void 0 ? void 0 : homeAssistantSteps[currentStep - 1]) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b :
|
|
14
|
+
const title = (_b = (_a = homeAssistantSteps === null || homeAssistantSteps === void 0 ? void 0 : homeAssistantSteps[currentStep - 1]) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
|
|
14
15
|
const text = `${t('homeAssistant.details')} ${title.toLowerCase()}:`;
|
|
15
16
|
const isAppliances = currentStep === 4;
|
|
17
|
+
const { setHighlight } = homeAssistantProxy;
|
|
16
18
|
useEffect(() => {
|
|
17
19
|
var _a;
|
|
20
|
+
setHighlight(true);
|
|
18
21
|
if (isAppliances) {
|
|
19
22
|
const targetAppliances = (_a = currentForm.find((field) => {
|
|
20
23
|
var _a;
|
|
@@ -23,25 +26,36 @@ export const HomeAssistantPanel = ({ children, currentForm, currentStep, onAppli
|
|
|
23
26
|
})) === null || _a === void 0 ? void 0 : _a.value;
|
|
24
27
|
updateAddedAppliances(targetAppliances);
|
|
25
28
|
}
|
|
29
|
+
return () => {
|
|
30
|
+
setHighlight(false);
|
|
31
|
+
};
|
|
26
32
|
}, [currentForm, isAppliances]);
|
|
27
33
|
const { form, updatedFields } = useSimpleDynamicForm({
|
|
28
34
|
fields: currentForm,
|
|
29
35
|
});
|
|
36
|
+
const handleClose = () => {
|
|
37
|
+
onClose();
|
|
38
|
+
setHighlight(false);
|
|
39
|
+
};
|
|
30
40
|
if (isLoading)
|
|
31
41
|
return _jsx(Loading, {});
|
|
32
|
-
return (_jsxs(_Fragment, { children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton:
|
|
42
|
+
return (_jsxs(_Fragment, { children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, title: t('homeAssistant.title'), icon: IA }) }), _jsxs(DrawerBody, { p: "0", children: [_jsx(HomeAssistantPanelStep, { currentStep: currentStep }), children, isAppliances && (_jsx(ApplianceSteps, { onClick: onApplianceClick, addedAppliances: addedAppliances })), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "sm", children: text }), _jsx(FormProvider, Object.assign({}, form, { children: _jsx(SimpleDynamicForm, { fields: currentForm }) }))] })] }), _jsx(DrawerFooter, { px: "0", py: "6", bg: "neutral.white", children: _jsx(FooterButtons, { button1: {
|
|
33
43
|
buttonStyle: 'secondaryFooter',
|
|
34
44
|
label: t('buttons.back'),
|
|
35
45
|
onClick: onBack,
|
|
36
46
|
isDisabled: backDisabled,
|
|
37
47
|
}, button2: {
|
|
38
48
|
buttonStyle: 'primaryFooter',
|
|
39
|
-
label: !hasCompleted && currentStep === 6
|
|
49
|
+
label: !hasCompleted && currentStep === 6
|
|
50
|
+
? t('buttons.finish')
|
|
51
|
+
: t('buttons.saveStep'),
|
|
40
52
|
onClick: () => onSave(updatedFields),
|
|
41
|
-
}, button3:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
}, button3: !hasCompleted && currentStep === 6
|
|
54
|
+
? undefined
|
|
55
|
+
: {
|
|
56
|
+
buttonStyle: 'primaryFooter',
|
|
57
|
+
label: t('buttons.next'),
|
|
58
|
+
onClick: onNext,
|
|
59
|
+
isDisabled: nextDisabled,
|
|
60
|
+
} }) })] }));
|
|
47
61
|
};
|
|
@@ -48,7 +48,7 @@ export const HomeBoard = () => {
|
|
|
48
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
|
-
HomeAssistant: (_jsx(HomeAssistantPanel, { currentStep: homeAssistantCurrentStep, currentForm: currentHomeAssistantForm, onNext: handleHomeAssistantFormChange, onBack: handleHomeAssistantBack, onApplianceClick: () => null, onClose: onRightClose, onSave: () => { }, backDisabled: false, nextDisabled: false, hasCompleted: true, isLoading: false })),
|
|
51
|
+
HomeAssistant: (_jsx(DrawerContent, { children: _jsx(HomeAssistantPanel, { currentStep: homeAssistantCurrentStep, currentForm: currentHomeAssistantForm, onNext: handleHomeAssistantFormChange, onBack: handleHomeAssistantBack, onApplianceClick: () => null, onClose: onRightClose, onSave: () => { }, backDisabled: false, nextDisabled: false, hasCompleted: true, isLoading: false }) })),
|
|
52
52
|
Notifications: (_jsx(NotificationsPanel, { notifications: notificationsMock, onClose: onRightClose, onDismiss: () => null })),
|
|
53
53
|
};
|
|
54
54
|
const panelSize = currentComponent === 'PartnerCatalog' ? 'lg' : 'md';
|
|
@@ -8,5 +8,5 @@ export const BubbleArrow = ({ arrowBottom = undefined, arrowLeft = undefined, ar
|
|
|
8
8
|
const { posX: posXLeft, posY: posYLeft, rotation: rotationLeft, } = ArrowLocationMap[arrowLeft !== null && arrowLeft !== void 0 ? arrowLeft : 'left'];
|
|
9
9
|
const { posX: posXRight, posY: posYRight, rotation: rotationRight, } = ArrowLocationMap[arrowRight !== null && arrowRight !== void 0 ? arrowRight : 'right'];
|
|
10
10
|
const { posX: posXTop, posY: posYTop, rotation: rotationTop, } = ArrowLocationMap[arrowTop !== null && arrowTop !== void 0 ? arrowTop : 'top'];
|
|
11
|
-
return (_jsxs(_Fragment, { children: [arrowBottom && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXBottom, top: posYBottom, transform: `rotate(${rotationBottom}deg)
|
|
11
|
+
return (_jsxs(_Fragment, { children: [arrowBottom && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXBottom, top: posYBottom, transform: `rotate(${rotationBottom}deg)`, filter: "brightness(1.6) saturate(200%)" })), arrowLeft && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXLeft, top: posYLeft, transform: `rotate(${rotationLeft}deg)`, filter: "brightness(1.6) saturate(200%)" })), arrowRight && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXRight, top: posYRight, transform: `rotate(${rotationRight}deg)`, filter: "brightness(1.6) saturate(200%)" })), arrowTop && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXTop, top: posYTop, transform: `rotate(${rotationTop}deg)`, filter: "brightness(1.6) saturate(200%)" }))] }));
|
|
12
12
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { t } from 'i18next';
|
|
4
4
|
import { Bubble, BubbleText, MeetStep } from '..';
|
|
5
|
-
import { useComponentCoordinates,
|
|
5
|
+
import { useComponentCoordinates, useWindowDimensions } from '../../hooks';
|
|
6
6
|
import { appBarHeight, arrowSize, distanceFromEdgeArrowToBorder, firstBubbleHeight, firstBubbleWidth, getDistanceFromArrow, getMiddleAnchorPosition, getXPosition, getYPosition, } from '../../utils';
|
|
7
|
+
import { homeAssistantProxy } from '../../proxies';
|
|
7
8
|
export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px', handleClose, handleStep, meetStepUrl, isActive = false, }) => {
|
|
8
9
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
9
10
|
const [counter, setCounter] = useState(0);
|
|
@@ -22,12 +23,19 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
|
|
|
22
23
|
'addCatalog',
|
|
23
24
|
];
|
|
24
25
|
const { coordinates } = useComponentCoordinates(componentIds);
|
|
25
|
-
|
|
26
|
+
const { setSelectedId, setHighlight } = homeAssistantProxy;
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setSelectedId(currentStep);
|
|
29
|
+
}, [currentStep]);
|
|
26
30
|
const { windowDimensions: { width, height }, } = useWindowDimensions();
|
|
27
31
|
const parsedBubbleWidth = Number(bubbleWidth.replace('px', ''));
|
|
28
32
|
const panelBubbleArrowSize = 500 + parsedBubbleWidth + arrowSize;
|
|
29
33
|
const halfBubbleWidth = parsedBubbleWidth / 2;
|
|
30
34
|
const bubbleArrowWidth = parsedBubbleWidth + arrowSize + 10;
|
|
35
|
+
const handleCloseAndHighlight = () => {
|
|
36
|
+
handleClose();
|
|
37
|
+
setHighlight(false);
|
|
38
|
+
};
|
|
31
39
|
const steps = {
|
|
32
40
|
homeboard: {
|
|
33
41
|
arrowBottom: 'bottom',
|
|
@@ -38,7 +46,7 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
|
|
|
38
46
|
topRef: getMiddleAnchorPosition(height, firstBubbleHeight),
|
|
39
47
|
hideFooter: true,
|
|
40
48
|
hideHeader: true,
|
|
41
|
-
component: (_jsx(MeetStep, { description: t('tour.steps.meet.homeboardDescription'), nextButtonLabel: t('tour.steps.meet.homeboardLabel'), onClick: () => setCounter(counter + 1), onSkip:
|
|
49
|
+
component: (_jsx(MeetStep, { description: t('tour.steps.meet.homeboardDescription'), nextButtonLabel: t('tour.steps.meet.homeboardLabel'), onClick: () => setCounter(counter + 1), onSkip: handleCloseAndHighlight, title: t('tour.steps.meet.homeboardTitle'), tutorialUrl: meetStepUrl })),
|
|
42
50
|
},
|
|
43
51
|
// Reference component id -> HomeBoard/HomeCard
|
|
44
52
|
editHomeIcon: {
|
|
@@ -154,5 +162,5 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
|
|
|
154
162
|
};
|
|
155
163
|
if (!isActive)
|
|
156
164
|
return null;
|
|
157
|
-
return (_jsx(Bubble, { counter: counter, handleClose:
|
|
165
|
+
return (_jsx(Bubble, { counter: counter, handleClose: handleCloseAndHighlight, handleStep: handleStep, setCounter: setCounter, steps: steps }));
|
|
158
166
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { t } from 'i18next';
|
|
4
4
|
import { Bubble, BubbleText, HelpIconStep, MeetStep } from '..';
|
|
5
|
-
import { useComponentCoordinates,
|
|
5
|
+
import { useComponentCoordinates, useWindowDimensions } from '../../hooks';
|
|
6
6
|
import { appBarHeight, getDistanceFromArrow, getMiddleAnchorPosition, getXPosition, getYPosition, firstBubbleHeight, firstBubbleWidth, } from '../../utils';
|
|
7
|
+
import { homeAssistantProxy } from '../../proxies';
|
|
7
8
|
export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClose, meetStepUrl, isActive = false, }) => {
|
|
8
9
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
9
10
|
const [counter, setCounter] = useState(0);
|
|
@@ -20,9 +21,16 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
|
|
|
20
21
|
'forwardReceipts',
|
|
21
22
|
];
|
|
22
23
|
const { coordinates } = useComponentCoordinates(componentIds);
|
|
23
|
-
|
|
24
|
+
const { setSelectedId, setHighlight } = homeAssistantProxy;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setSelectedId(currentStep);
|
|
27
|
+
}, [currentStep]);
|
|
24
28
|
const { windowDimensions: { width, height }, } = useWindowDimensions();
|
|
25
29
|
const cardSize = 220;
|
|
30
|
+
const handleCloseAndHighlight = () => {
|
|
31
|
+
handleClose();
|
|
32
|
+
setHighlight(false);
|
|
33
|
+
};
|
|
26
34
|
const steps = {
|
|
27
35
|
launchpad: {
|
|
28
36
|
arrowBottom: 'bottom',
|
|
@@ -33,7 +41,7 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
|
|
|
33
41
|
topRef: getMiddleAnchorPosition(height, firstBubbleHeight),
|
|
34
42
|
hideFooter: true,
|
|
35
43
|
hideHeader: true,
|
|
36
|
-
component: (_jsx(MeetStep, { description: t('tour.steps.meet.launchpadDescription'), nextButtonLabel: t('tour.steps.meet.launchpadLabel'), onClick: () => setCounter(counter + 1), onSkip:
|
|
44
|
+
component: (_jsx(MeetStep, { description: t('tour.steps.meet.launchpadDescription'), nextButtonLabel: t('tour.steps.meet.launchpadLabel'), onClick: () => setCounter(counter + 1), onSkip: handleCloseAndHighlight, title: t('tour.steps.meet.launchpadTitle'), tutorialUrl: meetStepUrl })),
|
|
37
45
|
},
|
|
38
46
|
// Reference component id -> myHomes/headers/MyHomesHeader
|
|
39
47
|
addHomeButton: {
|
|
@@ -103,12 +111,12 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
|
|
|
103
111
|
leftRef: ((_s = coordinates.feedback) === null || _s === void 0 ? void 0 : _s.x) - 225,
|
|
104
112
|
topRef: ((_t = coordinates.feedback) === null || _t === void 0 ? void 0 : _t.y) + appBarHeight,
|
|
105
113
|
component: (_jsx(HelpIconStep, { handleClose: () => {
|
|
106
|
-
|
|
114
|
+
handleCloseAndHighlight();
|
|
107
115
|
setCounter(0);
|
|
108
116
|
} })),
|
|
109
117
|
},
|
|
110
118
|
};
|
|
111
119
|
if (!isActive)
|
|
112
120
|
return null;
|
|
113
|
-
return (_jsx(Bubble, { counter: counter, handleClose:
|
|
121
|
+
return (_jsx(Bubble, { counter: counter, handleClose: handleCloseAndHighlight, handleStep: handleStep, setCounter: setCounter, steps: steps }));
|
|
114
122
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { t } from 'i18next';
|
|
4
4
|
import { Bubble, BubbleText, MeetStep } from '..';
|
|
5
|
-
import { useComponentCoordinates,
|
|
5
|
+
import { useComponentCoordinates, useWindowDimensions } from '../../hooks';
|
|
6
6
|
import { getMiddleAnchorPosition, firstBubbleWidth, firstBubbleHeight, } from '../../utils';
|
|
7
|
+
import { homeAssistantProxy } from '../../proxies';
|
|
7
8
|
export const RoomsBoardTour = ({ currentStep = 'addRooms', handleClose, handleStep, meetStepUrl, isActive = false, }) => {
|
|
8
9
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9
10
|
const [counter, setCounter] = useState(0);
|
|
@@ -16,7 +17,10 @@ export const RoomsBoardTour = ({ currentStep = 'addRooms', handleClose, handleSt
|
|
|
16
17
|
'addingItems',
|
|
17
18
|
];
|
|
18
19
|
const { coordinates } = useComponentCoordinates(componentIds);
|
|
19
|
-
|
|
20
|
+
const { setSelectedId } = homeAssistantProxy;
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setSelectedId(currentStep);
|
|
23
|
+
}, [currentStep]);
|
|
20
24
|
const { windowDimensions: { width, height }, } = useWindowDimensions();
|
|
21
25
|
const steps = {
|
|
22
26
|
addRooms: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const highlightIds: string[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const highlightIds = Array.from(new Set([
|
|
2
|
+
'customizeRoomName',
|
|
3
|
+
'trackRoomValue',
|
|
4
|
+
'organizeByGroup',
|
|
5
|
+
'trackGroupValue',
|
|
6
|
+
'addItemToGroup',
|
|
7
|
+
'addingItems',
|
|
8
|
+
'addHomeButton',
|
|
9
|
+
'assignReceipts',
|
|
10
|
+
'homeCard',
|
|
11
|
+
'feedback',
|
|
12
|
+
'trackStorage',
|
|
13
|
+
'role',
|
|
14
|
+
'homePicture',
|
|
15
|
+
'removeHome',
|
|
16
|
+
'viewHome',
|
|
17
|
+
'forwardReceipts',
|
|
18
|
+
'backToLaunchpad',
|
|
19
|
+
'editHomeIcon',
|
|
20
|
+
'addFolders',
|
|
21
|
+
'folder',
|
|
22
|
+
'shareWithOthers',
|
|
23
|
+
'viewContacts',
|
|
24
|
+
'feedback',
|
|
25
|
+
'storageUsed',
|
|
26
|
+
'profile',
|
|
27
|
+
'forwardReceipts',
|
|
28
|
+
'viewReceipts',
|
|
29
|
+
'addCatalog',
|
|
30
|
+
'homeAssistantButton-1',
|
|
31
|
+
'homeAssistantButton-2',
|
|
32
|
+
'homeAssistantButton-3',
|
|
33
|
+
'homeAssistantButton-4',
|
|
34
|
+
'homeAssistantButton-5',
|
|
35
|
+
'homeAssistantButton-6',
|
|
36
|
+
'homeMonitorButton-1',
|
|
37
|
+
'homeMonitorButton-2',
|
|
38
|
+
'homeMonitorButton-3',
|
|
39
|
+
'homeMonitorButton-4',
|
|
40
|
+
'homeMonitorButton-5',
|
|
41
|
+
'homeMonitorButton-6',
|
|
42
|
+
]));
|
|
@@ -2,11 +2,11 @@ import { FieldValues } from 'react-hook-form';
|
|
|
2
2
|
import { FolderFileI, ReportI } from '../../interfaces';
|
|
3
3
|
interface FilesUploadI {
|
|
4
4
|
id: string;
|
|
5
|
-
files: FolderFileI[];
|
|
5
|
+
files: FolderFileI[] | File[];
|
|
6
6
|
}
|
|
7
7
|
interface UseDynamicFormI {
|
|
8
8
|
fields: ReportI[];
|
|
9
|
-
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void;
|
|
9
|
+
onUpload?: (filesByFieldId: Record<string, FolderFileI[] | File[]>) => void;
|
|
10
10
|
}
|
|
11
11
|
export declare const useDynamicForm: ({ fields, onUpload }: UseDynamicFormI) => {
|
|
12
12
|
form: import("react-hook-form").UseFormReturn<FieldValues, any, undefined>;
|
|
@@ -17,7 +17,7 @@ export const useSimpleDynamicForm = ({ fields }) => {
|
|
|
17
17
|
const parsedValue = isCurrency ? parseCurrenyValue(value) : value;
|
|
18
18
|
return Object.assign(Object.assign({}, field), { value: parsedValue, children: (_a = field === null || field === void 0 ? void 0 : field.children) === null || _a === void 0 ? void 0 : _a.map((child) => handleUpdateFields(child, fieldValues)) });
|
|
19
19
|
};
|
|
20
|
-
const updatedFields = fields.map((field) => {
|
|
20
|
+
const updatedFields = fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
21
21
|
return handleUpdateFields(field, fieldValues);
|
|
22
22
|
});
|
|
23
23
|
const handleSetDefaultValues = (fields) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface UseComponentStyles {
|
|
2
|
-
ids
|
|
3
|
-
selectedId: string;
|
|
2
|
+
ids?: string[];
|
|
4
3
|
zIndex?: string;
|
|
5
4
|
}
|
|
6
|
-
export declare const useComponentStyles: ({ ids,
|
|
5
|
+
export declare const useComponentStyles: ({ ids, zIndex, }: UseComponentStyles) => void;
|
|
7
6
|
export {};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { highlightIds } from '../helpers/tour';
|
|
2
|
+
import { homeAssistantProxy } from '../proxies';
|
|
3
|
+
import { useSnapshot } from 'valtio';
|
|
4
|
+
export const useComponentStyles = ({ ids = highlightIds, zIndex = '2', }) => {
|
|
5
|
+
const { highlight, selectedId } = useSnapshot(homeAssistantProxy);
|
|
6
|
+
if ((ids === null || ids === void 0 ? void 0 : ids.length) === 0 || !selectedId)
|
|
3
7
|
return;
|
|
4
8
|
ids.forEach((id) => {
|
|
5
9
|
const component = document.getElementById(id);
|
|
@@ -8,7 +12,7 @@ export const useComponentStyles = ({ ids, selectedId, zIndex = 'auto', }) => {
|
|
|
8
12
|
}
|
|
9
13
|
});
|
|
10
14
|
const currentComponent = document.getElementById(selectedId);
|
|
11
|
-
if (currentComponent) {
|
|
15
|
+
if (currentComponent && highlight) {
|
|
12
16
|
currentComponent.style.zIndex = '1400';
|
|
13
17
|
}
|
|
14
18
|
};
|
|
@@ -3,5 +3,5 @@ export interface ItemFormTabsI extends ItemFormTabImageI {
|
|
|
3
3
|
form?: ReportI[];
|
|
4
4
|
onAISend?: AIGridFieldI['onAISend'];
|
|
5
5
|
searching?: boolean;
|
|
6
|
-
formUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void;
|
|
6
|
+
formUpload?: (filesByFieldId: Record<string, FolderFileI[] | File[]>) => void;
|
|
7
7
|
}
|
|
@@ -28,7 +28,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
|
|
|
28
28
|
menuItems?: MenuItemI[];
|
|
29
29
|
onAISend?: AIGridFieldI['onAISend'];
|
|
30
30
|
onRemoveImage?: (file: string) => void;
|
|
31
|
-
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void;
|
|
31
|
+
onUpload?: (filesByFieldId: Record<string, FolderFileI[] | File[]>) => void;
|
|
32
32
|
searching?: boolean;
|
|
33
33
|
showTitle?: boolean;
|
|
34
34
|
title?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReportI } from '../../..';
|
|
2
2
|
export interface GridFieldI {
|
|
3
3
|
children: ReportI['children'];
|
|
4
4
|
onRemove?: (file: string) => void;
|
|
5
|
-
onUpload?: (files:
|
|
5
|
+
onUpload?: (files: File[]) => void;
|
|
6
6
|
}
|
|
7
7
|
export interface AIGridFieldI extends GridFieldI {
|
|
8
8
|
onAISend?: (form?: AIFormI) => void;
|
|
9
9
|
}
|
|
10
10
|
export interface AIFormI {
|
|
11
11
|
model?: string;
|
|
12
|
-
file?:
|
|
12
|
+
file?: File;
|
|
13
13
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { proxy } from 'valtio';
|
|
2
|
+
export const homeAssistantProxy = proxy({
|
|
3
|
+
highlight: false,
|
|
4
|
+
selectedId: '',
|
|
5
|
+
setHighlight: (highlight) => {
|
|
6
|
+
homeAssistantProxy.highlight = highlight;
|
|
7
|
+
},
|
|
8
|
+
setSelectedId: (selectedId) => (homeAssistantProxy.selectedId = selectedId),
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -2,8 +2,12 @@ import { t } from 'i18next'
|
|
|
2
2
|
import { Box, Flex, Image } from '@chakra-ui/react'
|
|
3
3
|
import { TourButtonI } from '@/interfaces'
|
|
4
4
|
import { Flag } from '@/assets/images'
|
|
5
|
+
import { useComponentStyles } from '@/hooks'
|
|
6
|
+
import { homeAssistantProxy } from '@/proxies'
|
|
5
7
|
|
|
6
8
|
export const TourButton = ({ label, onClick }: TourButtonI) => {
|
|
9
|
+
const { setHighlight } = homeAssistantProxy
|
|
10
|
+
useComponentStyles({})
|
|
7
11
|
return (
|
|
8
12
|
<Box
|
|
9
13
|
data-testid="tour-button"
|
|
@@ -14,7 +18,10 @@ export const TourButton = ({ label, onClick }: TourButtonI) => {
|
|
|
14
18
|
fontFamily="secondary"
|
|
15
19
|
transition="all 0.2s ease-in-out"
|
|
16
20
|
_hover={{ bg: 'lightGreen.4' }}
|
|
17
|
-
onClick={
|
|
21
|
+
onClick={() => {
|
|
22
|
+
setHighlight(true)
|
|
23
|
+
onClick?.()
|
|
24
|
+
}}
|
|
18
25
|
flexShrink={0}
|
|
19
26
|
overflow="hidden"
|
|
20
27
|
>
|
|
@@ -12,7 +12,7 @@ export const AIGridField = ({
|
|
|
12
12
|
onRemove,
|
|
13
13
|
onUpload,
|
|
14
14
|
}: AIGridFieldI) => {
|
|
15
|
-
const [file, setFile] = useState<
|
|
15
|
+
const [file, setFile] = useState<File | undefined>(undefined)
|
|
16
16
|
const { watch } = useFormContext()
|
|
17
17
|
|
|
18
18
|
const textChild = children?.find(
|
|
@@ -43,7 +43,7 @@ export const AIGridField = ({
|
|
|
43
43
|
|
|
44
44
|
const model = watch(String(textChild?.id))
|
|
45
45
|
|
|
46
|
-
const handleUpload = (files:
|
|
46
|
+
const handleUpload = (files: File[]) => {
|
|
47
47
|
const file = files[0]
|
|
48
48
|
setFile(file)
|
|
49
49
|
onUpload?.(files)
|
|
@@ -2,21 +2,19 @@ import { ChangeEvent } from 'react'
|
|
|
2
2
|
import { AspectRatio, Box, Flex, IconButton, Image } from '@chakra-ui/react'
|
|
3
3
|
import { colors } from '@/theme/colors'
|
|
4
4
|
import { Close, MobileFileUploader } from '@/components'
|
|
5
|
-
import {
|
|
6
|
-
import { handleMapFile } from '@/utils'
|
|
5
|
+
import { SingleImageI } from '@/interfaces'
|
|
7
6
|
|
|
8
7
|
export const SingleImage = ({
|
|
9
8
|
onRemove,
|
|
10
9
|
onUpload,
|
|
11
10
|
uploading = false,
|
|
12
11
|
value,
|
|
13
|
-
}:
|
|
12
|
+
}: SingleImageI) => {
|
|
14
13
|
const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
15
14
|
const fileList = event.target.files ?? []
|
|
16
15
|
const files = Array.from(fileList)
|
|
17
16
|
if (files.length > 0) {
|
|
18
|
-
|
|
19
|
-
onUpload?.(selectedFiles)
|
|
17
|
+
onUpload?.(files)
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
|