@homefile/components-v2 2.2.0 → 2.2.1

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.
@@ -17,6 +17,6 @@ export const FolderSharing = ({ currentSort, folders = [], handleAddNewFolder, h
17
17
  return (_jsx(WrapItem, { w: "6.5rem", role: "group", children: _jsx(Box, { as: "button", position: "relative", pb: "base", pt: "6", w: "100%", onClick: () => handleFolderClick(folder), children: _jsxs(Flex, { direction: "column", gap: "base", align: "center", px: "base", children: [_jsx(Image, { src: folderIcon || GreenFolder, w: "3.7rem", h: "auto", alt: t('folderSharing.altIcon'), transition: "all 0.2s ease-in-out", _groupHover: {
18
18
  boxShadow: 'lg',
19
19
  transform: 'scale(1.05)',
20
- } }), _jsx(Text, { noOfLines: 2, lineHeight: "1.1", fontSize: "sm", textOverflow: "ellipsis", children: name })] }) }) }, _id));
20
+ } }), _jsx(Text, { noOfLines: 2, fontSize: "sm", lineHeight: "17px", textOverflow: "ellipsis", children: name })] }) }) }, _id));
21
21
  }) })] }) }) }));
22
22
  };
@@ -1,2 +1,2 @@
1
1
  import { DynamicFormI } from '../../../interfaces';
