@homefile/components-v2 2.14.1 → 2.14.2
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 +1 -0
- package/dist/components/forms/dynamicForm/fields/CurrencyField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/CurrencyField.js +2 -2
- package/dist/components/forms/dynamicForm/fields/DateField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/DateField.js +2 -2
- package/dist/components/forms/dynamicForm/fields/GridField.js +2 -1
- package/dist/components/forms/dynamicForm/fields/LabeledField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/NumberField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/NumberField.js +2 -2
- package/dist/components/forms/dynamicForm/fields/SelectField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/SelectField.js +2 -2
- package/dist/components/forms/dynamicForm/fields/SingleFields.js +1 -0
- package/dist/components/forms/dynamicForm/fields/TextAreaField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/TextAreaField.js +2 -2
- package/dist/components/forms/dynamicForm/fields/TextField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/TextField.js +2 -2
- package/dist/components/inputs/DatePicker.d.ts +1 -1
- package/dist/components/inputs/DatePicker.js +2 -2
- package/dist/components/inputs/SelectInput.d.ts +1 -1
- package/dist/components/inputs/SelectInput.js +2 -2
- package/dist/components/inputs/TextInput.d.ts +1 -1
- package/dist/components/inputs/TextInput.js +2 -2
- package/dist/interfaces/forms/dynamicForm/fields/DateField.interface.d.ts +1 -0
- package/dist/interfaces/forms/dynamicForm/fields/SelectField.interface.d.ts +1 -0
- package/dist/interfaces/forms/dynamicForm/fields/TextAreaField.interface.d.ts +1 -0
- package/dist/interfaces/forms/dynamicForm/fields/TextField.interface.d.ts +1 -0
- package/dist/interfaces/inputs/DatePicker.interface.d.ts +1 -0
- package/dist/interfaces/inputs/Input.interface.d.ts +1 -0
- package/dist/interfaces/inputs/Select.interface.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/DynamicForm.tsx +1 -0
- package/src/components/forms/dynamicForm/fields/CurrencyField.tsx +9 -3
- package/src/components/forms/dynamicForm/fields/DateField.tsx +2 -0
- package/src/components/forms/dynamicForm/fields/GridField.tsx +2 -1
- package/src/components/forms/dynamicForm/fields/LabeledField.tsx +1 -1
- package/src/components/forms/dynamicForm/fields/NumberField.tsx +3 -10
- package/src/components/forms/dynamicForm/fields/SelectField.tsx +3 -3
- package/src/components/forms/dynamicForm/fields/SingleFields.tsx +1 -0
- package/src/components/forms/dynamicForm/fields/TextAreaField.tsx +3 -4
- package/src/components/forms/dynamicForm/fields/TextField.tsx +2 -1
- package/src/components/inputs/DatePicker.tsx +2 -1
- package/src/components/inputs/SelectInput.tsx +2 -3
- package/src/components/inputs/TextInput.tsx +2 -1
- package/src/interfaces/forms/dynamicForm/fields/DateField.interface.ts +1 -0
- package/src/interfaces/forms/dynamicForm/fields/SelectField.interface.ts +1 -0
- package/src/interfaces/forms/dynamicForm/fields/TextAreaField.interface.ts +1 -0
- package/src/interfaces/forms/dynamicForm/fields/TextField.interface.ts +1 -0
- package/src/interfaces/inputs/DatePicker.interface.ts +1 -0
- package/src/interfaces/inputs/Input.interface.ts +1 -0
- package/src/interfaces/inputs/Select.interface.ts +1 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TextFieldI } from '../../../../interfaces';
|
|
2
|
-
export declare const CurrencyField: ({ id, icon, placeholder, value }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const CurrencyField: ({ label, id, icon, placeholder, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { Controller, useFormContext } from 'react-hook-form';
|
|
|
3
3
|
import { Flex, Input } from '@chakra-ui/react';
|
|
4
4
|
import { FormIcon, LabeledField } from '../../..';
|
|
5
5
|
import { formatCurrency } from '../../../../utils';
|
|
6
|
-
export const CurrencyField = ({ id, icon, placeholder, value }) => {
|
|
6
|
+
export const CurrencyField = ({ label, id, icon, placeholder, value, }) => {
|
|
7
7
|
const { control } = useFormContext();
|
|
8
8
|
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [_jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
9
9
|
const handleChange = (e) => {
|
|
@@ -12,6 +12,6 @@ export const CurrencyField = ({ id, icon, placeholder, value }) => {
|
|
|
12
12
|
const currency = formatCurrency({ value: number });
|
|
13
13
|
onChange(currency);
|
|
14
14
|
};
|
|
15
|
-
return (_jsx(LabeledField, { label:
|
|
15
|
+
return (_jsx(LabeledField, { label: label, children: _jsx(Input, { onChange: handleChange, placeholder: placeholder, textAlign: "right", value: value, _placeholder: { color: 'gray.2' } }) }));
|
|
16
16
|
} })] }));
|
|
17
17
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DateFieldI } from '../../../../interfaces';
|
|
2
|
-
export declare const DateField: ({ id, icon, name, placeholder, showCalendarIcon, value, width, }: DateFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DateField: ({ id, icon, name, placeholder, label, showCalendarIcon, value, width, }: DateFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
3
3
|
import { Flex, Text } from '@chakra-ui/react';
|
|
4
4
|
import { DatePicker, FormIcon } from '../../..';
|
|
5
|
-
export const DateField = ({ id, icon, name, placeholder, showCalendarIcon = true, value, width, }) => {
|
|
5
|
+
export const DateField = ({ id, icon, name, placeholder, label, showCalendarIcon = true, value, width, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
7
|
return (_jsxs(Flex, { align: "center", gap: "base", w: "full", children: [name && (_jsxs(Flex, { align: "center", gap: "base", flexShrink: 0, children: [_jsx(FormIcon, { icon: icon }), _jsx(Text, { fontFamily: "secondary", noOfLines: 1, overflow: "hidden", children: name })] })), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
-
return (_jsx(DatePicker, { onChange: onChange, showCalendarIcon: showCalendarIcon, placeholder: name ? '' : placeholder, value: value, width: width }));
|
|
8
|
+
return (_jsx(DatePicker, { onChange: onChange, showCalendarIcon: showCalendarIcon, placeholder: name ? '' : placeholder, value: value, width: width, label: label }));
|
|
9
9
|
} })] }));
|
|
10
10
|
};
|
|
@@ -8,7 +8,8 @@ export const GridField = ({ children, onRemove, onUpload }) => {
|
|
|
8
8
|
const baseProps = {
|
|
9
9
|
id,
|
|
10
10
|
value,
|
|
11
|
-
placeholder: name && name !==
|
|
11
|
+
placeholder: name !== null && name !== void 0 ? name : description,
|
|
12
|
+
label: name !== null && name !== void 0 ? name : description,
|
|
12
13
|
icon: icon ? fieldIcons[icon] : undefined,
|
|
13
14
|
};
|
|
14
15
|
switch (type) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TextFieldI } from '../../../../interfaces';
|
|
2
|
-
export declare const NumberField: ({
|
|
2
|
+
export declare const NumberField: ({ id, label, placeholder, value }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
3
3
|
import { Flex, Input } from '@chakra-ui/react';
|
|
4
4
|
import { LabeledField } from '../../..';
|
|
5
|
-
export const NumberField = ({
|
|
5
|
+
export const NumberField = ({ id, label, placeholder, value }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
7
|
return (_jsx(Flex, { align: "center", gap: "base", flex: "auto", children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
-
return (_jsx(LabeledField, { label:
|
|
8
|
+
return (_jsx(LabeledField, { label: label, children: _jsx(Input, { onChange: (e) => {
|
|
9
9
|
const value = e.target.valueAsNumber;
|
|
10
10
|
const isNumber = !isNaN(value);
|
|
11
11
|
if (!isNumber) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SelectFieldI } from '../../../../interfaces';
|
|
2
|
-
export declare const SelectField: ({ description, id,
|
|
2
|
+
export declare const SelectField: ({ description, id, label, options, placeholder, value, }: SelectFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
3
3
|
import { Box, Flex } from '@chakra-ui/react';
|
|
4
4
|
import { SelectInput } from '../../..';
|
|
5
|
-
export const SelectField = ({ description, id,
|
|
5
|
+
export const SelectField = ({ description, id, label, options, placeholder, value, }) => {
|
|
6
6
|
var _a;
|
|
7
7
|
const { control } = useFormContext();
|
|
8
8
|
const stringOptions = (_a = options === null || options === void 0 ? void 0 : options.map((option) => String(option))) !== null && _a !== void 0 ? _a : [];
|
|
9
9
|
return (_jsx(Flex, { align: "start", gap: "base", flex: "auto", w: description ? '100%' : '40%', children: _jsx(Box, { w: description ? '102px' : '100%', children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
10
|
-
return (_jsx(SelectInput, { handleClick: onChange, height: "md", initialValue: value !== null && value !== void 0 ? value : stringOptions[0], items: stringOptions, placeholder: !description ? placeholder : '', width: "100%" }));
|
|
10
|
+
return (_jsx(SelectInput, { handleClick: onChange, height: "md", initialValue: value !== null && value !== void 0 ? value : stringOptions[0], items: stringOptions, placeholder: !description ? placeholder : '', label: label, width: "100%" }));
|
|
11
11
|
} }) }) }));
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TextAreaFieldI } from '../../../../interfaces';
|
|
2
2
|
import 'react-quill-new/dist/quill.snow.css';
|
|
3
3
|
import '../../../../styles/quill.css';
|
|
4
|
-
export declare const TextAreaField: ({ id,
|
|
4
|
+
export declare const TextAreaField: ({ id, label, placeholder, value, }: TextAreaFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,10 +5,10 @@ import QuillEditor from 'react-quill-new';
|
|
|
5
5
|
import 'react-quill-new/dist/quill.snow.css';
|
|
6
6
|
import '../../../../styles/quill.css';
|
|
7
7
|
import { LabeledField } from './LabeledField';
|
|
8
|
-
export const TextAreaField = ({ id,
|
|
8
|
+
export const TextAreaField = ({ id, label, placeholder = '', value, }) => {
|
|
9
9
|
const { control } = useFormContext();
|
|
10
10
|
return (_jsx(Flex, { gap: "base", align: "start", flex: "auto", children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
11
|
-
return (_jsx(LabeledField, { label:
|
|
11
|
+
return (_jsx(LabeledField, { label: label, children: _jsx(QuillEditor, { theme: "snow", value: value, formats: formats, modules: { toolbar }, onChange: onChange, placeholder: placeholder }) }));
|
|
12
12
|
} }) }));
|
|
13
13
|
};
|
|
14
14
|
const formats = [
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TextFieldI } from '../../../../interfaces';
|
|
2
|
-
export declare const TextField: ({ id,
|
|
2
|
+
export declare const TextField: ({ id, placeholder, label, type, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
3
3
|
import { Flex } from '@chakra-ui/react';
|
|
4
4
|
import { TextInput } from '../../..';
|
|
5
|
-
export const TextField = ({ id,
|
|
5
|
+
export const TextField = ({ id, placeholder = '', label, type = 'text', value, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
7
|
return (_jsx(Flex, { align: "center", gap: "base", flex: "auto", children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
-
return (_jsx(TextInput, { handleChange: onChange, placeholder: placeholder, type: type, value: value }));
|
|
8
|
+
return (_jsx(TextInput, { handleChange: onChange, placeholder: placeholder, type: type, value: value, label: label }));
|
|
9
9
|
} }) }));
|
|
10
10
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
2
2
|
import '../../styles/calendar.css';
|
|
3
3
|
import { DatePickerI } from '../../interfaces';
|
|
4
|
-
export declare const DatePicker: ({ onChange, placeholder, showCalendarIcon, value, width, }: DatePickerI) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const DatePicker: ({ onChange, placeholder, label, showCalendarIcon, value, width, }: DatePickerI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,7 @@ import { Flex, IconButton, Input } from '@chakra-ui/react';
|
|
|
7
7
|
import { Calendar as CalendarIcon, LabeledField } from '..';
|
|
8
8
|
import { colors } from '../../theme/colors';
|
|
9
9
|
import { extractDayMonthYear, joinDayMonthYear } from '../../utils';
|
|
10
|
-
export const DatePicker = ({ onChange, placeholder, showCalendarIcon, value, width = '290px', }) => {
|
|
10
|
+
export const DatePicker = ({ onChange, placeholder, label, showCalendarIcon, value, width = '290px', }) => {
|
|
11
11
|
const formatedValue = extractDayMonthYear(value);
|
|
12
12
|
const [day, setDay] = useState(formatedValue
|
|
13
13
|
? new Date(formatedValue.year, formatedValue.month - 1, formatedValue.day)
|
|
@@ -38,7 +38,7 @@ export const DatePicker = ({ onChange, placeholder, showCalendarIcon, value, wid
|
|
|
38
38
|
}
|
|
39
39
|
}, [value]);
|
|
40
40
|
const renderCustomInput = () => {
|
|
41
|
-
return (_jsxs(Flex, { gap: "base", w: width, children: [_jsx(LabeledField, { label:
|
|
41
|
+
return (_jsxs(Flex, { gap: "base", w: width, children: [_jsx(LabeledField, { label: label, children: _jsx(Input, { placeholder: placeholder || 'MM/DD/YYYY', onChange: handleInputChange, _placeholder: { color: 'gray.2' }, value: value }) }), showCalendarIcon && (_jsx(IconButton, { "aria-label": "Calendar icon", variant: "iconOutlined", icon: _jsx(CalendarIcon, { size: 28, stroke: colors.blue[3] }), maxH: "input.md", flexShrink: 0 }))] }));
|
|
42
42
|
};
|
|
43
43
|
return (_jsx(DatePickerComponent, { selected: day, onChange: handleOnChange, customInput: renderCustomInput(), calendarClassName: "custom-calendar" }));
|
|
44
44
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SelectI } from '../../interfaces';
|
|
2
|
-
export declare const SelectInput: ({ filterValue, handleClick, handleFilter, hasFilter, height, initialValue, isDisabled, items,
|
|
2
|
+
export declare const SelectInput: ({ filterValue, handleClick, handleFilter, hasFilter, height, initialValue, isDisabled, items, label, variant, width, }: SelectI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,12 +5,12 @@ import { Menu, Text, Input, InputGroup, InputRightElement, Box, } from '@chakra-
|
|
|
5
5
|
import { textOptionVariants } from '../../helpers';
|
|
6
6
|
import { LabeledField, SearchIcon, SelectButton, SelectItem, SelectList, } from '..';
|
|
7
7
|
import { colors } from '../../theme/colors';
|
|
8
|
-
export const SelectInput = ({ filterValue = '', handleClick, handleFilter = () => null, hasFilter, height = 'sm', initialValue = 'All', isDisabled, items,
|
|
8
|
+
export const SelectInput = ({ filterValue = '', handleClick, handleFilter = () => null, hasFilter, height = 'sm', initialValue = 'All', isDisabled, items, label, variant = 'primary', width = '10rem', }) => {
|
|
9
9
|
const [selectedValue, setSelectedValue] = useState(initialValue);
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
setSelectedValue(initialValue);
|
|
12
12
|
}, [initialValue]);
|
|
13
|
-
return (_jsxs(Menu, { children: [_jsx(LabeledField, { label:
|
|
13
|
+
return (_jsxs(Menu, { children: [_jsx(LabeledField, { label: label, children: _jsx(Box, { w: "100%", children: _jsx(SelectButton, { selectedValue: selectedValue, height: height, isDisabled: isDisabled, variant: variant, width: width }) }) }), _jsxs(SelectList, { children: [hasFilter && (_jsxs(InputGroup, { size: "md", w: "100%", px: "2", pb: "2", children: [_jsx(Input, { variant: "filled", bg: "lightBlue.2", pr: "4.5rem", placeholder: t('forms.search'), value: String(filterValue), onChange: handleFilter }), _jsx(InputRightElement, { mr: "base", children: _jsx(SearchIcon, { size: 26, stroke: colors.gray[3] }) })] })), items === null || items === void 0 ? void 0 : items.map((item) => {
|
|
14
14
|
const isSelectItem = typeof item === 'object';
|
|
15
15
|
const id = isSelectItem ? item._id : item;
|
|
16
16
|
const name = isSelectItem ? item.name : item;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { InputI } from '../../interfaces';
|
|
2
|
-
export declare const TextInput: ({ autoCapitalize, autoCorrect, errorMessage, handleChange, hasError, id, isDisabled, placeholder, value, type, ...props }: InputI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TextInput: ({ autoCapitalize, autoCorrect, errorMessage, handleChange, hasError, id, isDisabled, label, placeholder, value, type, ...props }: InputI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { FormControl, Text, Input } from '@chakra-ui/react';
|
|
14
14
|
import { LabeledField } from '..';
|
|
15
15
|
export const TextInput = (_a) => {
|
|
16
|
-
var { autoCapitalize = 'on', autoCorrect = 'on', errorMessage, handleChange, hasError, id, isDisabled, placeholder, value = '', type = 'text' } = _a, props = __rest(_a, ["autoCapitalize", "autoCorrect", "errorMessage", "handleChange", "hasError", "id", "isDisabled", "placeholder", "value", "type"]);
|
|
16
|
+
var { autoCapitalize = 'on', autoCorrect = 'on', errorMessage, handleChange, hasError, id, isDisabled, label, placeholder, value = '', type = 'text' } = _a, props = __rest(_a, ["autoCapitalize", "autoCorrect", "errorMessage", "handleChange", "hasError", "id", "isDisabled", "label", "placeholder", "value", "type"]);
|
|
17
17
|
const error = hasError && !isDisabled;
|
|
18
|
-
return (_jsxs(FormControl, { isInvalid: error, children: [_jsx(LabeledField, { label:
|
|
18
|
+
return (_jsxs(FormControl, { isInvalid: error, children: [_jsx(LabeledField, { label: label, children: _jsx(Input, Object.assign({}, props, { autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, id: id, placeholder: placeholder, value: value, type: type, onChange: handleChange, isInvalid: error, isDisabled: isDisabled, _placeholder: { color: 'gray.2' } })) }), error && _jsx(Text, { variant: "error", children: errorMessage })] }));
|
|
19
19
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
|
-
import { Flex, Input
|
|
2
|
+
import { Flex, Input } from '@chakra-ui/react'
|
|
3
3
|
import { TextFieldI } from '@/interfaces'
|
|
4
4
|
import { FormIcon, LabeledField } from '@/components'
|
|
5
5
|
import { formatCurrency } from '@/utils'
|
|
6
6
|
|
|
7
|
-
export const CurrencyField = ({
|
|
7
|
+
export const CurrencyField = ({
|
|
8
|
+
label,
|
|
9
|
+
id,
|
|
10
|
+
icon,
|
|
11
|
+
placeholder,
|
|
12
|
+
value,
|
|
13
|
+
}: TextFieldI) => {
|
|
8
14
|
const { control } = useFormContext()
|
|
9
15
|
|
|
10
16
|
return (
|
|
@@ -22,7 +28,7 @@ export const CurrencyField = ({ id, icon, placeholder, value }: TextFieldI) => {
|
|
|
22
28
|
onChange(currency)
|
|
23
29
|
}
|
|
24
30
|
return (
|
|
25
|
-
<LabeledField label={
|
|
31
|
+
<LabeledField label={label}>
|
|
26
32
|
<Input
|
|
27
33
|
onChange={handleChange}
|
|
28
34
|
placeholder={placeholder}
|
|
@@ -8,6 +8,7 @@ export const DateField = ({
|
|
|
8
8
|
icon,
|
|
9
9
|
name,
|
|
10
10
|
placeholder,
|
|
11
|
+
label,
|
|
11
12
|
showCalendarIcon = true,
|
|
12
13
|
value,
|
|
13
14
|
width,
|
|
@@ -37,6 +38,7 @@ export const DateField = ({
|
|
|
37
38
|
placeholder={name ? '' : placeholder}
|
|
38
39
|
value={value}
|
|
39
40
|
width={width}
|
|
41
|
+
label={label}
|
|
40
42
|
/>
|
|
41
43
|
)
|
|
42
44
|
}}
|
|
@@ -18,7 +18,8 @@ export const GridField = ({ children, onRemove, onUpload }: GridFieldI) => {
|
|
|
18
18
|
const baseProps = {
|
|
19
19
|
id,
|
|
20
20
|
value,
|
|
21
|
-
placeholder: name
|
|
21
|
+
placeholder: name ?? description,
|
|
22
|
+
label: name ?? description,
|
|
22
23
|
icon: icon ? (fieldIcons[icon] as IconTypes) : undefined,
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
2
|
import { Flex, Input } from '@chakra-ui/react'
|
|
3
3
|
import { TextFieldI } from '@/interfaces'
|
|
4
|
-
import {
|
|
4
|
+
import { LabeledField } from '@/components'
|
|
5
5
|
|
|
6
|
-
export const NumberField = ({
|
|
7
|
-
description,
|
|
8
|
-
id,
|
|
9
|
-
icon,
|
|
10
|
-
placeholder,
|
|
11
|
-
value,
|
|
12
|
-
}: TextFieldI) => {
|
|
6
|
+
export const NumberField = ({ id, label, placeholder, value }: TextFieldI) => {
|
|
13
7
|
const { control } = useFormContext()
|
|
14
8
|
return (
|
|
15
9
|
<Flex align="center" gap="base" flex="auto">
|
|
16
|
-
{/* <FieldDescription description={description} icon={icon} /> */}
|
|
17
10
|
<Controller
|
|
18
11
|
control={control}
|
|
19
12
|
name={id}
|
|
20
13
|
defaultValue={value}
|
|
21
14
|
render={({ field: { value, onChange } }) => {
|
|
22
15
|
return (
|
|
23
|
-
<LabeledField label={
|
|
16
|
+
<LabeledField label={label}>
|
|
24
17
|
<Input
|
|
25
18
|
onChange={(e) => {
|
|
26
19
|
const value = e.target.valueAsNumber
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
2
|
import { Box, Flex } from '@chakra-ui/react'
|
|
3
|
-
import {
|
|
3
|
+
import { SelectInput } from '@/components'
|
|
4
4
|
import { SelectFieldI } from '@/interfaces'
|
|
5
5
|
|
|
6
6
|
export const SelectField = ({
|
|
7
7
|
description,
|
|
8
8
|
id,
|
|
9
|
-
|
|
9
|
+
label,
|
|
10
10
|
options,
|
|
11
11
|
placeholder,
|
|
12
12
|
value,
|
|
@@ -15,7 +15,6 @@ export const SelectField = ({
|
|
|
15
15
|
const stringOptions = options?.map((option) => String(option)) ?? []
|
|
16
16
|
return (
|
|
17
17
|
<Flex align="start" gap="base" flex="auto" w={description ? '100%' : '40%'}>
|
|
18
|
-
{/* <FieldDescription description={description} icon={icon} /> */}
|
|
19
18
|
<Box w={description ? '102px' : '100%'}>
|
|
20
19
|
<Controller
|
|
21
20
|
control={control}
|
|
@@ -29,6 +28,7 @@ export const SelectField = ({
|
|
|
29
28
|
initialValue={value ?? stringOptions[0]}
|
|
30
29
|
items={stringOptions}
|
|
31
30
|
placeholder={!description ? placeholder : ''}
|
|
31
|
+
label={label}
|
|
32
32
|
width="100%"
|
|
33
33
|
/>
|
|
34
34
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useFormContext, Controller } from 'react-hook-form'
|
|
2
|
-
import { Flex
|
|
2
|
+
import { Flex } from '@chakra-ui/react'
|
|
3
3
|
import QuillEditor from 'react-quill-new'
|
|
4
4
|
import { TextAreaFieldI } from '@/interfaces'
|
|
5
5
|
import 'react-quill-new/dist/quill.snow.css'
|
|
@@ -8,21 +8,20 @@ import { LabeledField } from './LabeledField'
|
|
|
8
8
|
|
|
9
9
|
export const TextAreaField = ({
|
|
10
10
|
id,
|
|
11
|
-
|
|
11
|
+
label,
|
|
12
12
|
placeholder = '',
|
|
13
13
|
value,
|
|
14
14
|
}: TextAreaFieldI) => {
|
|
15
15
|
const { control } = useFormContext()
|
|
16
16
|
return (
|
|
17
17
|
<Flex gap="base" align="start" flex="auto">
|
|
18
|
-
{/* {icon && <Image h="auto" w="icon.md" src={icon} marginTop="2" />} */}
|
|
19
18
|
<Controller
|
|
20
19
|
control={control}
|
|
21
20
|
name={id}
|
|
22
21
|
defaultValue={value}
|
|
23
22
|
render={({ field: { value, onChange } }) => {
|
|
24
23
|
return (
|
|
25
|
-
<LabeledField label={
|
|
24
|
+
<LabeledField label={label}>
|
|
26
25
|
<QuillEditor
|
|
27
26
|
theme="snow"
|
|
28
27
|
value={value}
|
|
@@ -5,8 +5,8 @@ import { TextFieldI } from '@/interfaces'
|
|
|
5
5
|
|
|
6
6
|
export const TextField = ({
|
|
7
7
|
id,
|
|
8
|
-
icon,
|
|
9
8
|
placeholder = '',
|
|
9
|
+
label,
|
|
10
10
|
type = 'text',
|
|
11
11
|
value,
|
|
12
12
|
}: TextFieldI) => {
|
|
@@ -24,6 +24,7 @@ export const TextField = ({
|
|
|
24
24
|
placeholder={placeholder}
|
|
25
25
|
type={type}
|
|
26
26
|
value={value}
|
|
27
|
+
label={label}
|
|
27
28
|
/>
|
|
28
29
|
)
|
|
29
30
|
}}
|
|
@@ -11,6 +11,7 @@ import { extractDayMonthYear, joinDayMonthYear } from '@/utils'
|
|
|
11
11
|
export const DatePicker = ({
|
|
12
12
|
onChange,
|
|
13
13
|
placeholder,
|
|
14
|
+
label,
|
|
14
15
|
showCalendarIcon,
|
|
15
16
|
value,
|
|
16
17
|
width = '290px',
|
|
@@ -56,7 +57,7 @@ export const DatePicker = ({
|
|
|
56
57
|
const renderCustomInput = () => {
|
|
57
58
|
return (
|
|
58
59
|
<Flex gap="base" w={width}>
|
|
59
|
-
<LabeledField label={
|
|
60
|
+
<LabeledField label={label}>
|
|
60
61
|
<Input
|
|
61
62
|
placeholder={placeholder || 'MM/DD/YYYY'}
|
|
62
63
|
onChange={handleInputChange}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Input,
|
|
7
7
|
InputGroup,
|
|
8
8
|
InputRightElement,
|
|
9
|
-
Tooltip,
|
|
10
9
|
Box,
|
|
11
10
|
} from '@chakra-ui/react'
|
|
12
11
|
import { SelectI } from '@/interfaces'
|
|
@@ -29,7 +28,7 @@ export const SelectInput = ({
|
|
|
29
28
|
initialValue = 'All',
|
|
30
29
|
isDisabled,
|
|
31
30
|
items,
|
|
32
|
-
|
|
31
|
+
label,
|
|
33
32
|
variant = 'primary',
|
|
34
33
|
width = '10rem',
|
|
35
34
|
}: SelectI) => {
|
|
@@ -41,7 +40,7 @@ export const SelectInput = ({
|
|
|
41
40
|
|
|
42
41
|
return (
|
|
43
42
|
<Menu>
|
|
44
|
-
<LabeledField label={
|
|
43
|
+
<LabeledField label={label}>
|
|
45
44
|
<Box w="100%">
|
|
46
45
|
<SelectButton
|
|
47
46
|
selectedValue={selectedValue}
|
|
@@ -10,6 +10,7 @@ export const TextInput = ({
|
|
|
10
10
|
hasError,
|
|
11
11
|
id,
|
|
12
12
|
isDisabled,
|
|
13
|
+
label,
|
|
13
14
|
placeholder,
|
|
14
15
|
value = '',
|
|
15
16
|
type = 'text',
|
|
@@ -18,7 +19,7 @@ export const TextInput = ({
|
|
|
18
19
|
const error = hasError && !isDisabled
|
|
19
20
|
return (
|
|
20
21
|
<FormControl isInvalid={error}>
|
|
21
|
-
<LabeledField label={
|
|
22
|
+
<LabeledField label={label}>
|
|
22
23
|
<Input
|
|
23
24
|
{...props}
|
|
24
25
|
autoCapitalize={autoCapitalize}
|