@homefile/components-v2 2.36.11 → 2.36.12

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.
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from 'react';
3
- import { FormProvider } from 'react-hook-form';
4
3
  import { t } from 'i18next';
5
4
  import { DrawerHeader, DrawerBody, Stack, Text, DrawerFooter, } from '@chakra-ui/react';
6
5
  import { IA } from '../../../assets/images';
7
6
  import { ApplianceSteps, SimpleDynamicForm, FooterButtons, HomeAssistantPanelStep, PanelHeader, Loading, HomeAssistantWizardSteps, DynamicForm, } from '../../../components';
8
7
  import { homeAssistantSteps } from '../../../helpers';
9
- import { useSimpleDynamicForm } from '../../../hooks';
10
- import { homeAssistantProxy } from '../../../proxies';
8
+ import { dynamicFormProxy, homeAssistantProxy } from '../../../proxies';
9
+ import { useSnapshot } from 'valtio';
11
10
  export const HomeAssistantPanel = ({ children, currentForm, currentStep, onApplianceClick = () => { }, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading, }) => {
12
11
  var _a, _b;
12
+ const { fields } = useSnapshot(dynamicFormProxy);
13
13
  const [addedAppliances, updateAddedAppliances] = useState([]);
14
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 : '';
15
15
  const text = `${t('homeAssistant.details')} ${title.toLowerCase()}:`;
@@ -30,16 +30,13 @@ export const HomeAssistantPanel = ({ children, currentForm, currentStep, onAppli
30
30
  setHighlight(false);
31
31
  };
32
32
  }, [currentForm, isAppliances]);
33
- const { form, updatedFields } = useSimpleDynamicForm({
34
- fields: currentForm,
35
- });
36
33
  const handleClose = () => {
37
34
  onClose();
38
35
  setHighlight(false);
39
36
  };
40
37
  if (isLoading)
41
38
  return _jsx(Loading, {});
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: {
39
+ 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(SimpleDynamicForm, { fields: currentForm })] })] }), _jsx(DrawerFooter, { px: "0", py: "6", bg: "neutral.white", children: _jsx(FooterButtons, { button1: {
43
40
  buttonStyle: 'secondaryFooter',
44
41
  label: t('buttons.back'),
45
42
  onClick: onBack,
@@ -49,7 +46,7 @@ export const HomeAssistantPanel = ({ children, currentForm, currentStep, onAppli
49
46
  label: !hasCompleted && currentStep === 6
50
47
  ? t('buttons.finish')
51
48
  : t('buttons.saveStep'),
52
- onClick: () => onSave === null || onSave === void 0 ? void 0 : onSave(updatedFields),
49
+ onClick: () => onSave === null || onSave === void 0 ? void 0 : onSave(fields),
53
50
  }, button3: !hasCompleted && currentStep === 6
54
51
  ? undefined
55
52
  : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.36.11",
3
+ "version": "2.36.12",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",