@homefile/components-v2 2.31.1 → 2.32.0

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 (33) hide show
  1. package/dist/components/homeAssistant/HomeAssistantButton.js +2 -2
  2. package/dist/components/homeAssistant/HomeAssistantSteps.js +1 -7
  3. package/dist/components/homeAssistant/index.d.ts +1 -0
  4. package/dist/components/homeAssistant/index.js +1 -0
  5. package/dist/components/homeAssistant/wizard/HomeAssistantWizardButton.d.ts +2 -0
  6. package/dist/components/homeAssistant/wizard/HomeAssistantWizardButton.js +29 -0
  7. package/dist/components/homeAssistant/wizard/HomeAssistantWizardSteps.d.ts +2 -0
  8. package/dist/components/homeAssistant/wizard/HomeAssistantWizardSteps.js +8 -0
  9. package/dist/components/homeAssistant/wizard/index.d.ts +2 -0
  10. package/dist/components/homeAssistant/wizard/index.js +2 -0
  11. package/dist/components/wizard/WizardTextBody.d.ts +2 -0
  12. package/dist/components/wizard/WizardTextBody.js +5 -0
  13. package/dist/components/wizard/index.d.ts +1 -0
  14. package/dist/components/wizard/index.js +1 -0
  15. package/dist/helpers/homeAssistant/HomeAssistant.helper.d.ts +1 -0
  16. package/dist/helpers/homeAssistant/HomeAssistant.helper.js +23 -1
  17. package/dist/interfaces/homeAssistant/HomeAssistantButton.interface.d.ts +2 -2
  18. package/dist/stories/wizard/ControlledWizard.stories.js +17 -5
  19. package/dist/utils/Styles.utils.d.ts +1 -0
  20. package/dist/utils/Styles.utils.js +7 -0
  21. package/package.json +1 -1
  22. package/src/components/homeAssistant/HomeAssistantButton.tsx +2 -2
  23. package/src/components/homeAssistant/HomeAssistantSteps.tsx +1 -6
  24. package/src/components/homeAssistant/index.ts +1 -0
  25. package/src/components/homeAssistant/wizard/HomeAssistantWizardButton.tsx +87 -0
  26. package/src/components/homeAssistant/wizard/HomeAssistantWizardSteps.tsx +28 -0
  27. package/src/components/homeAssistant/wizard/index.ts +2 -0
  28. package/src/components/wizard/WizardTextBody.tsx +23 -0
  29. package/src/components/wizard/index.ts +1 -0
  30. package/src/helpers/homeAssistant/HomeAssistant.helper.tsx +25 -0
  31. package/src/interfaces/homeAssistant/HomeAssistantButton.interface.ts +2 -2
  32. package/src/stories/wizard/ControlledWizard.stories.tsx +43 -2
  33. package/src/utils/Styles.utils.ts +6 -0
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Center, Image, Stack, Text } from '@chakra-ui/react';
3
3
  import { CheckInCircle } from '../../assets/images';
4
4
  import { getIconAltText } from '../../utils';
