groundfloor-react-ui 1.0.5 → 1.0.6

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.
@@ -0,0 +1 @@
1
+ <svg id="b2bc64ed-393d-4e15-8787-df9ec8050d97" data-name="ae65933b-c6e6-4b40-868c-58201eab117d" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21.4 24"><defs><style>.bb405ea1-9d39-4705-a069-9048c97b4cda{fill:#2e56f4;}.accb9cd8-805e-4c9f-9b46-25d8ccc4d9c0{isolation:isolate;font-size:9.07px;fill:#fff;font-family:AvertaCY-Extrabold, Averta CY;font-weight:800;letter-spacing:0.04em;}</style></defs><path class="bb405ea1-9d39-4705-a069-9048c97b4cda" d="M20.1,8.5h-.6V5.6h0c0-.2-.1-.3-.1-.4L14.6,0H2.8a.9.9,0,0,0-.9.9h0V8.5H1.3A1.3,1.3,0,0,0,0,9.8H0v7a1.3,1.3,0,0,0,1.2,1.4h.7v4.9a.9.9,0,0,0,.9.9H18.5a1,1,0,0,0,1-.8h0v-5h.6a1.3,1.3,0,0,0,1.3-1.3h0v-7a1.3,1.3,0,0,0-1.3-1.3ZM18.5,22.8H2.8V18.2H18.5Zm0-14.3H2.8V.7h11V5.6c.1.3.3.5.5.4h4.2Z"/><text class="accb9cd8-805e-4c9f-9b46-25d8ccc4d9c0" transform="translate(0.8 16.6)">FILE</text></svg>
@@ -1,18 +1,31 @@
1
- import React, { Fragment } from 'react'
2
- import defaultThemeColor from '../constants/defaultThemeColor'
1
+ import React, { Fragment } from 'react';
2
+ import defaultThemeColor from '../constants/defaultThemeColor';
3
3
  import { Header } from '../Header';
4
4
  import { Label } from '../Label';
5
- import { CheckBoxInput, DateSelect, DropdownSelect, DropzoneInput, NumericInput, RadioInput, SearchInput, SignatureInput, TextArea, TextInput, ToggleSwitch } from '../Inputs';
5
+ import {
6
+ CheckBoxInput,
7
+ DateSelect,
8
+ DropdownSelect,
9
+ DropzoneInput,
10
+ NumericInput,
11
+ RadioInput,
12
+ SearchInput,
13
+ SignatureInput,
14
+ TextArea,
15
+ TextInput,
16
+ ToggleSwitch,
17
+ } from '../Inputs';
6
18
  import { Rating } from '../Rating';
7
19
  import { PrimaryButton, SecondaryButton, TinyButton } from '../Button';
8
- import { FormContainer, FormWrapper, MultiColumnDiv, MultiColumnWrapper } from '../DesignComponent';
9
-
10
-
20
+ import {
21
+ FormContainer,
22
+ FormWrapper,
23
+ MultiColumnWrapper,
24
+ MultiColumnDiv,
25
+ } from '../DesignComponent';
11
26
 
12
27
  export const FormComponent = ({ formData, ...props }) => {
13
-
14
28
  const header = (item) => {
15
-
16
29
  return (
17
30
  <Fragment>
18
31
  <Header {...item} {...props}>
@@ -20,9 +33,8 @@ export const FormComponent = ({ formData, ...props }) => {
20
33
  </Header>
21
34
  {item}
22
35
  </Fragment>
23
-
24
- )
25
- }
36
+ );
37
+ };
26
38
 
27
39
  const labelWithJSon = (item) => {
28
40
  return (
@@ -33,222 +45,140 @@ export const FormComponent = ({ formData, ...props }) => {
33
45
  customStyles={item.customStyles}
34
46
  text={item.text}
35
47
  {...props}
36
- style={{ marginBottom: '7px' }}
48
+ style={{
49
+ marginBottom: '7px',
50
+ paddingBottom: '0',
51
+ }}
37
52
  />
38
53
  </MultiColumnDiv>
39
54
  <MultiColumnDiv>
40
- <pre>
41
- {JSON.stringify(item, null, 4)}
42
- </pre>
55
+ <pre>{JSON.stringify(item, null, 4)}</pre>
43
56
  </MultiColumnDiv>
44
57
  </MultiColumnWrapper>
45
58
  </Fragment>
46
- )
47
- }
59
+ );
60
+ };
48
61
  const label = (item) => {
49
62
  return (
50
63
  <Label
51
- style={{ marginBottom: '7px' }}
64
+ style={{ marginBottom: '7px', paddingBottom: '0' }}
52
65
  {...item}
53
66
  {...props}
54
67
  />
55
- )
56
- }
68
+ );
69
+ };
57
70
  const textInput = (item) => {
58
- return (
59
- <TextInput
60
- {...item}
61
- {...props}
62
- />
63
- )
64
- }
71
+ return <TextInput {...item} {...props} />;
72
+ };
65
73
 
