@homefile/components-v2 2.11.6 → 2.12.0
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/assets/locales/en/index.json +2 -1
- package/dist/components/forms/dynamicForm/DynamicForm.d.ts +1 -1
- package/dist/components/forms/dynamicForm/DynamicForm.js +5 -2
- package/dist/components/forms/dynamicForm/SearchItemLoader.d.ts +1 -0
- package/dist/components/forms/dynamicForm/SearchItemLoader.js +8 -0
- package/dist/components/forms/dynamicForm/index.d.ts +1 -0
- package/dist/components/forms/dynamicForm/index.js +1 -0
- package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +1 -0
- package/dist/stories/forms/dynamicForm/DynamicForm.stories.js +1 -1
- package/package.json +1 -1
- package/src/assets/locales/en/index.json +2 -1
- package/src/components/forms/dynamicForm/DynamicForm.tsx +6 -0
- package/src/components/forms/dynamicForm/SearchItemLoader.tsx +17 -0
- package/src/components/forms/dynamicForm/index.ts +1 -0
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +1 -0
- package/src/stories/forms/dynamicForm/DynamicForm.stories.tsx +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DynamicFormI } from '../../../interfaces';
|
|
2
|
-
export declare const DynamicForm: ({ callback, displayImages, form: fields, menuItems, onAISend, onRemoveImage, onUpload, showTitle, title, uploadingFieldId, ...props }: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DynamicForm: ({ callback, displayImages, form: fields, menuItems, onAISend, onRemoveImage, onUpload, searching, showTitle, title, uploadingFieldId, ...props }: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,12 +14,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import { FormProvider } from 'react-hook-form';
|
|
15
15
|
import { t } from 'i18next';
|
|
16
16
|
import { Box, Stack, Text } from '@chakra-ui/react';
|
|
17
|
-
import { HiddenFieldSection, GroupField, TextField, TextAreaField, SelectField, RatingField, GridField, FieldWithDelete, FileField, SwitchField, DateField, NumberField, CurrencyField, TileBody, CheckboxGroupField, CheckboxAgreement, AIGridField, } from '../..';
|
|
17
|
+
import { HiddenFieldSection, GroupField, TextField, TextAreaField, SelectField, RatingField, GridField, FieldWithDelete, FileField, SwitchField, DateField, NumberField, CurrencyField, TileBody, CheckboxGroupField, CheckboxAgreement, AIGridField, SearchItemLoader, } from '../..';
|
|
18
18
|
import { useDynamicForm } from '../../../hooks';
|
|
19
19
|
import { fieldIcons } from '../../../helpers';
|
|
20
20
|
export const DynamicForm = (_a) => {
|
|
21
|
-
var { callback, displayImages, form: fields, menuItems, onAISend, onRemoveImage, onUpload, showTitle = true, title, uploadingFieldId } = _a, props = __rest(_a, ["callback", "displayImages", "form", "menuItems", "onAISend", "onRemoveImage", "onUpload", "showTitle", "title", "uploadingFieldId"]);
|
|
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
|
+
if (searching) {
|
|
24
|
+
return _jsx(SearchItemLoader, {});
|
|
25
|
+
}
|
|
23
26
|
return (_jsxs(Stack, { bg: "lightBlue.1", spacing: "0", h: "full", overflowX: "hidden", children: [showTitle && (_jsx(Box, { px: "base", pt: "4", pb: "2", borderBottom: "1px dashed", borderColor: "lightBlue.6", children: _jsx(Text, { fontFamily: "secondary", children: title !== null && title !== void 0 ? title : t('forms.itemDetails') }) })), _jsx(FormProvider, Object.assign({}, form, { children: _jsx(_Fragment, { children: visibleFields === null || visibleFields === void 0 ? void 0 : visibleFields.map((field) => {
|
|
24
27
|
const { canBeHidden, children, description, icon, id, name, options, type, value, } = field;
|
|
25
28
|
const baseProps = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SearchItemLoader: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { t } from 'i18next';
|
|
3
|
+
import { Box, Text, Stack } from '@chakra-ui/react';
|
|
4
|
+
import { PuffLoader } from 'react-spinners';
|
|
5
|
+
import { colors } from '../../../theme/colors';
|
|
6
|
+
export const SearchItemLoader = () => {
|
|
7
|
+
return (_jsxs(Stack, { spacing: "base", align: "center", mt: "50px", children: [_jsx(PuffLoader, { color: colors.blue[1], size: 50 }), _jsx(Box, { w: "40%", children: _jsx(Text, { fontSize: "sm", textAlign: "center", children: t('dynamicForm.searching') }) })] }));
|
|
8
|
+
};
|
|
@@ -28,6 +28,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
|
|
|
28
28
|
onAISend?: AIGridFieldI['onAISend'];
|
|
29
29
|
onRemoveImage?: (file: string) => void;
|
|
30
30
|
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void;
|
|
31
|
+
searching?: boolean;
|
|
31
32
|
showTitle?: boolean;
|
|
32
33
|
title?: string;
|
|
33
34
|
uploadingFieldId?: string;
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
export const DynamicFormComponent = (args) => {
|
|
31
|
-
return (_jsx(Box, { p: "base", bg: "neutral.white", w: ['full', '500px'], children: _jsx(DynamicForm, Object.assign({}, args, { form: formFieldsMock, showTitle: false })) }));
|
|
31
|
+
return (_jsx(Box, { p: "base", bg: "neutral.white", w: ['full', '500px'], minH: "500px", children: _jsx(DynamicForm, Object.assign({}, args, { form: formFieldsMock, showTitle: false })) }));
|
|
32
32
|
};
|
|
33
33
|
export const DynamicUIFormComponent = (args) => {
|
|
34
34
|
return (_jsx(Box, { m: "base", w: ['full', '320px'], children: _jsx(DynamicForm, Object.assign({}, args, { form: tileUIMock, showTitle: false, callback: action('callback') })) }));
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
CheckboxGroupField,
|
|
21
21
|
CheckboxAgreement,
|
|
22
22
|
AIGridField,
|
|
23
|
+
SearchItemLoader,
|
|
23
24
|
} from '@/components'
|
|
24
25
|
import { useDynamicForm } from '@/hooks'
|
|
25
26
|
import { fieldIcons } from '@/helpers'
|
|
@@ -32,6 +33,7 @@ export const DynamicForm = ({
|
|
|
32
33
|
onAISend,
|
|
33
34
|
onRemoveImage,
|
|
34
35
|
onUpload,
|
|
36
|
+
searching = false,
|
|
35
37
|
showTitle = true,
|
|
36
38
|
title,
|
|
37
39
|
uploadingFieldId,
|
|
@@ -47,6 +49,10 @@ export const DynamicForm = ({
|
|
|
47
49
|
handleRemove,
|
|
48
50
|
} = useDynamicForm({ fields, onUpload })
|
|
49
51
|
|
|
52
|
+
if (searching) {
|
|
53
|
+
return <SearchItemLoader />
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
return (
|
|
51
57
|
<Stack bg="lightBlue.1" spacing="0" h="full" overflowX="hidden">
|
|
52
58
|
{showTitle && (
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t } from 'i18next'
|
|
2
|
+
import { Box, Text, Stack } from '@chakra-ui/react'
|
|
3
|
+
import { PuffLoader } from 'react-spinners'
|
|
4
|
+
import { colors } from '@/theme/colors'
|
|
5
|
+
|
|
6
|
+
export const SearchItemLoader = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Stack spacing="base" align="center" mt="50px">
|
|
9
|
+
<PuffLoader color={colors.blue[1]} size={50} />
|
|
10
|
+
<Box w="40%">
|
|
11
|
+
<Text fontSize="sm" textAlign="center">
|
|
12
|
+
{t('dynamicForm.searching')}
|
|
13
|
+
</Text>
|
|
14
|
+
</Box>
|
|
15
|
+
</Stack>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -136,6 +136,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
|
|
|
136
136
|
onAISend?: AIGridFieldI['onAISend']
|
|
137
137
|
onRemoveImage?: (file: string) => void
|
|
138
138
|
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void
|
|
139
|
+
searching?: boolean
|
|
139
140
|
showTitle?: boolean
|
|
140
141
|
title?: string
|
|
141
142
|
uploadingFieldId?: string
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
|
|
33
33
|
export const DynamicFormComponent = (args: DynamicFormI) => {
|
|
34
34
|
return (
|
|
35
|
-
<Box p="base" bg="neutral.white" w={['full', '500px']}>
|
|
35
|
+
<Box p="base" bg="neutral.white" w={['full', '500px']} minH="500px">
|
|
36
36
|
<DynamicForm {...args} form={formFieldsMock} showTitle={false} />
|
|
37
37
|
</Box>
|
|
38
38
|
)
|