5
- export const HomeAssistantButton = ({ currentStep, onStepClick, status, step, }) => {
5
+ export const HomeAssistantButton = ({ currentStep = 1, onStepClick, status, step, }) => {
6
6
  const iconAltText = getIconAltText(step.icon);
7
7
  const isCompleted = status === 'completed';
8
8
  const isPending = status === 'pending';
9
9
  const handleClick = () => {
10
10
  if (!isPending)
11
- onStepClick(currentStep);
11
+ onStepClick === null || onStepClick === void 0 ? void 0 : onStepClick(currentStep);
12
12
  };
13
13
  const buttonId = `homeAssistantButton-${currentStep}`;
14
14
  return (_jsxs(Box, { position: "relative", id: buttonId, zIndex: "2", children: [isCompleted && (_jsx(Image, { src: CheckInCircle || null, alt: "check", w: "22px", h: "auto", position: "absolute", top: "-4px", left: "-2px", boxShadow: "lg", borderRadius: "full" })), _jsxs(Stack, Object.assign({ as: "button", spacing: "2", borderRadius: "lg", boxShadow: "lg", border: "1px solid transparent", w: "116px", align: "center", h: "106px", py: "base", onClick: handleClick }, setStyles(status), { children: [_jsx(Center, { h: "60%", children: (step === null || step === void 0 ? void 0 : step.icon) && (_jsx(Image, { src: step.icon, alt: iconAltText, w: "auto", h: "38px" })) }), _jsx(Center, { h: "40%", children: _jsx(Text, { fontSize: "sm", textTransform: "uppercase", textAlign: "center", lineHeight: "14px", children: step.title }) })] }))] }));
@@ -3,6 +3,7 @@ import { Center, SimpleGrid, Stack } from '@chakra-ui/react';
3
3
  import { HomeAssistantButton, HomeAssistantStepper } from '..';
4
4
  import { homeAssistantSteps } from '../../helpers';
5
5
  import { homeAssistantProxy } from '../../proxies';
6
+ import { getStatus } from '../../utils';
6
7
  export const HomeAssistantSteps = ({ currentStep, onStepClick, currentPanel, }) => {
7
8
  const { setSelectedId } = homeAssistantProxy;
8
9
  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) => {
@@ -10,10 +11,3 @@ export const HomeAssistantSteps = ({ currentStep, onStepClick, currentPanel, })
10
11
  setSelectedId(`homeAssistantButton-${index + 1}`);
11
12
  }, status: getStatus(index + 1, currentStep), step: step }) }, step.title))) })] }));
12
13
  };
13
- const getStatus = (index, currentStep) => {
14
- if (index === currentStep)
15
- return 'active';
16
- if (index < currentStep)
17
- return 'completed';
18
- return 'pending';
19
- };
@@ -1,5 +1,6 @@
1
1
  export * from './monitorAlerts';
2
2
  export * from './panel';
3
+ export * from './wizard';
3
4
  export * from './HomeAssistant';
4
5
  export * from './HomeAssistantButton';
5
6
  export * from './HomeAssistantStepper';
@@ -1,5 +1,6 @@
1
1
  export * from './monitorAlerts';
2
2
  export * from './panel';
3
+ export * from './wizard';
3
4
  export * from './HomeAssistant';
4
5
  export * from './HomeAssistantButton';
5
6
  export * from './HomeAssistantStepper';