66
74
  const textAreaInput = (item) => {
67
- return (
68
- <TextArea
69
- {...item}
70
- {...props}
71
- />
72
- )
73
- }
75
+ return <TextArea {...item} {...props} />;
76
+ };
74
77
 
75
78
  const NumberInput = (item) => {
76
- return (
77
- <NumericInput
78
- {...item}
79
- {...props}
80
- />
81
- )
82
- }
79
+ return <NumericInput {...item} {...props} />;
80
+ };
83
81
 
84
82
  const radioInput = (item) => {
85
- return (
86
- <RadioInput
87
- key={Math.random() * 101 | 0}
88
- {...item}
89
- {...props}
90
- />
91
- )
92
- }
83
+ return <RadioInput key={(Math.random() * 101) | 0} {...item} {...props} />;
84
+ };
93
85
 
94
86
  const checkBoxInput = (item) => {
95
- return (
96
- <CheckBoxInput
97
- {...item}
98
- {...props}
99
- />
100
- )
101
- }
87
+ return <CheckBoxInput {...item} {...props} />;
88
+ };
102
89
 
103
90
  const SingleDropdownInput = (item) => {
104
91
  return (
105
- <DropdownSelect
106
- dropdownType={'singleSelect'}
107
- {...item}
108
- {...props}
109
- />
110
- )
111
- }
92
+ <DropdownSelect dropdownType={'singleSelect'} {...item} {...props} />
93
+ );
94
+ };
112
95
 
113
96
  const MultiDropdownInput = (item) => {
114
- return (
115
- <DropdownSelect
116
- {...item}
117
- {...props}
118
- />
119
- )
120
- }
97
+ return <DropdownSelect {...item} {...props} />;
98
+ };
121
99
 
122
100
  const signatureInput = (item) => {
123
- return (
124
- <SignatureInput
125
- {...item}
126
- {...props}
127
- />
128
- )
129
- }
101
+ return <SignatureInput {...item} {...props} />;
102
+ };
130
103
 
131
104
  const fileUploadInput = (item) => {
132
-
133
- return (
134
- <DropzoneInput
135
- {...item}
136
- {...props} />
137
- )
138
- }
105
+ return <DropzoneInput {...item} {...props} />;
106
+ };
139
107
 
140
108
  const dateInput = (item) => {
141
- return (
142
- <DateSelect
143
- {...item}
144
- {...props} />
145
- )
146
- }
109
+ return <DateSelect {...item} {...props} />;
110
+ };
147
111
 
148
112
  const toggleSwitch = (item) => {
149
- return (
150
- <ToggleSwitch
151
- {...item}
152
- {...props}
153
- />
154
- )
155
- }
113
+ return <ToggleSwitch {...item} {...props} />;
114
+ };
156
115
 
157
116
  const ratingInput = (item) => {
158
- return (
159
- <Rating
160
- {...item}
161
- {...props}
162
- />
163
- )
164
- }
117
+ return <Rating {...item} {...props} />;
118
+ };
165
119
 
166
120
  const primaryButton = (item) => {
167
- return (
168
- <PrimaryButton
169
- {...item}
170
- {...props}
171
- />
172
- )
173
- }
121
+ return <PrimaryButton {...item} {...props} />;
122
+ };
174
123
 
175
124
  const secondaryButton = (item) => {
176
- return (
177
- <SecondaryButton
178
- {...item}
179
- {...props}
180
- />
181
- )
182
- }
125
+ return <SecondaryButton {...item} {...props} />;
126
+ };
183
127
 
184
128
  const tinyButton = (item) => {
185
- return (
186
- <TinyButton
187
- {...item}
188
- {...props}
189
- />
190
- )
191
- }
129
+ return <TinyButton {...item} {...props} />;
130
+ };
192
131
 
