@homefile/components-v2 2.14.20 → 2.14.22

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,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
2
  import { useFormContext } from 'react-hook-form';
4
3
  import { Flex, IconButton, Text } from '@chakra-ui/react';
5
4
  import { TextField, SingleImage, Plus } from '../../..';
@@ -19,10 +18,8 @@ export const AIGridField = ({ children, onAISend, onRemove, onUpload, }) => {
19
18
  ? fieldIcons[textChild.icon]
20
19
  : undefined,
21
20
  };
22
- const imageField = useMemo(() => {
23
- return children === null || children === void 0 ? void 0 : children.find(({ type }) => type === 'ai-image');
24
- }, [children]);
25
- // const imageField = children?.find(({ type }) => type === 'ai-image')
21
+ const imageField = children === null || children === void 0 ? void 0 : children.find(({ type }) => type === 'ai-image');
22
+ console.log('image field', imageField);
26
23
  const imageProps = {
27
24
  id: (_d = imageField === null || imageField === void 0 ? void 0 : imageField.id) !== null && _d !== void 0 ? _d : '',
28
25
  value: (_e = imageField === null || imageField === void 0 ? void 0 : imageField.value) !== null && _e !== void 0 ? _e : '',
@@ -13,5 +13,6 @@ 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);
16
17
  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" }) })] }))] }));
17
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.14.20",
3
+ "version": "2.14.22",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -1,4 +1,3 @@
1
- import { useMemo } from 'react'
2
1
  import { useFormContext } from 'react-hook-form'
3
2
  import { Flex, IconButton, Text } from '@chakra-ui/react'
4
3
  import { IconTypes, AIGridFieldI, AIFormI, FolderFileI } from '@/interfaces'
@@ -29,12 +28,8 @@ export const AIGridField = ({
29
28
  : undefined,
30
29
  }
31
30
 
32
- const imageField = useMemo(() => {
33
- return children?.find(({ type }) => type === 'ai-image');
34
- }, [children])
35
-
36
- // const imageField = children?.find(({ type }) => type === 'ai-image')
37
-
31
+ const imageField = children?.find(({ type }) => type === 'ai-image')
32
+ console.log('image field', imageField)
38
33
  const imageProps = {
39
34
  id: imageField?.id ?? '',
40
35
  value: imageField?.value ?? '',
@@ -20,6 +20,8 @@ export const SingleImage = ({
20
20
  }
21
21
  }
22
22
 
23
+ console.log('img', value)
24
+
23
25
  return (
24
26
  <Flex gap="2" align="center" h="input.md">
25
27
  <MobileFileUploader