@@ -0,0 +1,2 @@
1
+ import { HomeAssistantButtonI } from '../../../interfaces';
2
+ export declare const HomeAssistantWizardButton: ({ status, step, }: HomeAssistantButtonI) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Center, Image, Stack, Text } from '@chakra-ui/react';
3
+ import { CheckInCircle } from '../../../assets/images';
4
+ import { getIconAltText } from '../../../utils';
5
+ export const HomeAssistantWizardButton = ({ status, step, }) => {
6
+ const iconAltText = getIconAltText(step.icon);
7
+ const isCompleted = status === 'completed';
8
+ const isActive = status === 'active';
9
+ return (_jsxs(Stack, { position: "relative", spacing: "4", children: [isCompleted && (_jsx(Image, { src: CheckInCircle || null, alt: "check", w: "22px", h: "auto", position: "absolute", top: "-6px", left: "-8px", boxShadow: "lg", borderRadius: "full" })), _jsxs(Stack, Object.assign({ spacing: "0", borderRadius: "md", boxShadow: "lg", border: "1px solid transparent", pt: "2", align: "center", w: "70px", h: "63px", cursor: "default" }, setStyles(status), { children: [(step === null || step === void 0 ? void 0 : step.icon) && (_jsx(Box, { boxSize: "24px", children: _jsx(Image, { src: step.icon, alt: iconAltText, w: "full", h: "full", objectFit: "contain" }) })), _jsx(Center, { h: "50%", children: _jsx(Text, { fontSize: "8px", textTransform: "uppercase", textAlign: "center", lineHeight: "1", children: step.title }) })] })), _jsx(Box, { h: "6px", bg: isActive ? 'blue.8' : 'transparent' })] }));
10
+ };
11
+ const setStyles = (status) => {
12
+ switch (status) {
13
+ case 'completed':
14
+ return {
15
+ bg: 'neutral.white',
16
+ borderColor: 'green.1',
17
+ };
18
+ case 'active':
19
+ return {
20
+ bg: 'neutral.white',
21
+ borderColor: 'blue.8',
22
+ };
23
+ case 'pending':
24
+ return {
25
+ bg: 'neutral.white',
26
+ filter: 'grayscale(1) opacity(0.2)',
27
+ };
28
+ }
29
+ };
@@ -0,0 +1,2 @@
1
+ import { HomeAssistantStepsI } from '../../../interfaces';
2
+ export declare const HomeAssistantWizardSteps: ({ currentStep, }: HomeAssistantStepsI) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Center, Flex } from '@chakra-ui/react';
3
+ import { HomeAssistantWizardButton } from '../..';
4
+ import { homeAssistantWizardSteps } from '../../../helpers';
5
+ import { getStatus } from '../../../utils';
6
+ export const HomeAssistantWizardSteps = ({ currentStep, }) => {
7
+ return (_jsx(Center, { w: "full", bg: "lightGreen.1", pt: { base: '4', md: '8' }, children: _jsx(Flex, { gap: "base", overflow: { base: 'scroll', md: 'visible' }, p: { base: '4', md: '0' }, children: homeAssistantWizardSteps.map((step, index) => (_jsx(Center, { w: "100%", children: _jsx(HomeAssistantWizardButton, { status: getStatus(index + 1, currentStep), step: step }) }, step.title))) }) }));
8
+ };
@@ -0,0 +1,2 @@
1
+ export * from './HomeAssistantWizardButton';
2
+ export * from './HomeAssistantWizardSteps';
@@ -0,0 +1,2 @@
1
+ export * from './HomeAssistantWizardButton';
2
+ export * from './HomeAssistantWizardSteps';
@@ -0,0 +1,2 @@
1
+ import { WizardTextHeaderI } from '../../interfaces';
2
+ export declare const WizardTextBody: ({ title, subtitle }: WizardTextHeaderI) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Center, Stack, Text } from '@chakra-ui/react';
3
+ export const WizardTextBody = ({ title, subtitle }) => {
4
+ return (_jsx(Center, { w: "full", minH: "100px", children: _jsxs(Stack, { spacing: "4", w: "80%", children: [_jsx(Text, { fontSize: { base: 'xl', md: '2xl' }, lineHeight: { base: 'shorter', md: 'base' }, textAlign: "center", children: title }), subtitle && (_jsx(Text, { fontFamily: "secondary", textAlign: "center", children: subtitle }))] }) }));
5
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './ControlledWizard';
2
2
  export * from './WizardTextHeader';
3
+ export * from './WizardTextBody';
@@ -1,2 +1,3 @@
1
1
  export * from './ControlledWizard';
2
2
  export * from './WizardTextHeader';
3
+ export * from './WizardTextBody';
@@ -1,6 +1,7 @@
1
1
  import { HomeAssistantStepI } from '../../interfaces';
2
2
  import { AlertCategory } from '../../interfaces/homeAssistant/BackendAlert.interface';
3
3
  export declare const homeAssistantSteps: Array<HomeAssistantStepI>;
4
+ export declare const homeAssistantWizardSteps: Array<HomeAssistantStepI>;
4
5
  interface CategoryConfigI {
5
6
  label: string;
6
7
  icon: string;
@@ -1,4 +1,4 @@
1
- import { Fire, GearTime, House, LargeAppliances, Target, Temperature, Water, } from '../../assets/images';
1
+ import { Fire, Fridge, GearTime, House, LargeAppliances, Patio, Target, Temperature, Water, } from '../../assets/images';
2
2
  export const homeAssistantSteps = [
3
3
  {
4
4
  title: 'Goals',
@@ -25,6 +25,28 @@ export const homeAssistantSteps = [
25
25
  icon: Water,
26
26
  },
27
27
  ];
28
+ export const homeAssistantWizardSteps = [
29
+ {
30
+ title: 'Objectives',
31
+ icon: Target,
32
+ },
33
+ {
34
+ title: 'Smoke & CO2 detectors',
35
+ icon: Fire,
36
+ },
37
+ {
38
+ title: 'Appliances',
39
+ icon: Fridge,
40
+ },
41
+ {
42
+ title: 'Heating & Cooling',
43
+ icon: Temperature,
44
+ },
45
+ {
46
+ title: 'Landscape',
47
+ icon: Patio,
48
+ },
49
+ ];
28
50
  export const CATEGORY_CONFIG = {
29
51
  safeguard: {
30
52
  label: 'Protection Monitor',
@@ -3,8 +3,8 @@ export interface HomeAssistantStepI {
3
3
  title: string;
4
4
  }
5
5
  export interface HomeAssistantButtonI {
6
- currentStep: number;
7
- onStepClick: (step: number) => void;
6
+ currentStep?: number;
7
+ onStepClick?: (step: number) => void;
8
8
  status: 'completed' | 'active' | 'pending';
9
9
  step: HomeAssistantStepI;
10
10
  }
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { ConfirmProperty, ControlledWizard, HomeAssistantTutorial, MyHomeDetails, SearchRecords, WizardTextHeader, } from '../../components';
12
- import { Box, Center } from '@chakra-ui/react';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { ConfirmProperty, ControlledWizard, FooterButtons, HomeAssistantTutorial, HomeAssistantWizardSteps, MyHomeDetails, SearchRecords, WizardTextBody, WizardTextHeader, } from '../../components';
12
+ import { Box, Center, Stack } from '@chakra-ui/react';
13
13
  import { useState } from 'react';
14
14
  import { formValues } from '../../helpers';
15
15
  import { propertiesMock } from '../../mocks';
@@ -26,7 +26,19 @@ function fakeLookup() {
26
26
  }
27
27
  export const ControlledWizardComponent = () => {
28
28
  const [step, setStep] = useState(0);
29
- return (_jsx(ControlledWizard, { step: step, setStep: setStep, steps: [
29
+ return (_jsx(ControlledWizard, { minHeight: "300px", step: step, setStep: setStep, steps: [
30
+ {
31
+ header: (_jsx(HomeAssistantWizardSteps, { currentStep: 2, onStepClick: () => { } })),
32
+ body: () => (_jsxs(Stack, { h: "500px", spacing: "10", w: { base: 'full', md: '600px' }, justify: "space-around", m: "auto", children: [_jsx(WizardTextBody, { title: "1. Tell Homi about your goals.", subtitle: "These choices help Homi build a personalized Homeboard that tracks your home\u2019s performance, savings, and priorities." }), _jsx(Box, { flex: "1", bg: "gray.1" }), _jsx(Box, { alignSelf: "flex-end", children: _jsx(FooterButtons, { button1: {
33
+ buttonStyle: 'secondaryFooter',
34
+ onClick: () => setStep(1),
35
+ label: 'Back',
36
+ }, button2: {
37
+ buttonStyle: 'tertiaryFooter',
38
+ onClick: () => setStep(1),
39
+ label: 'Save selection',
40
+ } }) })] })),
41
+ },
30
42
  {
31
43
  header: (_jsx(WizardTextHeader, { title: "Hi John, let\u2019s get your Homefile set up.", subtitle: "Complete this quick setup and we\u2019ll handle the rest." })),
32
44
  body: ({ setStep }) => (_jsx(MyHomeDetails, { isWizard: true, userFirstName: "Adam", values: formValues, properties: propertiesMock, handleCreateHomeClick: (values) => __awaiter(void 0, void 0, void 0, function* () {
@@ -53,7 +65,7 @@ export const ControlledWizardComponent = () => {
53
65
  number: '123',
54
66
  zip: '80123',
55
67
  }, name: "your home" })),
56
- body: () => (_jsx(Center, { w: "full", h: "full", children: _jsx(HomeAssistantTutorial, { onStart: () => { }, maxWidth: "500px" }) })),
68
+ body: () => (_jsx(Center, { w: "full", h: "full", children: _jsx(HomeAssistantTutorial, { onStart: () => setStep(4), maxWidth: "500px" }) })),
57
69
  },
58
70
  ] }));
59
71
  };
@@ -5,4 +5,5 @@ interface getColorBasedOnPercentageI {
5
5
  percentage?: string;
6
6
  }
7
7
  export declare const getColorBasedOnPercentage: ({ colorDefault, colorNegative, colorPositive, percentage, }: getColorBasedOnPercentageI) => string;
8
+ export declare const getStatus: (index: number, currentStep: number) => "active" | "completed" | "pending";
8
9
  export {};
@@ -4,3 +4,10 @@ export const getColorBasedOnPercentage = ({ colorDefault = 'lightBlue.2', colorN
4
4
  const isPositive = percentage === null || percentage === void 0 ? void 0 : percentage.includes('+');
5
5
  return isPositive ? colorPositive : colorNegative;
6
6
  };
7
+ export const getStatus = (index, currentStep) => {
8
+ if (index === currentStep)
9
+ return 'active';
10
+ if (index < currentStep)
11
+ return 'completed';
12
+ return 'pending';
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.31.1",
3
+ "version": "2.32.0",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -4,7 +4,7 @@ import { HomeAssistantButtonI } from '@/interfaces'
4
4
  import { getIconAltText } from '@/utils'
5
5
 
6
6
  export const HomeAssistantButton = ({
7
- currentStep,
7
+ currentStep = 1,
8
8
  onStepClick,
9
9
  status,
10
10
  step,
@@ -13,7 +13,7 @@ export const HomeAssistantButton = ({
13
13
  const isCompleted = status === 'completed'
14
14
  const isPending = status === 'pending'
15
15
  const handleClick = () => {
16
- if (!isPending) onStepClick(currentStep)
16
+ if (!isPending) onStepClick?.(currentStep)
17
17
  }
18
18
  const buttonId = `homeAssistantButton-${currentStep}`
19
19
  return (
@@ -3,6 +3,7 @@ import { HomeAssistantStepsI } from '@/interfaces'
3
3
  import { HomeAssistantButton, HomeAssistantStepper } from '@/components'
4
4
  import { homeAssistantSteps } from '@/helpers'
5
5
  import { homeAssistantProxy } from '@/proxies'
6
+ import { getStatus } from '@/utils'
6
7
 
7
8
  export const HomeAssistantSteps = ({
8
9
  currentStep,
@@ -37,9 +38,3 @@ export const HomeAssistantSteps = ({
37
38
  </Stack>
38
39
  )
39
40
  }
40
-
41
- const getStatus = (index: number, currentStep: number) => {
42
- if (index === currentStep) return 'active'
43
- if (index < currentStep) return 'completed'
44
- return 'pending'
45
- }
@@ -1,5 +1,6 @@
1
1
  export * from './monitorAlerts'
2
2
  export * from './panel'
3
+ export * from './wizard'
3
4
  export * from './HomeAssistant'
4
5
  export * from './HomeAssistantButton'
5
6
  export * from './HomeAssistantStepper'
@@ -0,0 +1,87 @@
1
+ import { border, Box, Center, Image, Stack, Text } from '@chakra-ui/react'
2
+ import { CheckInCircle } from '@/assets/images'
3
+ import { HomeAssistantButtonI } from '@/interfaces'
4
+ import { getIconAltText } from '@/utils'
5
+
6
+ export const HomeAssistantWizardButton = ({
7
+ status,
8
+ step,
9
+ }: HomeAssistantButtonI) => {
10
+ const iconAltText = getIconAltText(step.icon)
11
+ const isCompleted = status === 'completed'
12
+ const isActive = status === 'active'
13
+
14
+ return (
15
+ <Stack position="relative" spacing="4">
16
+ {isCompleted && (
17
+ <Image
18
+ src={CheckInCircle || null}
19
+ alt="check"
20
+ w="22px"
21
+ h="auto"
22
+ position="absolute"
23
+ top="-6px"
24
+ left="-8px"
25
+ boxShadow="lg"
26
+ borderRadius="full"
27
+ />
28
+ )}
29
+
30
+ <Stack
31
+ spacing="0"
32
+ borderRadius="md"
33
+ boxShadow="lg"
34
+ border="1px solid transparent"
35
+ pt="2"
36
+ align="center"
37
+ w="70px"
38
+ h="63px"
39
+ cursor="default"
40
+ {...setStyles(status)}
41
+ >
42
+ {step?.icon && (
43
+ <Box boxSize="24px">
44
+ <Image
45
+ src={step.icon}
46
+ alt={iconAltText}
47
+ w="full"
48
+ h="full"
49
+ objectFit="contain"
50
+ />
51
+ </Box>
52
+ )}
53
+ <Center h="50%">
54
+ <Text
55
+ fontSize="8px"
56
+ textTransform="uppercase"
57
+ textAlign="center"
58
+ lineHeight="1"
59
+ >
60
+ {step.title}
61
+ </Text>
62
+ </Center>
63
+ </Stack>
64
+ <Box h="6px" bg={isActive ? 'blue.8' : 'transparent'} />
65
+ </Stack>
66
+ )
67
+ }
68
+
69
+ const setStyles = (status: HomeAssistantButtonI['status']) => {
70
+ switch (status) {
71
+ case 'completed':
72
+ return {
73
+ bg: 'neutral.white',
74
+ borderColor: 'green.1',
75
+ }
76
+ case 'active':
77
+ return {
78
+ bg: 'neutral.white',
79
+ borderColor: 'blue.8',
80
+ }
81
+ case 'pending':
82
+ return {
83
+ bg: 'neutral.white',
84
+ filter: 'grayscale(1) opacity(0.2)',
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,28 @@
1
+ import { Center, Flex } from '@chakra-ui/react'
2
+ import { HomeAssistantStepsI } from '@/interfaces'
3
+ import { HomeAssistantWizardButton } from '@/components'
4
+ import { homeAssistantWizardSteps } from '@/helpers'
5
+ import { getStatus } from '@/utils'
6
+
7
+ export const HomeAssistantWizardSteps = ({
8
+ currentStep,
9
+ }: HomeAssistantStepsI) => {
10
+ return (
11
+ <Center w="full" bg="lightGreen.1" pt={{ base: '4', md: '8' }}>
12
+ <Flex
13
+ gap="base"
14
+ overflow={{ base: 'scroll', md: 'visible' }}
15
+ p={{ base: '4', md: '0' }}
16
+ >
17
+ {homeAssistantWizardSteps.map((step, index) => (
18
+ <Center key={step.title} w="100%">
19
+ <HomeAssistantWizardButton
20
+ status={getStatus(index + 1, currentStep)}
21
+ step={step}
22
+ />
23
+ </Center>
24
+ ))}
25
+ </Flex>
26
+ </Center>
27
+ )
28
+ }
@@ -0,0 +1,2 @@
1
+ export * from './HomeAssistantWizardButton'
2
+ export * from './HomeAssistantWizardSteps'
@@ -0,0 +1,23 @@
1
+ import { Center, Stack, Text } from '@chakra-ui/react'
2
+ import { WizardTextHeaderI } from '@/interfaces'
3
+
4
+ export const WizardTextBody = ({ title, subtitle }: WizardTextHeaderI) => {
5
+ return (
6
+ <Center w="full" minH="100px">
7
+ <Stack spacing="4" w="80%">
8
+ <Text
9
+ fontSize={{ base: 'xl', md: '2xl' }}
10
+ lineHeight={{ base: 'shorter', md: 'base' }}
11
+ textAlign="center"
12
+ >
13
+ {title}
14
+ </Text>
15
+ {subtitle && (
16
+ <Text fontFamily="secondary" textAlign="center">
17
+ {subtitle}
18
+ </Text>
19
+ )}
20
+ </Stack>
21
+ </Center>
22
+ )
23
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './ControlledWizard'
2
2
  export * from './WizardTextHeader'
3
+ export * from './WizardTextBody'
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  Fire,
3
+ Fridge,
3
4
  GearTime,
4
5
  House,
5
6
  LargeAppliances,
7
+ Patio,
6
8
  Target,
7
9
  Temperature,
8
10
  Water,
@@ -37,6 +39,29 @@ export const homeAssistantSteps: Array<HomeAssistantStepI> = [
37
39
  },
38
40
  ]
39
41
 
42
+ export const homeAssistantWizardSteps: Array<HomeAssistantStepI> = [
43
+ {
44
+ title: 'Objectives',
45
+ icon: Target,
46
+ },
47
+ {
48
+ title: 'Smoke & CO2 detectors',
49
+ icon: Fire,
50
+ },
51
+ {
52
+ title: 'Appliances',
53
+ icon: Fridge,
54
+ },
55
+ {
56
+ title: 'Heating & Cooling',
57
+ icon: Temperature,
58
+ },
59
+ {
60
+ title: 'Landscape',
61
+ icon: Patio,
62
+ },
63
+ ]
64
+
40
65
  interface CategoryConfigI {
41
66
  label: string
42
67
  icon: string
@@ -4,8 +4,8 @@ export interface HomeAssistantStepI {
4
4
  }
5
5
 
6
6
  export interface HomeAssistantButtonI {
7
- currentStep: number
8
- onStepClick: (step: number) => void
7
+ currentStep?: number
8
+ onStepClick?: (step: number) => void
9
9
  status: 'completed' | 'active' | 'pending'
10
10
  step: HomeAssistantStepI
11
11
  }
@@ -2,12 +2,15 @@ import { Meta } from '@storybook/react'
2
2
  import {
3
3
  ConfirmProperty,
4
4
  ControlledWizard,
5
+ FooterButtons,
5
6
  HomeAssistantTutorial,
7
+ HomeAssistantWizardSteps,
6
8
  MyHomeDetails,
7
9
  SearchRecords,
10
+ WizardTextBody,
8
11
  WizardTextHeader,
9
12
  } from '@/components'
10
- import { Box, Center } from '@chakra-ui/react'
13
+ import { Box, Center, Stack } from '@chakra-ui/react'
11
14
  import { useState } from 'react'
12
15
  import { formValues } from '@/helpers'
13
16
  import { propertiesMock } from '@/mocks'
@@ -34,9 +37,44 @@ export const ControlledWizardComponent = () => {
34
37
  const [step, setStep] = useState(0)
35
38
  return (
36
39
  <ControlledWizard
40
+ minHeight="300px"
37
41
  step={step}
38
42
  setStep={setStep}
39
43
  steps={[
44
+ {
45
+ header: (
46
+ <HomeAssistantWizardSteps currentStep={2} onStepClick={() => {}} />
47
+ ),
48
+ body: () => (
49
+ <Stack
50
+ h="500px"
51
+ spacing="10"
52
+ w={{ base: 'full', md: '600px' }}
53
+ justify="space-around"
54
+ m="auto"
55
+ >
56
+ <WizardTextBody
57
+ title="1. Tell Homi about your goals."
58
+ subtitle="These choices help Homi build a personalized Homeboard that tracks your home’s performance, savings, and priorities."
59
+ />
60
+ <Box flex="1" bg="gray.1" />
61
+ <Box alignSelf="flex-end">
62
+ <FooterButtons
63
+ button1={{
64
+ buttonStyle: 'secondaryFooter',
65
+ onClick: () => setStep(1),
66
+ label: 'Back',
67
+ }}
68
+ button2={{
69
+ buttonStyle: 'tertiaryFooter',
70
+ onClick: () => setStep(1),
71
+ label: 'Save selection',
72
+ }}
73
+ />
74
+ </Box>
75
+ </Stack>
76
+ ),
77
+ },
40
78
  {
41
79
  header: (
42
80
  <WizardTextHeader
@@ -98,7 +136,10 @@ export const ControlledWizardComponent = () => {
98
136
  ),
99
137
  body: () => (
100
138
  <Center w="full" h="full">
101
- <HomeAssistantTutorial onStart={() => {}} maxWidth="500px" />
139
+ <HomeAssistantTutorial
140
+ onStart={() => setStep(4)}
141
+ maxWidth="500px"
142
+ />
102
143
  </Center>
103
144
  ),
104
145
  },
@@ -15,3 +15,9 @@ export const getColorBasedOnPercentage = ({
15
15
  const isPositive = percentage?.includes('+')
16
16
  return isPositive ? colorPositive : colorNegative
17
17
  }
18
+
19
+ export const getStatus = (index: number, currentStep: number) => {
20
+ if (index === currentStep) return 'active'
21
+ if (index < currentStep) return 'completed'
22
+ return 'pending'
23
+ }