193
132
  const searchInput = (item) => {
194
- return (
195
- <SearchInput
196
- {...item}
197
- {...props}
198
- />
199
- )
200
- }
201
-
202
-
133
+ return <SearchInput {...item} {...props} />;
134
+ };
203
135
 
204
136
  const handleSubmit = () => {
205
- console.log("form submit");
206
- }
137
+ console.log('form submit');
138
+ };
207
139
 
208
140
  const returnComponent = (item) => {
209
141
  switch (item.type) {
210
- case "header":
211
- return header(item)
212
- case "label":
213
- return label(item)
214
- case "text":
215
- return textInput(item)
216
- case "textArea":
217
- return textAreaInput(item)
218
- case "number":
219
- return NumberInput(item)
220
- case "radio":
221
- return radioInput(item)
222
- case "checkBox":
223
- return checkBoxInput(item)
224
- case "singleSelect":
225
- return SingleDropdownInput(item)
226
- case "multiSelect":
227
- return MultiDropdownInput(item)
228
- case "signature":
229
- return signatureInput(item)
230
- case "fileUpload":
231
- return fileUploadInput(item)
232
- case "date":
233
- return dateInput(item)
234
- case "toggle":
235
- return toggleSwitch(item)
236
- case "rating":
237
- return ratingInput(item)
238
- case "buttonPrimary":
239
- return primaryButton(item)
240
- case "buttonSecondary":
241
- return secondaryButton(item)
242
- case "buttonTiny":
243
- return tinyButton(item)
244
- case "search":
245
- return searchInput(item)
142
+ case 'header':
143
+ return header(item);
144
+ case 'label':
145
+ return label(item);
146
+ case 'text':
147
+ return textInput(item);
148
+ case 'textArea':
149
+ return textAreaInput(item);
150
+ case 'number':
151
+ return NumberInput(item);
152
+ case 'radio':
153
+ return radioInput(item);
154
+ case 'checkBox':
155
+ return checkBoxInput(item);
156
+ case 'singleSelect':
157
+ return SingleDropdownInput(item);
158
+ case 'multiSelect':
159
+ return MultiDropdownInput(item);
160
+ case 'signature':
161
+ return signatureInput(item);
162
+ case 'fileUpload':
163
+ return fileUploadInput(item);
164
+ case 'date':
165
+ return dateInput(item);
166
+ case 'toggle':
167
+ return toggleSwitch(item);
168
+ case 'rating':
169
+ return ratingInput(item);
170
+ case 'buttonPrimary':
171
+ return primaryButton(item);
172
+ case 'buttonSecondary':
173
+ return secondaryButton(item);
174
+ case 'buttonTiny':
175
+ return tinyButton(item);
176
+ case 'search':
177
+ return searchInput(item);
246
178
  default:
247
179
  break;
248
180
  }
249
- }
250
-
251
-
181
+ };
252
182
 
253
183
  return (
254
184
  <Fragment>
@@ -256,21 +186,23 @@ export const FormComponent = ({ formData, ...props }) => {
256
186
  <FormWrapper onSubmit={handleSubmit}>
257
187
  {formData.map((row, i) => {
258
188
  if (row.length > 1) {
259
- return <MultiColumnWrapper>
260
- {row.map((item, j) => {
261
- return <MultiColumnDiv cols={row.length}>
262
- {returnComponent(item)}
263
- </MultiColumnDiv>
264
- })}
265
- </MultiColumnWrapper>
189
+ return (
190
+ <MultiColumnWrapper>
191
+ {row.map((item, j) => {
192
+ return (
193
+ <MultiColumnDiv cols={row.length}>
194
+ {returnComponent(item)}
195
+ </MultiColumnDiv>
196
+ );
197
+ })}
198
+ </MultiColumnWrapper>
199
+ );
266
200
  } else {
267
201
  return returnComponent(row[0]);
268
202
  }
269
203
  })}
270
-
271
204
  </FormWrapper>
272
205
  </FormContainer>
273
206
  </Fragment>
274
- )
275
- }
276
-
207
+ );
208
+ };
@@ -48,6 +48,7 @@ import watcher from '../../assets/icons/watcher.svg'
48
48
  import fileUpload from '../../assets/icons/file-upload.svg'
49
49
  import eyeHide from '../../assets/icons/eye-hide.svg'
50
50
  import eyeView from '../../assets/icons/eye-hide-view.svg'
