@homefile/components-v2 2.23.12 → 2.24.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/components/forms/dynamicForm/DynamicForm.d.ts +1 -1
- package/dist/components/forms/dynamicForm/DynamicForm.js +2 -2
- package/dist/components/forms/dynamicForm/fields/TextField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/TextField.js +6 -6
- package/dist/components/headers/GenericBackHeader.js +3 -0
- package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +1 -0
- package/dist/interfaces/forms/dynamicForm/fields/TextField.interface.d.ts +1 -0
- package/dist/interfaces/headers/GenericBackHeader.interface.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/DynamicForm.tsx +6 -1
- package/src/components/forms/dynamicForm/fields/TextField.tsx +4 -1
- package/src/components/headers/GenericBackHeader.tsx +7 -0
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +1 -0
- package/src/interfaces/forms/dynamicForm/fields/TextField.interface.ts +1 -0
- package/src/interfaces/headers/GenericBackHeader.interface.ts +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DynamicFormI } from '../../../interfaces';
|
|
2
|
-
export declare const DynamicForm: ({ callback, displayImages, form: fields, menuItems, onAISend, onRemoveImage, onUpload, searching, showTitle, singleFileUpload, 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, showIcon, singleFileUpload, title, uploadingFieldId, ...props }: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,7 +18,7 @@ import { HiddenFieldSection, GroupField, TextField, TextAreaField, SelectField,
|
|
|
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, searching = false, showTitle = true, singleFileUpload, title, uploadingFieldId } = _a, props = __rest(_a, ["callback", "displayImages", "form", "menuItems", "onAISend", "onRemoveImage", "onUpload", "searching", "showTitle", "singleFileUpload", "title", "uploadingFieldId"]);
|
|
21
|
+
var { callback, displayImages, form: fields, menuItems, onAISend, onRemoveImage, onUpload, searching = false, showTitle = true, showIcon = false, singleFileUpload, title, uploadingFieldId } = _a, props = __rest(_a, ["callback", "displayImages", "form", "menuItems", "onAISend", "onRemoveImage", "onUpload", "searching", "showTitle", "showIcon", "singleFileUpload", "title", "uploadingFieldId"]);
|
|
22
22
|
const { form, visibleFields, hiddenFields, handleAddAll, handleAdd, handleFilesUpload, handleRemove, } = useDynamicForm({ fields, onUpload });
|
|
23
23
|
if (searching) {
|
|
24
24
|
return _jsx(SearchItemLoader, {});
|
|
@@ -43,7 +43,7 @@ export const DynamicForm = (_a) => {
|
|
|
43
43
|
_jsx(DateField, Object.assign({}, baseProps, { name: name }))));
|
|
44
44
|
case 'email':
|
|
45
45
|
return (_createElement(FieldWithDelete, Object.assign({}, fieldWithDeleteBaseProps, { key: id }),
|
|
46
|
-
_jsx(TextField, Object.assign({}, baseProps, { type: "email" }))));
|
|
46
|
+
_jsx(TextField, Object.assign({}, baseProps, { type: "email", showIcon: showIcon }))));
|
|
47
47
|
case 'number':
|
|
48
48
|
return (_createElement(FieldWithDelete, Object.assign({}, fieldWithDeleteBaseProps, { key: id }),
|
|
49
49
|
_jsx(NumberField, Object.assign({}, baseProps))));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TextFieldI } from '../../../../interfaces';
|
|
2
|
-
export declare const TextField: ({ id, placeholder, label, type, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TextField: ({ id, icon, placeholder, label, type, showIcon, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
3
3
|
import { Flex } from '@chakra-ui/react';
|
|
4
|
-
import { TextInput } from '../../..';
|
|
5
|
-
export const TextField = ({ id, placeholder = '', label, type = 'text', value, }) => {
|
|
4
|
+
import { FormIcon, TextInput } from '../../..';
|
|
5
|
+
export const TextField = ({ id, icon, placeholder = '', label, type = 'text', showIcon = false, value, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
|
-
return (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [showIcon && icon && _jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
+
return (_jsx(TextInput, { handleChange: onChange, placeholder: placeholder, type: type, value: value, label: label }));
|
|
9
|
+
} })] }));
|
|
10
10
|
};
|
|
@@ -2,5 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text, Flex, Box, Show, Tooltip } from '@chakra-ui/react';
|
|
3
3
|
import { BackCircleButton } from '..';
|
|
4
4
|
export const GenericBackHeader = ({ handleClick, label, backLabel, }) => {
|
|
5
|
+
if (!label) {
|
|
6
|
+
return (_jsx(Box, { p: "base", children: _jsx(BackCircleButton, { onClick: handleClick }) }));
|
|
7
|
+
}
|
|
5
8
|
return (_jsx(Flex, { align: "center", justify: "space-between", children: _jsxs(Flex, { align: "center", gap: "2", children: [_jsx(Tooltip, { hasArrow: true, isDisabled: false, label: backLabel, placement: "right", children: _jsx(Box, { children: _jsx(BackCircleButton, { onClick: handleClick }) }) }), _jsx(Show, { breakpoint: "(min-width: 400px)", children: _jsx(Box, { borderLeft: "solid", borderWidth: "1px", borderColor: "divider", h: "1.75rem", mx: "2" }) }), _jsx(Show, { breakpoint: "(min-width: 500px)", children: _jsx(Text, { variant: "title", children: label }) })] }) }));
|
|
6
9
|
};
|
|
@@ -31,6 +31,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
|
|
|
31
31
|
onUpload?: (filesByFieldId: Record<string, FolderFileI[] | File[]>) => void;
|
|
32
32
|
searching?: boolean;
|
|
33
33
|
showTitle?: boolean;
|
|
34
|
+
showIcon?: boolean;
|
|
34
35
|
singleFileUpload?: boolean;
|
|
35
36
|
title?: string;
|
|
36
37
|
uploadingFieldId?: string;
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@ export const DynamicForm = ({
|
|
|
35
35
|
onUpload,
|
|
36
36
|
searching = false,
|
|
37
37
|
showTitle = true,
|
|
38
|
+
showIcon = false,
|
|
38
39
|
singleFileUpload,
|
|
39
40
|
title,
|
|
40
41
|
uploadingFieldId,
|
|
@@ -106,7 +107,11 @@ export const DynamicForm = ({
|
|
|
106
107
|
case 'email':
|
|
107
108
|
return (
|
|
108
109
|
<FieldWithDelete {...fieldWithDeleteBaseProps} key={id}>
|
|
109
|
-
<TextField
|
|
110
|
+
<TextField
|
|
111
|
+
{...baseProps}
|
|
112
|
+
type="email"
|
|
113
|
+
showIcon={showIcon}
|
|
114
|
+
/>
|
|
110
115
|
</FieldWithDelete>
|
|
111
116
|
)
|
|
112
117
|
case 'number':
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
2
|
import { Flex } from '@chakra-ui/react'
|
|
3
|
-
import { TextInput } from '@/components'
|
|
3
|
+
import { FormIcon, TextInput } from '@/components'
|
|
4
4
|
import { TextFieldI } from '@/interfaces'
|
|
5
5
|
|
|
6
6
|
export const TextField = ({
|
|
7
7
|
id,
|
|
8
|
+
icon,
|
|
8
9
|
placeholder = '',
|
|
9
10
|
label,
|
|
10
11
|
type = 'text',
|
|
12
|
+
showIcon = false,
|
|
11
13
|
value,
|
|
12
14
|
}: TextFieldI) => {
|
|
13
15
|
const { control } = useFormContext()
|
|
14
16
|
return (
|
|
15
17
|
<Flex align="center" gap="base" flex="auto">
|
|
18
|
+
{showIcon && icon && <FormIcon icon={icon} />}
|
|
16
19
|
<Controller
|
|
17
20
|
control={control}
|
|
18
21
|
name={id}
|
|
@@ -7,6 +7,13 @@ export const GenericBackHeader = ({
|
|
|
7
7
|
label,
|
|
8
8
|
backLabel,
|
|
9
9
|
}: GenericBackHeaderI) => {
|
|
10
|
+
if (!label) {
|
|
11
|
+
return (
|
|
12
|
+
<Box p="base">
|
|
13
|
+
<BackCircleButton onClick={handleClick} />
|
|
14
|
+
</Box>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
10
17
|
return (
|
|
11
18
|
<Flex align="center" justify="space-between">
|
|
12
19
|
<Flex align="center" gap="2">
|
|
@@ -155,6 +155,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
|
|
|
155
155
|
onUpload?: (filesByFieldId: Record<string, FolderFileI[] | File[]>) => void
|
|
156
156
|
searching?: boolean
|
|
157
157
|
showTitle?: boolean
|
|
158
|
+
showIcon?: boolean
|
|
158
159
|
singleFileUpload?: boolean
|
|
159
160
|
title?: string
|
|
160
161
|
uploadingFieldId?: string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface GenericBackHeaderI {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
handleClick: () => void
|
|
3
|
+
label?: string
|
|
4
|
+
backLabel?: string
|
|
5
|
+
}
|