@homefile/components-v2 2.14.1 → 2.14.3

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.
Files changed (56) hide show
  1. package/dist/components/forms/dynamicForm/DynamicForm.js +2 -1
  2. package/dist/components/forms/dynamicForm/fields/CurrencyField.d.ts +1 -1
  3. package/dist/components/forms/dynamicForm/fields/CurrencyField.js +2 -2
  4. package/dist/components/forms/dynamicForm/fields/DateField.d.ts +1 -1
  5. package/dist/components/forms/dynamicForm/fields/DateField.js +2 -2
  6. package/dist/components/forms/dynamicForm/fields/GridField.js +3 -2
  7. package/dist/components/forms/dynamicForm/fields/LabeledField.d.ts +1 -1
  8. package/dist/components/forms/dynamicForm/fields/NumberField.d.ts +1 -1
  9. package/dist/components/forms/dynamicForm/fields/NumberField.js +2 -2
  10. package/dist/components/forms/dynamicForm/fields/SelectField.d.ts +1 -1
  11. package/dist/components/forms/dynamicForm/fields/SelectField.js +2 -2
  12. package/dist/components/forms/dynamicForm/fields/SingleFields.js +2 -1
  13. package/dist/components/forms/dynamicForm/fields/TextAreaField.d.ts +1 -1
  14. package/dist/components/forms/dynamicForm/fields/TextAreaField.js +2 -2
  15. package/dist/components/forms/dynamicForm/fields/TextField.d.ts +1 -1
  16. package/dist/components/forms/dynamicForm/fields/TextField.js +2 -2
  17. package/dist/components/inputs/DatePicker.d.ts +1 -1
  18. package/dist/components/inputs/DatePicker.js +2 -2
  19. package/dist/components/inputs/SelectInput.d.ts +1 -1
  20. package/dist/components/inputs/SelectInput.js +2 -2
  21. package/dist/components/inputs/TextInput.d.ts +1 -1
  22. package/dist/components/inputs/TextInput.js +2 -2
  23. package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +1 -0
  24. package/dist/interfaces/forms/dynamicForm/fields/DateField.interface.d.ts +1 -0
  25. package/dist/interfaces/forms/dynamicForm/fields/SelectField.interface.d.ts +1 -0
  26. package/dist/interfaces/forms/dynamicForm/fields/TextAreaField.interface.d.ts +1 -0
  27. package/dist/interfaces/forms/dynamicForm/fields/TextField.interface.d.ts +1 -0
  28. package/dist/interfaces/inputs/DatePicker.interface.d.ts +1 -0
  29. package/dist/interfaces/inputs/Input.interface.d.ts +1 -0
  30. package/dist/interfaces/inputs/Select.interface.d.ts +1 -0
  31. package/dist/mocks/forms/dynamicForm.mock.js +16 -0
  32. package/dist/utils/DynamicForm.utils.js +7 -0
  33. package/package.json +1 -1
  34. package/src/components/forms/dynamicForm/DynamicForm.tsx +2 -0
  35. package/src/components/forms/dynamicForm/fields/CurrencyField.tsx +9 -3
  36. package/src/components/forms/dynamicForm/fields/DateField.tsx +2 -0
  37. package/src/components/forms/dynamicForm/fields/GridField.tsx +3 -2
  38. package/src/components/forms/dynamicForm/fields/LabeledField.tsx +1 -1
  39. package/src/components/forms/dynamicForm/fields/NumberField.tsx +3 -10
  40. package/src/components/forms/dynamicForm/fields/SelectField.tsx +3 -3
  41. package/src/components/forms/dynamicForm/fields/SingleFields.tsx +2 -0
  42. package/src/components/forms/dynamicForm/fields/TextAreaField.tsx +3 -4
  43. package/src/components/forms/dynamicForm/fields/TextField.tsx +2 -1
  44. package/src/components/inputs/DatePicker.tsx +2 -1
  45. package/src/components/inputs/SelectInput.tsx +2 -3
  46. package/src/components/inputs/TextInput.tsx +2 -1
  47. package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +1 -0
  48. package/src/interfaces/forms/dynamicForm/fields/DateField.interface.ts +1 -0
  49. package/src/interfaces/forms/dynamicForm/fields/SelectField.interface.ts +1 -0
  50. package/src/interfaces/forms/dynamicForm/fields/TextAreaField.interface.ts +1 -0
  51. package/src/interfaces/forms/dynamicForm/fields/TextField.interface.ts +1 -0
  52. package/src/interfaces/inputs/DatePicker.interface.ts +1 -0
  53. package/src/interfaces/inputs/Input.interface.ts +1 -0
  54. package/src/interfaces/inputs/Select.interface.ts +1 -0
  55. package/src/mocks/forms/dynamicForm.mock.ts +16 -0
  56. package/src/utils/DynamicForm.utils.ts +7 -0