51
+ import fileIcon from '../../assets/icons/file-icon.svg'
51
52
 
52
53
 
53
54
  /** icon name should be kebab-case, e.g "plus-outline" */
@@ -94,7 +95,8 @@ const iconObj = {
94
95
  'user-icon': user,
95
96
  'file-upload': fileUpload,
96
97
  'eye-hide': eyeHide,
97
- 'eye-show': eyeView
98
+ 'eye-show': eyeView,
99
+ 'file-icon': fileIcon,
98
100
  }
99
101
 
100
102
  const StyledSVGIcon = styled(ReactSVG)`
@@ -135,6 +137,7 @@ const StyledSVGIcon = styled(ReactSVG)`
135
137
  outline: none;
136
138
  border:none;
137
139
  }
140
+ vertical-align: initial;
138
141
  }
139
142
  `;
140
143
 
@@ -5,10 +5,13 @@ import defaultThemeColor from '../constants/defaultThemeColor';
5
5
  import defaultStyles from '../constants/defaultStyle';
6
6
  import getDefaultStyles from '../constants/utils';
7
7
  import { Label } from '../Label';
8
- import tick from '../../assets/icons/checkmark.svg';
9
-
8
+ // import tick from '../../assets/icons/checkmark.svg';
9
+ import { Icon } from '../Icon'
10
10
 
11
11
  const CheckBoxOuter = styled.div`
12
+
13
+ box-sizing:initial;
14
+
12
15
  //Set the styles from the default styles object
13
16
  ${({ theme, defaultCheckBoxOuterStyle }) => {
14
17
  return getDefaultStyles(theme, defaultCheckBoxOuterStyle);
@@ -21,22 +24,27 @@ const CheckBoxOuter = styled.div`
21
24
  `;
22
25
 
23
26
  const CheckBoxInner = styled.div`
27
+
28
+ box-sizing:initial;
29
+
24
30
  //Set the styles from the default styles object
25
31
  ${({ theme, defaultCheckBoxInnerStyle }) => {
26
32
  return getDefaultStyles(theme, defaultCheckBoxInnerStyle);
27
33
  }}
28
34
 
29
- background-image: url(${({ signCheck }) => signCheck});
35
+ // background-image: url(${({ signCheck }) => signCheck});
30
36
  background-color: ${({ checked, checkedCheckBoxColor }) => checked ? checkedCheckBoxColor : defaultThemeColor.bgColor};
31
37
  border: 2px solid ${({ checkedCheckBoxColor, defaultBorderColor, checked }) => checked ? checkedCheckBoxColor : defaultBorderColor};
32
-
38
+ display: flex;
39
+ justify-content: center;
40
+ align-items: center;
33
41
  // custom styles
34
42
  ${({ checkBoxInnerStyle }) => checkBoxInnerStyle}
35
43
 
36
44
  `;
37
45
  CheckBoxInner.defaultProps = {
38
46
  themeColor: defaultThemeColor,
39
- signCheck: `${tick}`
47
+ // signCheck: `${tick}`
40
48
  }
41
49
 
42
50
  const OptionText = styled.span`
@@ -104,7 +112,9 @@ export const CheckBoxInput = ({ checkBoxOuterStyle, checkBoxInnerStyle, optionTe
104
112
  checkBoxInnerStyle={{ ...checkBoxInnerStyle, cursor: item?.disabled ? 'not-allowed ' : ' pointer', borderColor: item?.disabled && item?.disabledColor }}
105
113
  defaultBorderColor={defaultBorderColor}
106
114
  checkedCheckBoxColor={checkedCheckBoxColor}
107
- checked={!item?.disabled && item.checked} {...props} />
115
+ checked={!item?.disabled && item.checked} {...props} >
116
+ <Icon icon='check-icon' size={18} color='white' />
117
+ </CheckBoxInner>
108
118
  : <CheckBoxOuter
109
119
  theme={defaultStyles}
110
120
  defaultCheckBoxOuterStyle={'checkBox-outer'}
@@ -191,5 +201,4 @@ CheckBoxInput.defaultProps = {
191
201
  checkedTextColor: `${defaultThemeColor.neutral['neutral-1']}`,
192
202
  defaultBorderColor: '#D4D7E3',
193
203
  checkedCheckBoxColor: `${defaultThemeColor.primary['primary-1']}`,
194
- }
195
-
204
+ }