@homefile/components-v2 2.14.23 → 2.14.24
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/DynamicForm.js +0 -1
- package/dist/components/forms/dynamicForm/fields/AIGridField.js +0 -1
- package/dist/components/forms/dynamicForm/fields/SingleImage.js +0 -1
- package/dist/hooks/forms/useDynamicForm.js +1 -0
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/DynamicForm.tsx +1 -1
- package/src/components/forms/dynamicForm/fields/AIGridField.tsx +1 -1
- package/src/components/forms/dynamicForm/fields/SingleImage.tsx +0 -2
- package/src/hooks/forms/useDynamicForm.ts +1 -0
|
@@ -20,7 +20,6 @@ import { fieldIcons } from '../../../helpers';
|
|
|
20
20
|
export const DynamicForm = (_a) => {
|
|
21
21
|
var { callback, displayImages, form: fields, menuItems, onAISend, onRemoveImage, onUpload, searching = false, showTitle = true, title, uploadingFieldId } = _a, props = __rest(_a, ["callback", "displayImages", "form", "menuItems", "onAISend", "onRemoveImage", "onUpload", "searching", "showTitle", "title", "uploadingFieldId"]);
|
|
22
22
|
const { form, visibleFields, hiddenFields, handleAddAll, handleAdd, handleFilesUpload, handleRemove, } = useDynamicForm({ fields, onUpload });
|
|
23
|
-
console.log('visible fields', visibleFields);
|
|
24
23
|
if (searching) {
|
|
25
24
|
return _jsx(SearchItemLoader, {});
|
|
26
25
|
}
|
|
@@ -9,7 +9,6 @@ export const AIGridField = ({ children, onAISend, onRemove, onUpload, }) => {
|
|
|
9
9
|
var _a, _b, _c, _d, _e, _f;
|
|
10
10
|
const [file, setFile] = useState(undefined);
|
|
11
11
|
const { watch } = useFormContext();
|
|
12
|
-
console.log('children', children);
|
|
13
12
|
const textChild = children === null || children === void 0 ? void 0 : children.find(({ type }) => type === 'text' || type === 'string');
|
|
14
13
|
const textProps = {
|
|
15
14
|
id: (_a = textChild === null || textChild === void 0 ? void 0 : textChild.id) !== null && _a !== void 0 ? _a : '',
|
|
@@ -13,6 +13,5 @@ export const SingleImage = ({ onRemove, onUpload, uploading = false, value, }) =
|
|
|
13
13
|
onUpload === null || onUpload === void 0 ? void 0 : onUpload(selectedFiles);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
console.log('img', value);
|
|
17
16
|
return (_jsxs(Flex, { gap: "2", align: "center", h: "input.md", children: [_jsx(MobileFileUploader, { handleInputChange: handleInputChange, "aria-label": "upload image", minW: "72px" }), value && (_jsxs(Box, { position: "relative", minW: "30px", children: [_jsx(IconButton, { variant: "ghost", "aria-label": "close", maxW: "fit-content", onClick: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(value), icon: _jsx(Close, { size: 11, stroke: colors.error['2'] }), disabled: uploading, position: "absolute", bg: "neutral.white", p: "0.5", borderRadius: "full", top: "-2", right: "-2", zIndex: "1" }), _jsx(AspectRatio, { maxW: "100%", ratio: 1, children: _jsx(Image, { src: value, objectFit: "cover", alt: "image" }) })] }))] }));
|
|
18
17
|
};
|
|
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { useForm } from 'react-hook-form';
|
|
3
3
|
import { dynamicFormProxy } from '../../proxies';
|
|
4
4
|
export const useDynamicForm = ({ fields, onUpload }) => {
|
|
5
|
+
console.log('fields', fields);
|
|
5
6
|
const [stateFields, setStateFields] = useState(fields);
|
|
6
7
|
const visibleFields = stateFields.filter((field) => field.visible || field.visible === undefined);
|
|
7
8
|
const hiddenFields = stateFields.filter((field) => field.visible === false);
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ export const AIGridField = ({
|
|
|
14
14
|
}: AIGridFieldI) => {
|
|
15
15
|
const [file, setFile] = useState<FolderFileI | undefined>(undefined)
|
|
16
16
|
const { watch } = useFormContext()
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
const textChild = children?.find(
|
|
19
19
|
({ type }) => type === 'text' || type === 'string'
|
|
20
20
|
)
|
|
@@ -14,6 +14,7 @@ interface UseDynamicFormI {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const useDynamicForm = ({ fields, onUpload }: UseDynamicFormI) => {
|
|
17
|
+
console.log('fields', fields)
|
|
17
18
|
const [stateFields, setStateFields] = useState(fields)
|
|
18
19
|
const visibleFields = stateFields.filter(
|
|
19
20
|
(field) => field.visible || field.visible === undefined
|