@homefile/components-v2 2.39.22 → 2.39.23

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.
@@ -0,0 +1,2 @@
1
+ import { AddHomeContentI } from '../../../interfaces';
2
+ export declare const ConfirmHomeDetails: ({ isLoading, handleCreateHomeClick, }: Pick<AddHomeContentI, "isLoading" | "handleCreateHomeClick">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { t } from 'i18next';
3
+ import { Button } from '@chakra-ui/react';
4
+ import { useAddHouseContent } from '../../../hooks';
5
+ export const ConfirmHomeDetails = ({ isLoading, handleCreateHomeClick, }) => {
6
+ const { handleSubmit } = useAddHouseContent(undefined, handleCreateHomeClick);
7
+ return (_jsx(Button, { onClick: handleSubmit, variant: "wizard", disabled: isLoading, children: t('buttons.confirm') }));
8
+ };
@@ -1,2 +1,2 @@
1
1
  import { AddHomeContentI } from '../../../interfaces';
2
- export declare const NewHomeDetails: ({ handleCreateHomeClick, values, isLoading, }: AddHomeContentI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const NewHomeDetails: ({ values, isLoading }: AddHomeContentI) => import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useSnapshot } from 'valtio';
3
3
  import { t } from 'i18next';
4
- import { Stack, Center, Flex, Button, Divider, } from '@chakra-ui/react';
4
+ import { Stack, Center, Divider } from '@chakra-ui/react';
5
5
  import { AddressStored, TextInput, IncludePublicRecords, WrapperWithShadow, } from '../../../components';
6
6
  import { firstHomeProxy } from '../../../proxies';
7
7
  import { useAddHouseContent } from '../../../hooks';
8
8
  import { BeatLoader } from 'react-spinners';
9
9
  import { up } from './MyHomeDetails';
10
- export const NewHomeDetails = ({ handleCreateHomeClick, values, isLoading, }) => {
11
- const { handleErrorMessage, handleNameChange, handleNameValidation, handleSelectRecords, handleSubmit, } = useAddHouseContent(values, handleCreateHomeClick);
10
+ export const NewHomeDetails = ({ values, isLoading }) => {
11
+ const { handleErrorMessage, handleNameChange, handleNameValidation, handleSelectRecords, } = useAddHouseContent(values);
12
12
  const { name, isNameValid, searchRecords } = useSnapshot(firstHomeProxy, {
13
13
  sync: true,
14
14
  });
15
- return (_jsxs(Stack, { spacing: "base", children: [isLoading && (_jsx(Center, { h: "4rem", children: _jsx(BeatLoader, { color: "gray", size: 8 }) })), !isLoading && (_jsxs(Stack, { spacing: "base", children: [_jsx(TextInput, { errorMessage: handleErrorMessage(), hasError: !isNameValid, id: "homeName", placeholder: t('myHomes.form.homeName'), handleChange: handleNameChange, onBlurCapture: handleNameValidation, value: name }), _jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(AddressStored, {})] })), _jsx(WrapperWithShadow, { animation: up, fadeDelay: 0.2, isWizard: true, padding: "0", pb: "0", children: _jsx(Flex, { direction: "column", justify: "space-between", gap: "10", h: "full", children: _jsxs(Stack, { spacing: "4", children: [_jsx(IncludePublicRecords, { isChecked: searchRecords, onSelectRecords: handleSelectRecords }), _jsx(Button, { onClick: handleSubmit, disabled: isLoading, variant: "wizard", children: t('buttons.confirm') })] }) }) })] }));
15
+ return (_jsxs(Stack, { spacing: "base", children: [isLoading && (_jsx(Center, { h: "4rem", children: _jsx(BeatLoader, { color: "gray", size: 8 }) })), !isLoading && (_jsxs(Stack, { spacing: "base", children: [_jsx(TextInput, { errorMessage: handleErrorMessage(), hasError: !isNameValid, id: "homeName", placeholder: t('myHomes.form.homeName'), handleChange: handleNameChange, onBlurCapture: handleNameValidation, value: name }), _jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(AddressStored, {})] })), _jsx(WrapperWithShadow, { animation: up, fadeDelay: 0.2, isWizard: true, padding: "0", pb: "0", children: _jsx(IncludePublicRecords, { isChecked: searchRecords, onSelectRecords: handleSelectRecords }) })] }));
16
16
  };
@@ -1,3 +1,4 @@
1
+ export * from './ConfirmHomeDetails';
1
2
  export * from './ConfirmProperty';
2
3
  export * from './MyHomeDetails';
3
4
  export * from './MyHomesStepBody';
@@ -1,3 +1,4 @@
1
+ export * from './ConfirmHomeDetails';
1
2
  export * from './ConfirmProperty';
2
3
  export * from './MyHomeDetails';
3
4
  export * from './MyHomesStepBody';
@@ -1,2 +1,2 @@
1
1
  import { ControlledWizardI } from '../../interfaces';
2
- export declare function ControlledWizard({ bodyWidth, step, setStep, steps, height, headerBlink, }: ControlledWizardI): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ControlledWizard({ bodyWidth, step, setStep, steps, height, headerBlink, footerBlink, }: ControlledWizardI): import("react/jsx-runtime").JSX.Element;
@@ -2,19 +2,56 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Flex, Stack } from '@chakra-ui/react';
3
3
  import { AnimatePresence, motion } from 'framer-motion';
4
4
  const MotionBox = motion.create(typeof Box);
5
- export function ControlledWizard({ bodyWidth = '80%', step, setStep, steps, height = '700px', headerBlink, }) {
5
+ export function ControlledWizard({ bodyWidth = '80%', step, setStep, steps, height = '700px', headerBlink, footerBlink, }) {
6
6
  const current = steps[step];
7
7
  const headerVariants = {
8
- initial: { opacity: 0, y: 8 },
8
+ initial: { opacity: 0, y: 8, filter: 'blur(6px)' },
9
9
  animate: headerBlink
10
- ? { opacity: [1, 0.55, 1], y: 0, transition: { duration: 0.28 } }
11
- : { opacity: 1, y: 0, transition: { duration: 0.28 } },
12
- exit: { opacity: 0, y: -8, transition: { duration: 0.18 } },
10
+ ? {
11
+ opacity: [1, 0.55, 1],
12
+ y: 0,
13
+ filter: 'blur(0px)',
14
+ transition: { duration: 0.28 },
15
+ }
16
+ : {
17
+ opacity: 1,
18
+ y: 0,
19
+ filter: 'blur(0px)',
20
+ transition: { duration: 0.24 },
21
+ },
22
+ exit: {
23
+ opacity: 0,
24
+ y: -8,
25
+ filter: 'blur(6px)',
26
+ transition: { duration: 0.18 },
27
+ },
13
28
  };
14
29
  const bodyVariants = {
15
30
  initial: { opacity: 0, y: 12, scale: 0.98 },
16
- animate: { opacity: 1, y: 0, scale: 1 },
17
- exit: { opacity: 0, y: -8, scale: 0.98 },
31
+ animate: { opacity: 1, y: 0, scale: 1, transition: { duration: 0.22 } },
32
+ exit: { opacity: 0, y: -8, scale: 0.98, transition: { duration: 0.18 } },
18
33
  };
19
- return (_jsxs(Stack, { spacing: { base: '4', md: '8' }, shadow: "md", h: height, bg: "white", overflowY: "hidden", pb: { base: '8', md: '16' }, children: [_jsx(AnimatePresence, { mode: "wait", children: _jsx(Box, { as: MotionBox, variants: headerVariants, initial: "initial", animate: "animate", exit: "exit", w: "full", children: current.header }, `h-${step}`) }), _jsx(AnimatePresence, { mode: "wait", children: _jsx(Box, { as: MotionBox, variants: bodyVariants, initial: "initial", animate: "animate", exit: "exit", flex: "1", display: "flex", minH: "0", children: _jsx(Flex, { direction: "column", flex: "1", overflowY: "auto", minH: "0", align: "center", children: _jsx(Box, { w: bodyWidth, children: current.body({ setStep }) }) }) }, `b-${step}`) })] }));
34
+ const footerVariants = {
35
+ initial: { opacity: 0, y: 12, filter: 'blur(6px)' },
36
+ animate: footerBlink
37
+ ? {
38
+ opacity: [1, 0.6, 1],
39
+ y: 0,
40
+ filter: 'blur(0px)',
41
+ transition: { duration: 0.28 },
42
+ }
43
+ : {
44
+ opacity: 1,
45
+ y: 0,
46
+ filter: 'blur(0px)',
47
+ transition: { duration: 0.24 },
48
+ },
49
+ exit: {
50
+ opacity: 0,
51
+ y: 12,
52
+ filter: 'blur(6px)',
53
+ transition: { duration: 0.18 },
54
+ },
55
+ };
56
+ return (_jsxs(Stack, { shadow: "md", h: height, bg: "white", overflow: "hidden", spacing: "0", children: [_jsx(AnimatePresence, { mode: "wait", children: _jsx(Box, { as: MotionBox, variants: headerVariants, initial: "initial", animate: "animate", exit: "exit", w: "full", flexShrink: 0, children: current.header }, `h-${step}`) }), _jsx(AnimatePresence, { mode: "wait", children: _jsx(Box, { as: MotionBox, variants: bodyVariants, initial: "initial", animate: "animate", exit: "exit", flex: "1", display: "flex", minH: "0", children: _jsx(Flex, { direction: "column", flex: "auto", overflowY: "auto", minH: "0", align: "center", py: { base: '4', md: '8' }, children: _jsx(Box, { w: bodyWidth, children: current.body({ setStep }) }) }) }, `b-${step}`) }), current.footer && (_jsx(AnimatePresence, { mode: "wait", children: _jsx(Box, { as: MotionBox, variants: footerVariants, initial: "initial", animate: "animate", exit: "exit", w: "full", flexShrink: 0, bg: "white", borderTopWidth: "1px", borderColor: "lightBlue.3", children: _jsx(Flex, { justify: "center", py: { base: '4', md: '5' }, children: _jsx(Box, { w: bodyWidth, children: current.footer }) }) }, `f-${step}`) }))] }));
20
57
  }
@@ -1,6 +1,6 @@
1
1
  import { ChangeEvent } from 'react';
2
2
  import { HandleInputType, HomeFormI } from '../../interfaces';
3
- export declare const useAddHouseContent: (values: HomeFormI | undefined, callback: (form: HomeFormI) => void) => {
3
+ export declare const useAddHouseContent: (values?: HomeFormI | undefined, callback?: (form: HomeFormI) => void) => {
4
4
  handleErrorMessage: () => string;
5
5
  handleLinkChange: HandleInputType;
6
6
  handleNameChange: HandleInputType;
@@ -53,7 +53,7 @@ export const useAddHouseContent = (values, callback) => {
53
53
  handleValidation('number');
54
54
  handleValidation('zip');
55
55
  if (!hasError && firstHome.isNameValid) {
56
- callback(Object.assign(Object.assign({}, fields), { externalLink: firstHome.externalLink, name: firstHome.name, isOwner: firstHome.isOwner, searchRecords: firstHome.searchRecords }));
56
+ callback === null || callback === void 0 ? void 0 : callback(Object.assign(Object.assign({}, fields), { externalLink: firstHome.externalLink, name: firstHome.name, isOwner: firstHome.isOwner, searchRecords: firstHome.searchRecords }));
57
57
  cleanStores();
58
58
  resetValidations();
59
59
  }
@@ -13,7 +13,7 @@ export interface HomeAddressDataI {
13
13
  }
14
14
  export interface AddHomeContentI {
15
15
  handleAddress?: (id: string) => void;
16
- handleCreateHomeClick: (form: HomeFormI) => void;
16
+ handleCreateHomeClick?: (form: HomeFormI) => void;
17
17
  handleSkipClick?: () => void;
18
18
  isFirstHome?: boolean;
19
19
  isLoading?: boolean;
@@ -1,15 +1,16 @@
1
- import { ReactNode } from 'react';
2
- export type WizardStep = {
3
- header: ReactNode;
4
- body: (api: {
5
- setStep: (i: number) => void;
6
- }) => ReactNode;
7
- };
1
+ export interface ControlledWizardStepI {
2
+ header: React.ReactNode;
3
+ body: (args: {
4
+ setStep: (n: number) => void;
5
+ }) => React.ReactNode;
6
+ footer?: React.ReactNode;
7
+ }
8
8
  export interface ControlledWizardI {
9
+ bodyWidth?: string;
9
10
  step: number;
10
- setStep: (i: number) => void;
11
- steps: WizardStep[];
12
- height?: string | number;
13
- bodyWidth?: string | number;
11
+ setStep: (n: number) => void;
12
+ steps: ControlledWizardStepI[];
13
+ height?: string;
14
14
  headerBlink?: boolean;
15
+ footerBlink?: boolean;
15
16
  }
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState } from 'react';
12
- import { ConfirmProperty, ControlledWizard, DynamicForm, FooterButtons, HomeAssistantTutorial, HomeAssistantWizardSteps, SearchRecords, WizardTextHeader, WizardSuccessHeader, WizardValueSummary, NewHomeDetails, } from '../../components';
12
+ import { ConfirmProperty, ControlledWizard, DynamicForm, FooterButtons, HomeAssistantTutorial, HomeAssistantWizardSteps, SearchRecords, WizardTextHeader, WizardSuccessHeader, WizardValueSummary, NewHomeDetails, ConfirmHomeDetails, } from '../../components';
13
13
  import { Box, Center, Stack } from '@chakra-ui/react';
14
14
  import { action } from '@storybook/addon-actions';
15
15
  import { assessedValueMock, homeWizardForm, propertiesMock, purchasePriceMock, } from '../../mocks';
@@ -41,10 +41,12 @@ export const ControlledWizardComponent = () => {
41
41
  return (_jsx(ControlledWizard, { height: "700px", step: step, setStep: setStep, steps: [
42
42
  {
43
43
  header: (_jsx(WizardTextHeader, { title: "Welcome to Homefile John.", subtitle: "We\u2019re about to make owning your home dramatically easier. Answer a few quick questions and we\u2019ll handle everything that usually slips through the cracks." })),
44
- body: ({ setStep }) => (_jsx(NewHomeDetails, { values: formValues, handleCreateHomeClick: (values) => __awaiter(void 0, void 0, void 0, function* () {
44
+ body: ({ setStep }) => _jsx(NewHomeDetails, { values: formValues }),
45
+ footer: (_jsx(ConfirmHomeDetails, { handleCreateHomeClick: (values) => __awaiter(void 0, void 0, void 0, function* () {
45
46
  setStep(1);
46
47
  yield fakeLookup();
47
48
  setStep(2);
49
+ action('Create Home Click')(values);
48
50
  }) })),
49
51
  },
50
52
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.39.22",
3
+ "version": "2.39.23",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",