@homefile/components-v2 2.11.0 → 2.11.1
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/forms/dynamicForm/fields/AIGridField.js +7 -4
- package/dist/interfaces/forms/dynamicForm/fields/GridField.interface.d.ts +1 -2
- package/dist/stories/forms/dynamicForm/DynamicForm.stories.d.ts +1 -1
- package/dist/stories/forms/dynamicForm/DynamicForm.stories.js +2 -1
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/fields/AIGridField.tsx +7 -4
- package/src/interfaces/forms/dynamicForm/fields/GridField.interface.ts +1 -1
- package/src/stories/forms/dynamicForm/DynamicForm.stories.tsx +3 -2
|
@@ -27,10 +27,13 @@ export const AIGridField = ({ children, onAISend, onRemove, onUpload, }) => {
|
|
|
27
27
|
};
|
|
28
28
|
const code = watch(String(textChild === null || textChild === void 0 ? void 0 : textChild.id));
|
|
29
29
|
const handleAISend = () => {
|
|
30
|
-
const form = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
30
|
+
const form = {};
|
|
31
|
+
if (code) {
|
|
32
|
+
form.code = code;
|
|
33
|
+
}
|
|
34
|
+
else if (imageField === null || imageField === void 0 ? void 0 : imageField.value) {
|
|
35
|
+
form.image = imageField.value;
|
|
36
|
+
}
|
|
34
37
|
onAISend === null || onAISend === void 0 ? void 0 : onAISend(form);
|
|
35
38
|
};
|
|
36
39
|
return (_jsxs(Flex, { align: "center", gap: "base", children: [_jsx(SingleImage, Object.assign({}, imageProps, { onUpload: onUpload, onRemove: onRemove, value: imageField === null || imageField === void 0 ? void 0 : imageField.value })), _jsx(Text, { fontFamily: "secondary", textAlign: "center", children: "OR" }), _jsx(TextField, Object.assign({}, textProps)), _jsx(IconButton, { "aria-label": "Add new address line", variant: "iconOutlined", icon: _jsx(Plus, { size: 28, stroke: colors.blue[3] }), onClick: handleAISend, h: "input.md", disabled: !(code === null || code === void 0 ? void 0 : code.length) && !(imageField === null || imageField === void 0 ? void 0 : imageField.value) })] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react';
|
|
2
2
|
import { DynamicFormI } from '../../../interfaces';
|
|
3
|
-
declare const _default: Meta
|
|
3
|
+
declare const _default: Meta<DynamicFormI>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const DynamicFormComponent: (args: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const DynamicUIFormComponent: (args: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,7 +19,8 @@ export default {
|
|
|
19
19
|
faker.image.urlPicsumPhotos(),
|
|
20
20
|
faker.image.urlPicsumPhotos(),
|
|
21
21
|
],
|
|
22
|
-
|
|
22
|
+
onAISend: action('onAiSend'),
|
|
23
|
+
onRemoveImage: action('onRemoveImage'),
|
|
23
24
|
onUpload: action('onUpload'),
|
|
24
25
|
menuItems: menuMock,
|
|
25
26
|
socialLinks: socialLinksMock,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useFormContext } from 'react-hook-form'
|
|
2
2
|
import { Flex, IconButton, Text } from '@chakra-ui/react'
|
|
3
|
-
import { IconTypes, AIGridFieldI } from '@/interfaces'
|
|
3
|
+
import { IconTypes, AIGridFieldI, AIFormI } from '@/interfaces'
|
|
4
4
|
import { TextField, SingleImage, Plus } from '@/components'
|
|
5
5
|
import { fieldIcons } from '@/helpers'
|
|
6
6
|
import { colors } from '@/theme/colors'
|
|
@@ -40,9 +40,12 @@ export const AIGridField = ({
|
|
|
40
40
|
const code = watch(String(textChild?.id))
|
|
41
41
|
|
|
42
42
|
const handleAISend = () => {
|
|
43
|
-
const form = {
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const form: AIFormI = {}
|
|
44
|
+
|
|
45
|
+
if (code) {
|
|
46
|
+
form.code = code
|
|
47
|
+
} else if (imageField?.value) {
|
|
48
|
+
form.image = imageField.value as string
|
|
46
49
|
}
|
|
47
50
|
onAISend?.(form)
|
|
48
51
|
}
|
|
@@ -21,13 +21,14 @@ export default {
|
|
|
21
21
|
faker.image.urlPicsumPhotos(),
|
|
22
22
|
faker.image.urlPicsumPhotos(),
|
|
23
23
|
],
|
|
24
|
-
|
|
24
|
+
onAISend: action('onAiSend'),
|
|
25
|
+
onRemoveImage: action('onRemoveImage'),
|
|
25
26
|
onUpload: action('onUpload'),
|
|
26
27
|
menuItems: menuMock,
|
|
27
28
|
socialLinks: socialLinksMock,
|
|
28
29
|
websiteUrl: 'http://www.audreyscheckdesign.com',
|
|
29
30
|
},
|
|
30
|
-
} as Meta
|
|
31
|
+
} as Meta<DynamicFormI>
|
|
31
32
|
|
|
32
33
|
export const DynamicFormComponent = (args: DynamicFormI) => {
|
|
33
34
|
return (
|