2
- export declare const DynamicForm: ({ callback, form: fields, menuItems, onUpload, showTitle, uploadingFieldId, ...props }: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DynamicForm: ({ callback, form: fields, menuItems, onUpload, showTitle, title, uploadingFieldId, ...props }: DynamicFormI) => import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
+ import { createElement as _createElement } from "react";
12
13
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  import { FormProvider } from 'react-hook-form';
14
15
  import { t } from 'i18next';
@@ -17,9 +18,9 @@ import { HiddenFieldSection, GroupField, TextField, TextAreaField, SelectField,
17
18
  import { useDynamicForm } from '../../../hooks';
18
19
  import { fieldIcons } from '../../../helpers';
19
20
  export const DynamicForm = (_a) => {
20
- var { callback, form: fields, menuItems, onUpload, showTitle = true, uploadingFieldId } = _a, props = __rest(_a, ["callback", "form", "menuItems", "onUpload", "showTitle", "uploadingFieldId"]);
21
+ var { callback, form: fields, menuItems, onUpload, showTitle = true, title, uploadingFieldId } = _a, props = __rest(_a, ["callback", "form", "menuItems", "onUpload", "showTitle", "title", "uploadingFieldId"]);
21
22
  const { form, visibleFields, hiddenFields, handleAddAll, handleAdd, handleFilesUpload, handleRemove, } = useDynamicForm({ fields, onUpload });
22
- return (_jsxs(Stack, { bg: "lightBlue.1", spacing: "0", h: "full", children: [showTitle && (_jsx(Text, { fontFamily: "secondary", px: "base", pt: "4", pb: "2", children: t('forms.itemDetails') })), _jsx(FormProvider, Object.assign({}, form, { children: _jsx(_Fragment, { children: visibleFields === null || visibleFields === void 0 ? void 0 : visibleFields.map((field) => {
23
+ return (_jsxs(Stack, { bg: "lightBlue.1", spacing: "0", h: "full", children: [showTitle && (_jsx(Text, { fontFamily: "secondary", px: "base", pt: "4", pb: "2", children: title ? title : t('forms.itemDetails') })), _jsx(FormProvider, Object.assign({}, form, { children: _jsx(_Fragment, { children: visibleFields === null || visibleFields === void 0 ? void 0 : visibleFields.map((field) => {
23
24
  const { canBeHidden, children, description, icon, id, name, options, type, value, } = field;
24
25
  const baseProps = {
25
26
  id,
@@ -64,7 +65,7 @@ export const DynamicForm = (_a) => {
64
65
  case 'checkbox-group':
65
66
  return (_jsx(CheckboxGroupField, { id: id, children: children, value: value, icon: baseProps.icon }, id));
66
67
  case 'tile-body':
67
- return (_jsx(TileBody, Object.assign({ callback: callback, fields: children, menuItems: menuItems }, props), id));
68
+ return (_createElement(TileBody, Object.assign({}, props, { key: id, callback: callback, fields: children, menuItems: menuItems })));
68
69
  default:
69
70
  return null;
70
71
  }
@@ -6,13 +6,13 @@ export const CheckboxGroupField = ({ children, icon, id, value, }) => {
6
6
  const { control } = useFormContext();
7
7
  const defaultValues = children === null || children === void 0 ? void 0 : children.map((child) => {
8
8
  if (child.value) {
9
- return child.id;
9
+ return child.name;
10
10
  }
11
11
  }).filter((value) => value);
12
12
  return (_jsxs(Box, { children: [_jsx(Box, { p: "base", borderBottom: "1px dashed", borderColor: "lightBlue.6", children: _jsx(Text, { fontFamily: "secondary", fontSize: "sm", children: value }) }), _jsxs(Flex, { p: "base", gap: "base", children: [_jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: defaultValues, render: ({ field: { onChange } }) => {
13
13
  return (_jsx(CheckboxGroup, { defaultValue: defaultValues, onChange: onChange, children: _jsx(SimpleGrid, { columns: 2, spacing: "base", w: "full", children: children === null || children === void 0 ? void 0 : children.map((child) => {
14
14
  const { id, name, value } = child;
15
- return (_jsx(Checkbox, { value: String(id), isChecked: Boolean(value), children: _jsx(Text, { fontSize: "sm", children: name }) }, id));
15
+ return (_jsx(Checkbox, { value: String(name), isChecked: Boolean(value), children: _jsx(Text, { fontSize: "sm", children: name }) }, id));
16
16
  }) }) }));
17
17
  } })] })] }));
18
18
  };
@@ -45,9 +45,8 @@ export const SingleFields = ({ callback, fields, menuItems }) => {
45
45
  case 'tile-body-action':
46
46
  return (_jsx(TileBodyAction, { fields: children, callback: callback }, id));
47
47
  case 'primary-cta':
48
- return (_jsx(TileCta, { callback: callback, description: description, icon: icon, id: id, name: name, type: type, link: link, value: String(baseProps.value) }, id));
49
48
  case 'secondary-cta':
50
- return (_jsx(TileCta, { callback: callback, description: description, icon: icon, id: id, name: name, type: type, value: String(baseProps.value) }, id));
49
+ return (_jsx(TileCta, { callback: callback, description: description, icon: icon, id: id, name: name, type: type, link: link, value: String(baseProps.value) }, id));
51
50
  default:
52
51
  return null;
53
52
  }
@@ -27,7 +27,7 @@ export const testFolders = [
27
27
  {
28
28
  _id: faker.database.mongodbObjectId(),
29
29
  home: '6317993b4a8e6e909bcced0a',
30
- name: 'Test',
30
+ name: 'Mortgage',
31
31
  public: false,
32
32
  icon: 'project',
33
33
  createdAt: '2023-01-13T20:35:02.538Z',
@@ -147,7 +147,8 @@ export const fileDB = [
147
147
  createdAt: '2022-06-15T21:17:33.246Z',
148
148
  updatedAt: '2022-06-15T21:17:33.246Z',
149
149
  __v: 0,
150
- files: [{
150
+ files: [
151
+ {
151
152
  _id: '62aa4c6db225dd3957d09b24',
152
153
  fileName: 'test-plans.jpeg-37f8c3',
153
154
  extension: 'mov',
@@ -159,7 +160,8 @@ export const fileDB = [
159
160
  createdAt: '2022-06-15T21:17:33.166Z',
160
161
  updatedAt: '2022-06-15T21:17:33.166Z',
161
162
  __v: 0,
162
- }],
163
+ },
164
+ ],
163
165
  room: {
164
166
  _id: '63176dfa5d8cee7e11f6f962',
165
167
  name: 'Master Bedroom',
@@ -185,7 +187,8 @@ export const fileDB = [
185
187
  createdAt: '2022-06-15T21:17:33.246Z',
186
188
  updatedAt: '2022-06-15T21:17:33.246Z',
187
189
  __v: 0,
188
- files: [{
190
+ files: [
191
+ {
189
192
  _id: '62aa4c6db225dd3957d09b24',
190
193
  fileName: 'test-plans.jpeg-37f8c3',
191
194
  extension: 'jpeg',
@@ -197,7 +200,8 @@ export const fileDB = [
197
200
  createdAt: '2022-06-15T21:17:33.166Z',
198
201
  updatedAt: '2022-06-15T21:17:33.166Z',
199
202
  __v: 0,
200
- }],
203
+ },
204
+ ],
201
205
  room: {
202
206
  _id: '63176dfa5d8cee7e11f6f962',
203
207
  name: 'Master Bedroom',
@@ -25,6 +25,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
25
25
  menuItems?: MenuItemI[];
26
26
  onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void;
27
27
  showTitle?: boolean;
28
+ title?: string;
28
29
  uploadingFieldId?: string;
29
30
  }
30
31
  export interface DynamicFormProxyI {
@@ -517,7 +517,7 @@ export const tileUIMock = [
517
517
  comments: '',
518
518
  value: 'Request Support',
519
519
  type: 'secondary-cta',
520
- link: 'open-drawer',
520
+ link: 'www.shine.com',
521
521
  },
522
522
  ],
523
523
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -106,8 +106,8 @@ export const FolderSharing = ({
106
106
  />
107
107
  <Text
108
108
  noOfLines={2}
109
- lineHeight="1.1"
110
109
  fontSize="sm"
110
+ lineHeight="17px"
111
111
  textOverflow="ellipsis"
112
112
  >
113
113
  {name}
@@ -28,6 +28,7 @@ export const DynamicForm = ({
28
28
  menuItems,
29
29
  onUpload,
30
30
  showTitle = true,
31
+ title,
31
32
  uploadingFieldId,
32
33
  ...props
33
34
  }: DynamicFormI) => {
@@ -45,7 +46,7 @@ export const DynamicForm = ({
45
46
  <Stack bg="lightBlue.1" spacing="0" h="full">
46
47
  {showTitle && (
47
48
  <Text fontFamily="secondary" px="base" pt="4" pb="2">
48
- {t('forms.itemDetails')}
49
+ {title ? title : t('forms.itemDetails')}
49
50
  </Text>
50
51
  )}
51
52
  <FormProvider {...form}>
@@ -177,11 +178,11 @@ export const DynamicForm = ({
177
178
  case 'tile-body':
178
179
  return (
179
180
  <TileBody
181
+ {...props}
180
182
  key={id}
181
183
  callback={callback}
182
184
  fields={children}
183
185
  menuItems={menuItems}
184
- {...props}
185
186
  />
186
187
  )
187
188
  default:
@@ -20,7 +20,7 @@ export const CheckboxGroupField = ({
20
20
  const defaultValues = children
21
21
  ?.map((child) => {
22
22
  if (child.value) {
23
- return child.id
23
+ return child.name
24
24
  }
25
25
  })
26
26
  .filter((value) => value) as string[]
@@ -47,7 +47,7 @@ export const CheckboxGroupField = ({
47
47
  return (
48
48
  <Checkbox
49
49
  key={id}
50
- value={String(id)}
50
+ value={String(name)}
51
51
  isChecked={Boolean(value)}
52
52
  >
53
53
  <Text fontSize="sm">{name}</Text>
@@ -100,19 +100,6 @@ export const SingleFields = ({ callback, fields, menuItems }: FieldTypesI) => {
100
100
  />
101
101
  )
102
102
  case 'primary-cta':
103
- return (
104
- <TileCta
105
- key={id}
106
- callback={callback}
107
- description={description}
108
- icon={icon}
109
- id={id}
110
- name={name}
111
- type={type}
112
- link={link}
113
- value={String(baseProps.value)}
114
- />
115
- )
116
103
  case 'secondary-cta':
117
104
  return (
118
105
  <TileCta
@@ -123,6 +110,7 @@ export const SingleFields = ({ callback, fields, menuItems }: FieldTypesI) => {
123
110
  id={id}
124
111
  name={name}
125
112
  type={type}
113
+ link={link}
126
114
  value={String(baseProps.value)}
127
115
  />
128
116
  )
@@ -30,7 +30,7 @@ export const testFolders: FolderI[] = [
30
30
  {
31
31
  _id: faker.database.mongodbObjectId(),
32
32
  home: '6317993b4a8e6e909bcced0a',
33
- name: 'Test',
33
+ name: 'Mortgage',
34
34
  public: false,
35
35
  icon: 'project',
36
36
  createdAt: '2023-01-13T20:35:02.538Z',
@@ -153,19 +153,21 @@ export const fileDB: ReportsI[] = [
153
153
  createdAt: '2022-06-15T21:17:33.246Z',
154
154
  updatedAt: '2022-06-15T21:17:33.246Z',
155
155
  __v: 0,
156
- files: [{
157
- _id: '62aa4c6db225dd3957d09b24',
158
- fileName: 'test-plans.jpeg-37f8c3',
159
- extension: 'mov',
160
- originalName: 'test-plans.jpeg',
161
- bucketName: 'homefile-images',
162
- description: '',
163
- collectionName: 'homes',
164
- docId: '62a20af1cc6d1000ef17c7d0',
165
- createdAt: '2022-06-15T21:17:33.166Z',
166
- updatedAt: '2022-06-15T21:17:33.166Z',
167
- __v: 0,
168
- }],
156
+ files: [
157
+ {
158
+ _id: '62aa4c6db225dd3957d09b24',
159
+ fileName: 'test-plans.jpeg-37f8c3',
160
+ extension: 'mov',
161
+ originalName: 'test-plans.jpeg',
162
+ bucketName: 'homefile-images',
163
+ description: '',
164
+ collectionName: 'homes',
165
+ docId: '62a20af1cc6d1000ef17c7d0',
166
+ createdAt: '2022-06-15T21:17:33.166Z',
167
+ updatedAt: '2022-06-15T21:17:33.166Z',
168
+ __v: 0,
169
+ },
170
+ ],
169
171
  room: {
170
172
  _id: '63176dfa5d8cee7e11f6f962',
171
173
  name: 'Master Bedroom',
@@ -191,19 +193,21 @@ export const fileDB: ReportsI[] = [
191
193
  createdAt: '2022-06-15T21:17:33.246Z',
192
194
  updatedAt: '2022-06-15T21:17:33.246Z',
193
195
  __v: 0,
194
- files: [{
195
- _id: '62aa4c6db225dd3957d09b24',
196
- fileName: 'test-plans.jpeg-37f8c3',
197
- extension: 'jpeg',
198
- originalName: 'test-plans.jpeg',
199
- bucketName: 'homefile-images',
200
- description: '',
201
- collectionName: 'homes',
202
- docId: '62a20af1cc6d1000ef17c7d0',
203
- createdAt: '2022-06-15T21:17:33.166Z',
204
- updatedAt: '2022-06-15T21:17:33.166Z',
205
- __v: 0,
206
- }],
196
+ files: [
197
+ {
198
+ _id: '62aa4c6db225dd3957d09b24',
199
+ fileName: 'test-plans.jpeg-37f8c3',
200
+ extension: 'jpeg',
201
+ originalName: 'test-plans.jpeg',
202
+ bucketName: 'homefile-images',
203
+ description: '',
204
+ collectionName: 'homes',
205
+ docId: '62a20af1cc6d1000ef17c7d0',
206
+ createdAt: '2022-06-15T21:17:33.166Z',
207
+ updatedAt: '2022-06-15T21:17:33.166Z',
208
+ __v: 0,
209
+ },
210
+ ],
207
211
  room: {
208
212
  _id: '63176dfa5d8cee7e11f6f962',
209
213
  name: 'Master Bedroom',
@@ -113,6 +113,7 @@ export interface DynamicFormI extends Partial<PartnerFooterI> {
113
113
  menuItems?: MenuItemI[]
114
114
  onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void
115
115
  showTitle?: boolean
116
+ title?: string
116
117
  uploadingFieldId?: string
117
118
  }
118
119
 
@@ -523,7 +523,7 @@ export const tileUIMock: ReportI[] = [
523
523
  comments: '',
524
524
  value: 'Request Support',
525
525
  type: 'secondary-cta',
526
- link: 'open-drawer',
526
+ link: 'www.shine.com',
527
527
  },
528
528
  ],
529
529
  },