@@ -24,12 +24,13 @@ export const DynamicForm = (_a) => {
24
24
  return _jsx(SearchItemLoader, {});
25
25
  }
26
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) => {
27
- const { canBeHidden, children, description, icon, id, name, options, type, value, } = field;
27
+ const { canBeHidden, children, description, icon, id, name, label, options, type, value, } = field;
28
28
  const baseProps = {
29
29
  id,
30
30
  value,
31
31
  icon: icon ? fieldIcons[icon] : undefined,
32
32
  placeholder: Boolean(name) ? name : description,
33
+ label,
33
34
  };
34
35
  const fieldWithDeleteBaseProps = {
35
36
  id,
@@ -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: String(placeholder), children: _jsx(Input, { onChange: handleChange, placeholder: placeholder, textAlign: "right", value: value, _placeholder: { color: 'gray.2' } }) }));
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
  };
@@ -4,11 +4,12 @@ import { Flex } from '@chakra-ui/react';
4
4
  import { DateField, NumberField, TextField, SelectField, CurrencyField, SingleImage, } from '../../..';
5
5
  import { fieldIcons } from '../../../../helpers';
6
6
  export const GridField = ({ children, onRemove, onUpload }) => {
7
- return (_jsx(Flex, { align: "stretch", gap: "base", children: children === null || children === void 0 ? void 0 : children.map(({ id, description, name, value, type, options = [], icon }) => {
7
+ return (_jsx(Flex, { align: "stretch", gap: "base", children: children === null || children === void 0 ? void 0 : children.map(({ id, description, label, name, value, type, options = [], icon }) => {
8
8
  const baseProps = {
9
9
  id,
10
10
  value,
11
- placeholder: name && name !== '' ? name : description,
11
+ placeholder: name !== null && name !== void 0 ? name : description,
12
+ label,
12
13
  icon: icon ? fieldIcons[icon] : undefined,
13
14
  };
14
15
  switch (type) {
@@ -1,6 +1,6 @@
1
1
  interface LabeledFieldProps {
2
2
  children: React.ReactNode;
3
- label: string;
3
+ label?: string;
4
4
  }
5
5
  export declare const LabeledField: ({ label, children }: LabeledFieldProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,2 +1,2 @@
1
1
  import { TextFieldI } from '../../../../interfaces';
2
- export declare const NumberField: ({ description, id, icon, placeholder, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
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 = ({ description, id, icon, placeholder, value, }) => {
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: String(!description && placeholder), children: _jsx(Input, { onChange: (e) => {
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, icon, options, placeholder, value, }: SelectFieldI) => import("react/jsx-runtime").JSX.Element;
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, icon, options, placeholder, value, }) => {
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
  };
@@ -3,11 +3,12 @@ import { createElement as _createElement } from "react";
3
3
  import { fieldIcons } from '../../../../helpers';
4
4
  import { GridField, RatingField, TextAreaField, TextField, SelectField, SwitchField, NumberField, DateField, CurrencyField, TileBodyHeader, TileBodyLogo, VerticalIcon, TileBodySectionGrid, TileBodyAction, TileCta, } from '../../..';
5
5
  export const SingleFields = ({ callback, fields, menuItems }) => {
6
- return (_jsx(_Fragment, { children: fields === null || fields === void 0 ? void 0 : fields.map(({ children, description, id, name, type, value, icon, link, options = [], }) => {
6
+ return (_jsx(_Fragment, { children: fields === null || fields === void 0 ? void 0 : fields.map(({ children, description, id, label, name, type, value, icon, link, options = [], }) => {
7
7
  const baseProps = {
8
8
  id,
9
9
  icon: icon ? fieldIcons[icon] : undefined,
10
10
  placeholder: name,
11
+ label,
11
12
  value,
12
13
  };
13
14
  switch (type) {
@@ -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, icon, placeholder, value, }: TextAreaFieldI) => import("react/jsx-runtime").JSX.Element;
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, icon, placeholder = '', value, }) => {
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: placeholder, children: _jsx(QuillEditor, { theme: "snow", value: value, formats: formats, modules: { toolbar }, onChange: onChange, placeholder: placeholder }) }));
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, icon, placeholder, type, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
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, icon, placeholder = '', type = 'text', value, }) => {
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: String(placeholder), 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 }))] }));
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, placeholder, variant, width, }: SelectI) => import("react/jsx-runtime").JSX.Element;
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, placeholder, variant = 'primary', width = '10rem', }) => {
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: String(placeholder), 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) => {
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: placeholder, 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 })] }));
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
  };
@@ -13,6 +13,7 @@ export interface ReportI {
13
13
  description?: string;
14
14
  icon?: IconTypes;
15
15
  id: string;
16
+ label?: string;
16
17
  link?: string;
17
18
  name?: string;
18
19
  options?: OptionsTypes;
@@ -4,6 +4,7 @@ export interface DateFieldI {
4
4
  icon?: string;
5
5
  name?: string;
6
6
  placeholder?: string;
7
+ label?: string;
7
8
  showCalendarIcon?: boolean;
8
9
  type?: 'text' | 'email' | 'password' | 'number' | 'tel';
9
10
  value: ReportI['value'];
@@ -3,5 +3,6 @@ export interface SelectFieldI extends FieldDescriptionI {
3
3
  id: string;
4
4
  options: ReportI['options'];
5
5
  placeholder?: string;
6
+ label?: string;
6
7
  value: ReportI['value'];
7
8
  }
@@ -2,6 +2,7 @@ import { ReportI } from '../../..';
2
2
  export interface TextAreaFieldI {
3
3
  id: string;
4
4
  icon?: string;
5
+ label?: string;
5
6
  placeholder?: string;
6
7
  value: ReportI['value'];
7
8
  }
@@ -2,6 +2,7 @@ import { FieldDescriptionI, ReportI } from '../../..';
2
2
  export interface TextFieldI extends FieldDescriptionI {
3
3
  id: string;
4
4
  placeholder?: string;
5
+ label?: string;
5
6
  type?: 'text' | 'email' | 'password' | 'number' | 'tel';
6
7
  value: ReportI['value'];
7
8
  }
@@ -1,6 +1,7 @@
1
1
  export interface DatePickerI {
2
2
  onChange: (date: string) => void;
3
3
  placeholder?: string;
4
+ label?: string;
4
5
  showCalendarIcon?: boolean;
5
6
  value: string;
6
7
  width?: string;
@@ -6,6 +6,7 @@ export interface InputI extends InputProps {
6
6
  handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
7
7
  hasError?: boolean;
8
8
  id?: string;
9
+ label?: string;
9
10
  isDisabled?: boolean;
10
11
  placeholder: string;
11
12
  value: string;
@@ -11,6 +11,7 @@ export interface SelectI {
11
11
  initialValue?: string;
12
12
  isDisabled?: boolean;
13
13
  items: SelectItemI[] | string[];
14
+ label?: string;
14
15
  placeholder?: string;
15
16
  width?: string;
16
17
  variant?: 'primary' | 'secondary' | 'tertiary' | 'accountType';
@@ -4,6 +4,7 @@ export const formFieldsMock = [
4
4
  {
5
5
  id: faker.database.mongodbObjectId(),
6
6
  name: 'Select to have Homefile find & add information on your item.',
7
+ label: 'Find & add information',
7
8
  description: 'Homefile has an extensive data base of products, but we will also search the web for the most relevant information around products. This includes details like warranty Information, manuals, price, energy info, product ratings, etc. If the item is not in our database, it will populate as soon as we add the info.',
8
9
  value: false,
9
10
  type: 'checkbox-agreement',
@@ -12,6 +13,7 @@ export const formFieldsMock = [
12
13
  {
13
14
  id: faker.database.mongodbObjectId(),
14
15
  name: 'ai form',
16
+ label: 'Add item details',
15
17
  description: 'Add item details',
16
18
  value: false,
17
19
  type: 'ai-grid',
@@ -20,6 +22,7 @@ export const formFieldsMock = [
20
22
  {
21
23
  id: faker.database.mongodbObjectId(),
22
24
  name: 'Model or Serial',
25
+ label: 'Model or Serial',
23
26
  description: faker.lorem.sentence(),
24
27
  comments: faker.lorem.sentence(),
25
28
  value: '',
@@ -29,6 +32,7 @@ export const formFieldsMock = [
29
32
  {
30
33
  id: faker.database.mongodbObjectId(),
31
34
  name: 'uploder',
35
+ label: 'Upload Image',
32
36
  description: faker.lorem.sentence(),
33
37
  comments: faker.lorem.sentence(),
34
38
  value: faker.image.urlPicsumPhotos(),
@@ -40,6 +44,7 @@ export const formFieldsMock = [
40
44
  {
41
45
  id: faker.database.mongodbObjectId(),
42
46
  name: '',
47
+ label: 'Add item details',
43
48
  description: faker.lorem.sentence(),
44
49
  comments: faker.lorem.sentence(),
45
50
  value: '',
@@ -50,6 +55,7 @@ export const formFieldsMock = [
50
55
  {
51
56
  id: faker.database.mongodbObjectId(),
52
57
  name: 'Brand',
58
+ label: 'Brand',
53
59
  description: faker.lorem.sentence(),
54
60
  comments: faker.lorem.sentence(),
55
61
  value: '',
@@ -60,6 +66,7 @@ export const formFieldsMock = [
60
66
  {
61
67
  id: faker.database.mongodbObjectId(),
62
68
  name: 'Services',
69
+ label: 'Services',
63
70
  description: faker.lorem.sentence(),
64
71
  comments: faker.lorem.sentence(),
65
72
  value: 'Select the services you are requesting support for?',
@@ -70,6 +77,7 @@ export const formFieldsMock = [
70
77
  {
71
78
  id: faker.database.mongodbObjectId(),
72
79
  name: 'Pressure Washing',
80
+ label: 'Pressure Washing',
73
81
  description: faker.lorem.sentence(),
74
82
  comments: faker.lorem.sentence(),
75
83
  value: true,
@@ -79,6 +87,7 @@ export const formFieldsMock = [
79
87
  {
80
88
  id: faker.database.mongodbObjectId(),
81
89
  name: 'Window Cleaning',
90
+ label: 'Window Cleaning',
82
91
  description: faker.lorem.sentence(),
83
92
  comments: faker.lorem.sentence(),
84
93
  value: false,
@@ -88,6 +97,7 @@ export const formFieldsMock = [
88
97
  {
89
98
  id: faker.database.mongodbObjectId(),
90
99
  name: 'Roof Cleaning',
100
+ label: 'Roof Cleaning',
91
101
  description: faker.lorem.sentence(),
92
102
  comments: faker.lorem.sentence(),
93
103
  value: false,
@@ -136,6 +146,7 @@ export const formFieldsMock = [
136
146
  {
137
147
  id: faker.database.mongodbObjectId(),
138
148
  name: 'Receipt',
149
+ label: 'Receipt',
139
150
  description: faker.lorem.sentence(),
140
151
  comments: faker.lorem.sentence(),
141
152
  value: faker.lorem.sentence(),
@@ -146,6 +157,7 @@ export const formFieldsMock = [
146
157
  {
147
158
  id: faker.database.mongodbObjectId(),
148
159
  name: 'SKU',
160
+ label: 'SKU',
149
161
  description: faker.lorem.sentence(),
150
162
  comments: faker.lorem.sentence(),
151
163
  value: faker.lorem.sentence(),
@@ -163,6 +175,7 @@ export const formFieldsMock = [
163
175
  {
164
176
  id: faker.database.mongodbObjectId(),
165
177
  name: 'Purchase Date',
178
+ label: 'Purchase Date',
166
179
  description: faker.lorem.sentence(),
167
180
  comments: faker.lorem.sentence(),
168
181
  value: '',
@@ -172,6 +185,7 @@ export const formFieldsMock = [
172
185
  {
173
186
  id: faker.database.mongodbObjectId(),
174
187
  name: '$ Amount Paid',
188
+ label: '$ Amount Paid',
175
189
  description: faker.lorem.sentence(),
176
190
  comments: faker.lorem.sentence(),
177
191
  value: faker.finance.amount({ min: 10, max: 100 }),
@@ -186,6 +200,7 @@ export const formFieldsMock = [
186
200
  {
187
201
  id: faker.database.mongodbObjectId(),
188
202
  name: 'Color',
203
+ label: 'Color',
189
204
  description: faker.lorem.sentence(),
190
205
  comments: faker.lorem.sentence(),
191
206
  value: faker.lorem.word(),
@@ -196,6 +211,7 @@ export const formFieldsMock = [
196
211
  {
197
212
  id: faker.database.mongodbObjectId(),
198
213
  name: 'Finish',
214
+ label: 'Finish',
199
215
  description: faker.lorem.sentence(),
200
216
  comments: faker.lorem.sentence(),
201
217
  value: 'Matte',
@@ -19,6 +19,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
19
19
  {
20
20
  id: uuidv4(),
21
21
  name: currentLabel,
22
+ label: currentLabel,
22
23
  description: '',
23
24
  comments: '',
24
25
  value,
@@ -32,6 +33,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
32
33
  {
33
34
  id: uuidv4(),
34
35
  name: currentLabel,
36
+ label: currentLabel,
35
37
  description: '',
36
38
  comments: '',
37
39
  value: String(value),
@@ -45,6 +47,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
45
47
  {
46
48
  id: uuidv4(),
47
49
  name: currentLabel,
50
+ label: currentLabel,
48
51
  description: '',
49
52
  comments: '',
50
53
  value: String(value),
@@ -61,6 +64,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
61
64
  {
62
65
  id: uuidv4(),
63
66
  name: currentLabel,
67
+ label: currentLabel,
64
68
  description: '',
65
69
  comments: '',
66
70
  value: htmlValue,
@@ -91,6 +95,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
91
95
  {
92
96
  id: uuidv4(),
93
97
  name: currentLabel,
98
+ label: currentLabel,
94
99
  description: '',
95
100
  comments: '',
96
101
  value: `<ul>${htmlList}</ul>`,
@@ -116,6 +121,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
116
121
  {
117
122
  id: uuidv4(),
118
123
  name: currentLabel,
124
+ label: currentLabel,
119
125
  description: '',
120
126
  comments: '',
121
127
  value: htmlValue,
@@ -128,6 +134,7 @@ export const mapApiObjectToFormFields = ({ obj = {}, depth = 0, labelPrefix = ''
128
134
  {
129
135
  id: uuidv4(),
130
136
  name: currentLabel,
137
+ label: currentLabel,
131
138
  description: '',
132
139
  comments: '',
133
140
  value: String(value),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.14.1",
3
+ "version": "2.14.3",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -76,6 +76,7 @@ export const DynamicForm = ({
76
76
  icon,
77
77
  id,
78
78
  name,
79
+ label,
79
80
  options,
80
81
  type,
81
82
  value,
@@ -86,6 +87,7 @@ export const DynamicForm = ({
86
87
  value,
87
88
  icon: icon ? (fieldIcons[icon] as IconTypes) : undefined,
88
89
  placeholder: Boolean(name) ? name : description,
90
+ label,
89
91
  }
90
92
  const fieldWithDeleteBaseProps = {
91
93
  id,
@@ -1,10 +1,16 @@
1
1
  import { Controller, useFormContext } from 'react-hook-form'
2
- import { Flex, Input, Tooltip } from '@chakra-ui/react'
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 = ({ id, icon, placeholder, value }: TextFieldI) => {
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={String(placeholder)}>
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
  }}
@@ -14,11 +14,12 @@ export const GridField = ({ children, onRemove, onUpload }: GridFieldI) => {
14
14
  return (
15
15
  <Flex align="stretch" gap="base">
16
16
  {children?.map(
17
- ({ id, description, name, value, type, options = [], icon }) => {
17
+ ({ id, description, label, name, value, type, options = [], icon }) => {
18
18
  const baseProps = {
19
19
  id,
20
20
  value,
21
- placeholder: name && name !== '' ? name : description,
21
+ placeholder: name ?? description,
22
+ label,
22
23
  icon: icon ? (fieldIcons[icon] as IconTypes) : undefined,
23
24
  }
24
25
 
@@ -2,7 +2,7 @@ import { Box, Text, Flex, Image } from '@chakra-ui/react'
2
2
 
3
3
  interface LabeledFieldProps {
4
4
  children: React.ReactNode
5
- label: string
5
+ label?: string
6
6
  }
7
7
 
8
8
  export const LabeledField = ({ label, children }: LabeledFieldProps) => {
@@ -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 { FieldDescription, LabeledField } from '@/components'
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={String(!description && placeholder)}>
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 { FieldDescription, SelectInput } from '@/components'
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
- icon,
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
  )
@@ -26,6 +26,7 @@ export const SingleFields = ({ callback, fields, menuItems }: FieldTypesI) => {
26
26
  children,
27
27
  description,
28
28
  id,
29
+ label,
29
30
  name,
30
31
  type,
31
32
  value,
@@ -37,6 +38,7 @@ export const SingleFields = ({ callback, fields, menuItems }: FieldTypesI) => {
37
38
  id,
38
39
  icon: icon ? fieldIcons[icon] : undefined,
39
40
  placeholder: name,
41
+ label,
40
42
  value,
41
43
  }
42
44
  switch (type) {
@@ -1,5 +1,5 @@
1
1
  import { useFormContext, Controller } from 'react-hook-form'
2
- import { Flex, Image } from '@chakra-ui/react'
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
- icon,
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={placeholder}>
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={String(placeholder)}>
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
- placeholder,
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={String(placeholder)}>
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={placeholder}>
22
+ <LabeledField label={label}>
22
23
  <Input
23
24
  {...props}
24
25
  autoCapitalize={autoCapitalize}
@@ -120,6 +120,7 @@ export interface ReportI {
120
120
  description?: string
121
121
  icon?: IconTypes
122
122
  id: string
123
+ label?: string
123
124
  link?: string
124
125
  name?: string
125
126
  options?: OptionsTypes
@@ -5,6 +5,7 @@ export interface DateFieldI {
5
5
  icon?: string
6
6
  name?: string
7
7
  placeholder?: string
8
+ label?: string
8
9
  showCalendarIcon?: boolean
9
10
  type?: 'text' | 'email' | 'password' | 'number' | 'tel'
10
11
  value: ReportI['value']
@@ -4,5 +4,6 @@ export interface SelectFieldI extends FieldDescriptionI {
4
4
  id: string
5
5
  options: ReportI['options']
6
6
  placeholder?: string
7
+ label?: string
7
8
  value: ReportI['value']
8
9
  }
@@ -3,6 +3,7 @@ import { ReportI } from '@/interfaces'
3
3
  export interface TextAreaFieldI {
4
4
  id: string
5
5
  icon?: string
6
+ label?: string
6
7
  placeholder?: string
7
8
  value: ReportI['value']
8
9
  }
@@ -3,6 +3,7 @@ import { FieldDescriptionI, ReportI } from '@/interfaces'
3
3
  export interface TextFieldI extends FieldDescriptionI {
4
4
  id: string
5
5
  placeholder?: string
6
+ label?: string
6
7
  type?: 'text' | 'email' | 'password' | 'number' | 'tel'
7
8
  value: ReportI['value']
8
9
  }
@@ -1,6 +1,7 @@
1
1
  export interface DatePickerI {
2
2
  onChange: (date: string) => void
3
3
  placeholder?: string
4
+ label?: string
4
5
  showCalendarIcon?: boolean
5
6
  value: string
6
7
  width?: string
@@ -7,6 +7,7 @@ export interface InputI extends InputProps {
7
7
  handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void
8
8
  hasError?: boolean
9
9
  id?: string
10
+ label?: string
10
11
  isDisabled?: boolean
11
12
  placeholder: string
12
13
  value: string
@@ -12,6 +12,7 @@ export interface SelectI {
12
12
  initialValue?: string
13
13
  isDisabled?: boolean
14
14
  items: SelectItemI[] | string[]
15
+ label?: string
15
16
  placeholder?: string
16
17
  width?: string
17
18
  variant?: 'primary' | 'secondary' | 'tertiary' | 'accountType'
@@ -6,6 +6,7 @@ export const formFieldsMock: ReportI[] = [
6
6
  {
7
7
  id: faker.database.mongodbObjectId(),
8
8
  name: 'Select to have Homefile find & add information on your item.',
9
+ label: 'Find & add information',
9
10
  description:
10
11
  'Homefile has an extensive data base of products, but we will also search the web for the most relevant information around products. This includes details like warranty Information, manuals, price, energy info, product ratings, etc. If the item is not in our database, it will populate as soon as we add the info.',
11
12
  value: false,
@@ -15,6 +16,7 @@ export const formFieldsMock: ReportI[] = [
15
16
  {
16
17
  id: faker.database.mongodbObjectId(),
17
18
  name: 'ai form',
19
+ label: 'Add item details',
18
20
  description: 'Add item details',
19
21
  value: false,
20
22
  type: 'ai-grid',
@@ -23,6 +25,7 @@ export const formFieldsMock: ReportI[] = [
23
25
  {
24
26
  id: faker.database.mongodbObjectId(),
25
27
  name: 'Model or Serial',
28
+ label: 'Model or Serial',
26
29
  description: faker.lorem.sentence(),
27
30
  comments: faker.lorem.sentence(),
28
31
  value: '',
@@ -32,6 +35,7 @@ export const formFieldsMock: ReportI[] = [
32
35
  {
33
36
  id: faker.database.mongodbObjectId(),
34
37
  name: 'uploder',
38
+ label: 'Upload Image',
35
39
  description: faker.lorem.sentence(),
36
40
  comments: faker.lorem.sentence(),
37
41
  value: faker.image.urlPicsumPhotos(),
@@ -43,6 +47,7 @@ export const formFieldsMock: ReportI[] = [
43
47
  {
44
48
  id: faker.database.mongodbObjectId(),
45
49
  name: '',
50
+ label: 'Add item details',
46
51
  description: faker.lorem.sentence(),
47
52
  comments: faker.lorem.sentence(),
48
53
  value: '',
@@ -53,6 +58,7 @@ export const formFieldsMock: ReportI[] = [
53
58
  {
54
59
  id: faker.database.mongodbObjectId(),
55
60
  name: 'Brand',
61
+ label: 'Brand',
56
62
  description: faker.lorem.sentence(),
57
63
  comments: faker.lorem.sentence(),
58
64
  value: '',
@@ -63,6 +69,7 @@ export const formFieldsMock: ReportI[] = [
63
69
  {
64
70
  id: faker.database.mongodbObjectId(),
65
71
  name: 'Services',
72
+ label: 'Services',
66
73
  description: faker.lorem.sentence(),
67
74
  comments: faker.lorem.sentence(),
68
75
  value: 'Select the services you are requesting support for?',
@@ -73,6 +80,7 @@ export const formFieldsMock: ReportI[] = [
73
80
  {
74
81
  id: faker.database.mongodbObjectId(),
75
82
  name: 'Pressure Washing',
83
+ label: 'Pressure Washing',
76
84
  description: faker.lorem.sentence(),
77
85
  comments: faker.lorem.sentence(),
78
86
  value: true,
@@ -82,6 +90,7 @@ export const formFieldsMock: ReportI[] = [
82
90
  {
83
91
  id: faker.database.mongodbObjectId(),
84
92
  name: 'Window Cleaning',
93
+ label: 'Window Cleaning',
85
94
  description: faker.lorem.sentence(),
86
95
  comments: faker.lorem.sentence(),
87
96
  value: false,
@@ -91,6 +100,7 @@ export const formFieldsMock: ReportI[] = [
91
100
  {
92
101
  id: faker.database.mongodbObjectId(),
93
102
  name: 'Roof Cleaning',
103
+ label: 'Roof Cleaning',
94
104
  description: faker.lorem.sentence(),
95
105
  comments: faker.lorem.sentence(),
96
106
  value: false,
@@ -139,6 +149,7 @@ export const formFieldsMock: ReportI[] = [
139
149
  {
140
150
  id: faker.database.mongodbObjectId(),
141
151
  name: 'Receipt',
152
+ label: 'Receipt',
142
153
  description: faker.lorem.sentence(),
143
154
  comments: faker.lorem.sentence(),
144
155
  value: faker.lorem.sentence(),
@@ -149,6 +160,7 @@ export const formFieldsMock: ReportI[] = [
149
160
  {
150
161
  id: faker.database.mongodbObjectId(),
151
162
  name: 'SKU',
163
+ label: 'SKU',
152
164
  description: faker.lorem.sentence(),
153
165
  comments: faker.lorem.sentence(),
154
166
  value: faker.lorem.sentence(),
@@ -166,6 +178,7 @@ export const formFieldsMock: ReportI[] = [
166
178
  {
167
179
  id: faker.database.mongodbObjectId(),
168
180
  name: 'Purchase Date',
181
+ label: 'Purchase Date',
169
182
  description: faker.lorem.sentence(),
170
183
  comments: faker.lorem.sentence(),
171
184
  value: '',
@@ -175,6 +188,7 @@ export const formFieldsMock: ReportI[] = [
175
188
  {
176
189
  id: faker.database.mongodbObjectId(),
177
190
  name: '$ Amount Paid',
191
+ label: '$ Amount Paid',
178
192
  description: faker.lorem.sentence(),
179
193
  comments: faker.lorem.sentence(),
180
194
  value: faker.finance.amount({ min: 10, max: 100 }),
@@ -189,6 +203,7 @@ export const formFieldsMock: ReportI[] = [
189
203
  {
190
204
  id: faker.database.mongodbObjectId(),
191
205
  name: 'Color',
206
+ label: 'Color',
192
207
  description: faker.lorem.sentence(),
193
208
  comments: faker.lorem.sentence(),
194
209
  value: faker.lorem.word(),
@@ -199,6 +214,7 @@ export const formFieldsMock: ReportI[] = [
199
214
  {
200
215
  id: faker.database.mongodbObjectId(),
201
216
  name: 'Finish',
217
+ label: 'Finish',
202
218
  description: faker.lorem.sentence(),
203
219
  comments: faker.lorem.sentence(),
204
220
  value: 'Matte',
@@ -38,6 +38,7 @@ export const mapApiObjectToFormFields = ({
38
38
  {
39
39
  id: uuidv4(),
40
40
  name: currentLabel,
41
+ label: currentLabel,
41
42
  description: '',
42
43
  comments: '',
43
44
  value,
@@ -52,6 +53,7 @@ export const mapApiObjectToFormFields = ({
52
53
  {
53
54
  id: uuidv4(),
54
55
  name: currentLabel,
56
+ label: currentLabel,
55
57
  description: '',
56
58
  comments: '',
57
59
  value: String(value),
@@ -66,6 +68,7 @@ export const mapApiObjectToFormFields = ({
66
68
  {
67
69
  id: uuidv4(),
68
70
  name: currentLabel,
71
+ label: currentLabel,
69
72
  description: '',
70
73
  comments: '',
71
74
  value: String(value),
@@ -83,6 +86,7 @@ export const mapApiObjectToFormFields = ({
83
86
  {
84
87
  id: uuidv4(),
85
88
  name: currentLabel,
89
+ label: currentLabel,
86
90
  description: '',
87
91
  comments: '',
88
92
  value: htmlValue,
@@ -119,6 +123,7 @@ export const mapApiObjectToFormFields = ({
119
123
  {
120
124
  id: uuidv4(),
121
125
  name: currentLabel,
126
+ label: currentLabel,
122
127
  description: '',
123
128
  comments: '',
124
129
  value: `<ul>${htmlList}</ul>`,
@@ -147,6 +152,7 @@ export const mapApiObjectToFormFields = ({
147
152
  {
148
153
  id: uuidv4(),
149
154
  name: currentLabel,
155
+ label: currentLabel,
150
156
  description: '',
151
157
  comments: '',
152
158
  value: htmlValue,
@@ -160,6 +166,7 @@ export const mapApiObjectToFormFields = ({
160
166
  {
161
167
  id: uuidv4(),
162
168
  name: currentLabel,
169
+ label: currentLabel,
163
170
  description: '',
164
171
  comments: '',
165
172
  value: String(value),