@homefile/components-v2 2.14.30 → 2.14.32
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/TileBodyFields.js +5 -1
- package/dist/components/forms/dynamicForm/fields/uiFields/TileBodyDescription.d.ts +3 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/TileBodyDescription.js +5 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/TileBodyDescription.tsx +16 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/TileBodyPartnerImage.d.ts +2 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/TileBodyPartnerImage.js +6 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/TileBodyPartnerImage.tsx +11 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/index.d.ts +2 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/index.js +2 -0
- package/dist/components/forms/dynamicForm/fields/uiFields/index.ts +3 -1
- 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/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/dynamicForm/DynamicForm.interface.d.ts +1 -1
- package/dist/mocks/partner/dynamicTileForm.mock.d.ts +2 -0
- package/dist/mocks/partner/dynamicTileForm.mock.js +65 -0
- package/dist/mocks/partner/index.d.ts +1 -0
- package/dist/mocks/partner/index.js +1 -0
- 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/dist/stories/partner/DynamicTile.stories.d.ts +5 -0
- package/dist/stories/partner/DynamicTile.stories.js +26 -0
- package/package.json +1 -1
- package/src/components/appBar/TourButton.tsx +8 -1
- package/src/components/forms/dynamicForm/fields/TileBodyFields.tsx +5 -2
- package/src/components/forms/dynamicForm/fields/uiFields/TileBodyDescription.tsx +16 -0
- package/src/components/forms/dynamicForm/fields/uiFields/TileBodyPartnerImage.tsx +11 -0
- package/src/components/forms/dynamicForm/fields/uiFields/index.ts +3 -1
- 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/useSimpleDynamicForm.ts +1 -1
- package/src/hooks/homeBoard/useHomeBoard.ts +1 -0
- package/src/hooks/useComponentStyles.ts +11 -7
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +2 -0
- package/src/mocks/partner/dynamicTileForm.mock.ts +67 -0
- package/src/mocks/partner/index.ts +1 -0
- package/src/proxies/homes/homeAssistant.proxy.ts +18 -0
- package/src/proxies/homes/index.ts +1 -0
- package/src/stories/partner/DynamicTile.stories.tsx +33 -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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { fieldIcons } from '../../../../helpers';
|
|
3
|
-
import { VerticalIcon, TileBodySectionGrid } from '../../..';
|
|
3
|
+
import { VerticalIcon, TileBodySectionGrid, TileBodyDescription, TileBodyPartnerImage } from '../../..';
|
|
4
4
|
export const TileBodyFields = ({ fields }) => {
|
|
5
5
|
return (_jsx(_Fragment, { children: fields === null || fields === void 0 ? void 0 : fields.map(({ children, id, name, type, value, icon }) => {
|
|
6
6
|
const baseProps = {
|
|
@@ -13,6 +13,10 @@ export const TileBodyFields = ({ fields }) => {
|
|
|
13
13
|
switch (type) {
|
|
14
14
|
case 'tile-body-section-grid':
|
|
15
15
|
return _jsx(TileBodySectionGrid, { fields: children }, id);
|
|
16
|
+
case 'tile-body-description':
|
|
17
|
+
return _jsx(TileBodyDescription, { description: String(baseProps.value) });
|
|
18
|
+
case 'tile-body-partner-image':
|
|
19
|
+
return _jsx(TileBodyPartnerImage, { imageUrl: String(baseProps.value), partnerName: name });
|
|
16
20
|
case 'vertical-icon':
|
|
17
21
|
return (_jsx(VerticalIcon, { icon: baseProps.icon, value: String(baseProps.value) }, id));
|
|
18
22
|
default:
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from '@chakra-ui/react';
|
|
3
|
+
export const TileBodyDescription = ({ description }) => {
|
|
4
|
+
return (_jsx(Box, { px: "base", py: "4", pb: "0", bg: "lightBlue.1", children: _jsx(Text, { fontSize: "sm", fontWeight: "light", lineHeight: "18px", textAlign: "center", children: description }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Box, Text } from '@chakra-ui/react'
|
|
2
|
+
|
|
3
|
+
export const TileBodyDescription = ({description}: {description: string}) => {
|
|
4
|
+
return (
|
|
5
|
+
<Box px="base" py="4" pb="0" bg="lightBlue.1">
|
|
6
|
+
<Text
|
|
7
|
+
fontSize="sm"
|
|
8
|
+
fontWeight="light"
|
|
9
|
+
lineHeight="18px"
|
|
10
|
+
textAlign="center"
|
|
11
|
+
>
|
|
12
|
+
{description}
|
|
13
|
+
</Text>
|
|
14
|
+
</Box>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { PartnerImage } from '../../../..';
|
|
4
|
+
export const TileBodyPartnerImage = ({ imageUrl, partnerName }) => {
|
|
5
|
+
return (_jsx(Box, { h: "240px", children: _jsx(PartnerImage, { imageUrl: imageUrl, partnerName: partnerName }) }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Box, Flex, Stack, Text } from '@chakra-ui/react'
|
|
2
|
+
import { PartnerImage } from '@/components'
|
|
3
|
+
import { PartnerImageI } from '@/interfaces'
|
|
4
|
+
|
|
5
|
+
export const TileBodyPartnerImage = ({ imageUrl, partnerName }: PartnerImageI) => {
|
|
6
|
+
return (
|
|
7
|
+
<Box h="240px">
|
|
8
|
+
<PartnerImage imageUrl={imageUrl} partnerName={partnerName} />
|
|
9
|
+
</Box>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -4,4 +4,6 @@ export * from './TileBodyHeader'
|
|
|
4
4
|
export * from './TileBodyLogo'
|
|
5
5
|
export * from './TileBodySectionGrid'
|
|
6
6
|
export * from './TileCta'
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './TileBodyDescription'
|
|
8
|
+
export * from './TileBodyPartnerImage'
|
|
9
|
+
export * from './VerticalIcon'
|
|
@@ -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
|
+
]));
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIGridFieldI, FolderFileI, MenuItemI, PartnerFooterI, TileCtaI } from '../..';
|
|
2
2
|
export type KindTypes = 'ai-image' | 'ai-grid' | 'checkbox' | 'checkbox-agreement' | 'checkbox-group' | 'currency' | 'date' | 'email' | 'file' | 'grid' | 'group' | 'hidden' | 'notes' | 'number' | 'radio' | 'rating' | 'select' | 'string' | 'switch' | 'telephone' | 'text' | 'textarea' | 'default' | UIKindTypes | HomeItemTypes;
|
|
3
|
-
export type UIKindTypes = 'tile-body' | 'tile-body-logo' | 'tile-body-header' | 'tile-body-section' | 'tile-body-section-grid' | 'tile-form' | 'tile-body-action' | 'vertical-icon' | 'primary-cta' | 'secondary-cta';
|
|
3
|
+
export type UIKindTypes = 'tile-body' | 'tile-body-logo' | 'tile-body-header' | 'tile-body-section' | 'tile-body-section-grid' | 'tile-body-partner-image' | 'tile-body-description' | 'tile-form' | 'tile-body-action' | 'vertical-icon' | 'primary-cta' | 'secondary-cta';
|
|
4
4
|
export type HomeItemTypes = 'appliances' | 'images' | 'guidelines' | 'item-related' | 'item-icon-btn';
|
|
5
5
|
export type IconTypes = 'barcode' | 'battery' | 'billing' | 'book' | 'book-opened' | 'calc' | 'calendar' | 'check' | 'co2' | 'contact' | 'date' | 'default' | 'detector' | 'electricity' | 'goldbars' | 'heart' | 'image' | 'notes' | 'palette' | 'people' | 'price' | 'rating' | 'receipt' | 'registry' | 'sprinkler' | 'tools' | 'wind' | '68' | 'calendar2' | 'water' | 'calendar-drop' | 'umbrella' | 'heater' | 'roof' | 'foundation' | 'solar-panel' | 'pool' | 'drop' | 'mobile-drop' | 'light' | 'plate' | 'pressure-washer' | 'house' | 'target' | 'title' | 'company' | UIIconTypes;
|
|
6
6
|
export type UIIconTypes = 'sh-pressure' | 'sh-window' | 'sh-roof' | 'sh-lights' | 'sh-gutter' | 'sh-home' | 'sh-house';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const dynamicTileFormMock = [
|
|
2
|
+
{
|
|
3
|
+
"id": "stile1p",
|
|
4
|
+
"name": "",
|
|
5
|
+
"description": "",
|
|
6
|
+
"comments": "",
|
|
7
|
+
"value": "",
|
|
8
|
+
"type": "tile-body",
|
|
9
|
+
"visible": true,
|
|
10
|
+
"children": [
|
|
11
|
+
{
|
|
12
|
+
"id": "stilec01",
|
|
13
|
+
"name": "Shine",
|
|
14
|
+
"description": "",
|
|
15
|
+
"comments": "",
|
|
16
|
+
"value": "https://storage.googleapis.com/homefile-images/shine_logo_updated.png",
|
|
17
|
+
"type": "tile-body-logo"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "stilec01test",
|
|
21
|
+
"name": "Partner Name Here",
|
|
22
|
+
"description": "",
|
|
23
|
+
"comments": "",
|
|
24
|
+
"value": "https://storage.googleapis.com/homefile-images/audreybackgroundimage-update.jpg",
|
|
25
|
+
"type": "tile-body-partner-image"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "stilec02test",
|
|
29
|
+
"name": "Shine",
|
|
30
|
+
"description": "",
|
|
31
|
+
"comments": "",
|
|
32
|
+
"value": "Test description will go here. Test.",
|
|
33
|
+
"type": "tile-body-description"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "stile2p",
|
|
37
|
+
"name": "",
|
|
38
|
+
"description": "",
|
|
39
|
+
"comments": "",
|
|
40
|
+
"value": "",
|
|
41
|
+
"type": "tile-body-action",
|
|
42
|
+
"children": [
|
|
43
|
+
{
|
|
44
|
+
"id": "stilecta1",
|
|
45
|
+
"name": "drawer-link",
|
|
46
|
+
"description": "",
|
|
47
|
+
"comments": "",
|
|
48
|
+
"value": "Schedule Service",
|
|
49
|
+
"type": "primary-cta",
|
|
50
|
+
"link": "stiledf01"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "stilecta2",
|
|
54
|
+
"name": "drawer-link",
|
|
55
|
+
"description": "",
|
|
56
|
+
"comments": "",
|
|
57
|
+
"value": "Request Support",
|
|
58
|
+
"type": "secondary-cta",
|
|
59
|
+
"link": "stiledf02"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
];
|