groundfloor-react-ui 1.0.0 → 1.0.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 (34) hide show
  1. package/README.md +9 -2
  2. package/assets/icons/eye-hide.svg +1 -1
  3. package/assets/icons/file-upload.svg +3 -0
  4. package/components/Accordion/Accordion.js +2 -2
  5. package/components/Button/PrimaryButton.js +4 -7
  6. package/components/Button/SecondaryButton.js +7 -8
  7. package/components/Footer/{FooterContentLev3.js → FooterContent.js} +6 -2
  8. package/components/Footer/index.js +1 -1
  9. package/components/Form/FormComponent.js +5 -2
  10. package/components/Form/HeaderComponent.js +1 -6
  11. package/components/Icon/Icon.js +16 -6
  12. package/components/Inputs/CheckBoxInput.js +1 -1
  13. package/components/Inputs/DateSelect.js +3 -4
  14. package/components/Inputs/DropdownSelect.js +292 -289
  15. package/components/Inputs/DropzoneInput.js +225 -137
  16. package/components/Inputs/NumericInput.js +6 -11
  17. package/components/Inputs/PasswordInput.js +192 -0
  18. package/components/Inputs/Signature.js +142 -109
  19. package/components/Inputs/TextArea.js +3 -4
  20. package/components/Inputs/TextInput.js +6 -7
  21. package/components/Inputs/TimeInput.js +5 -6
  22. package/components/Inputs/index.js +1 -0
  23. package/components/Modal/ModalComp.js +80 -46
  24. package/components/Modal/index.js +0 -1
  25. package/components/constants/defaultStyle.js +28 -33
  26. package/components/constants/defaultThemeColor.js +2 -1
  27. package/dist/index.es.js +538 -493
  28. package/dist/index.js +388 -343
  29. package/package.json +1 -1
  30. package/components/Inputs/CheckBoxEditableInput.js +0 -352
  31. package/components/Inputs/CheckBoxInputMS.js +0 -160
  32. package/components/Inputs/TextInputClicable.js +0 -198
  33. package/components/Inputs/TextInputClicableMS.js +0 -255
  34. package/components/Modal/Modal.js +0 -116
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "groundfloor-react-ui",
3
3
  "description": "Official component library for Ground Floor",
4
- "version": "1.0.0",
4
+ "version": "1.0.3",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
7
7
  "private": false,
@@ -1,352 +0,0 @@
1
- import React, { useRef} from 'react';
2
- import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
- import defaultThemeColor from '../../constants/defaultThemeColor';
5
- import tick from '../../assets/icons/checkmark.svg';
6
- import editIcon from '../../assets/icons/edit-icon.svg';
7
- import { Icon } from "../Icon";
8
- import { TextInput, CheckBoxInput } from '../..';
9
-
10
- const CheckBox = styled.input.attrs({ type: "checkbox" })`
11
- border: none;
12
- margin: 0;
13
- margin-top: -4px;
14
- width: 10px;
15
- height: 10px;
16
- display: inline-block;
17
- cursor:pointer;
18
- visibility: hidden;
19
-
20
- &:focus {
21
- border: 1.5px solid ${({ theme }) => theme.variant['primary-1']};
22
- outline: none;
23
- }
24
-
25
- &:after {
26
- background-color: ${({theme})=>theme.bgColor};
27
- border: 1.5px solid ${({ theme }) => theme.variant['primary-1']};
28
- border-radius: 2px;
29
- content: " ";
30
- display: inline-block;
31
- visibility: visible;
32
- width: inherit;
33
- height: inherit;
34
- }
35
- &:checked:before {
36
- content: '';
37
- color: ${({theme})=>theme.bgColor};
38
- }
39
- &:checked:after {
40
- background-image: url(${tick});
41
- background-repeat: no-repeat;
42
- background-position: center;
43
- width: 10px;
44
- height: 10px;
45
- color: ${({theme})=>theme.bgColor};
46
- background-color: ${({ theme, variant }) => theme.variant[variant]};
47
- border: 1.5px solid ${({ theme, variant }) => theme.variant[variant]};
48
- border-radius: 2px solid ${({ theme, variant }) => theme.variant['primary-1']};
49
- text-align: center;
50
- }
51
-
52
- `;
53
-
54
- CheckBox.defaultProps = {
55
- theme: defaultThemeColor,
56
- }
57
-
58
- const Label = styled.label`
59
- display: block;
60
- margin-bottom: ${({ labelInline }) => !labelInline ? '27px' : ''};
61
- margin-right: ${({ labelInline }) => labelInline ? '26px' : ''};
62
- color: ${({ theme }) => theme.variant['neutral-1']};
63
- `;
64
- Label.defaultProps = {
65
- theme: defaultThemeColor,
66
- }
67
-
68
- const OptionText = styled.input`
69
- background-color: ${({theme})=>theme.bgColor};
70
- border: none;
71
- outline: none;
72
- height: inherit;
73
- width: inherit;
74
- color: ${defaultThemeColor.textColor};
75
- font-size: 14px;
76
- line-height: 16px;
77
- margin-left: 12px;
78
- display: none;
79
-
80
- &:focus-within {
81
- border: none;
82
- outline: none;
83
- }
84
- `;
85
-
86
- OptionText.defaultProps = {
87
- theme: defaultThemeColor,
88
- }
89
-
90
- const WrapperDiv = styled.label`
91
- padding-top: 8px;
92
- padding-bottom: 8px;
93
- padding-left:11px;
94
- padding-right:11px;
95
- align-items: baseline;
96
- display: flex;
97
- gap: 0;
98
- width: 100%;
99
- `;
100
-
101
- const OutterDiv = styled.div`
102
- display: flex;
103
- gap: 0;
104
- background: ${({ theme }) => theme.bgColor};
105
- border: 1px solid ${({ theme }) => theme.variant['neutral-4']};;
106
- border-radius: 6px;
107
- cursor: pointer;
108
- margin-bottom: 13px;
109
- width: inherit;
110
- max-width: 444px;
111
- `;
112
-
113
- OutterDiv.defaultProps = {
114
- theme: defaultThemeColor,
115
- }
116
-
117
- WrapperDiv.defaultProps = {
118
- theme: defaultThemeColor,
119
- }
120
-
121
- const ParentDiv = styled.div`
122
- display: inline-flex;
123
- width: 100%;
124
- flex-direction: column;
125
- flex-wrap: wrap;
126
- align-content: flex-start;;
127
- justify-content: center;
128
- `
129
-
130
- const IconDiv = styled.span`
131
- cursor: pointer;
132
- margin-left: auto;
133
- display: flex;
134
- justify-content: center;
135
- `;
136
-
137
- const TextDiv = styled.div`
138
- display: flex;
139
- align-items: center;
140
- width: inherit;
141
- `;
142
-
143
- const OtherDiv = styled.div`
144
- display: flex;
145
- flex-direction: column;
146
- align-items: flex-start;
147
- width: calc(100% - 30px) !important;
148
- `;
149
-
150
- const OptionSpan = styled.span`
151
- padding-right: 6px;
152
- margin-left: 14px;
153
- font-size: 14px;
154
- line-height: 17px;
155
- `;
156
-
157
-
158
- const CheckBoxEditableInput = ({ theme, label, previewMode, previewModeHeader, options, setOptions, other, setOther, otherValue, setOtherValue, variant, ...props }) => {
159
- const myRefs = useRef([]);
160
- const mySpanRefs = useRef([]);
161
- let newOptions = [];
162
-
163
- const changeHandler = (i) => {
164
- console.log("changeHandler");
165
- myRefs.current[i].disabled = false;
166
- mySpanRefs.current[i].style.display = 'none';
167
- myRefs.current[i].style.display = 'block';
168
- myRefs.current[i].focus();
169
- };
170
-
171
- const changeValue = (e, i) => {
172
- newOptions = [...options]
173
- newOptions[i].label = e.target.value;
174
- }
175
-
176
- const saveValue = (i) => {
177
- setOptions(newOptions);
178
- myRefs.current[i].disabled = true;
179
- mySpanRefs.current[i].style.display = 'inline';
180
- myRefs.current[i].style.display = 'none';
181
- }
182
-
183
- const saveLabel = (e, i) => {
184
- if (e.key === "Enter") {
185
- saveValue(i);
186
- }
187
- }
188
-
189
-
190
- const deleteLabel = (i) => {
191
- setOptions(prevState => {
192
- const items = [...prevState];
193
- items.splice(i, 1);
194
- return items;
195
- });
196
- }
197
-
198
- return (
199
- <div {...props}>
200
- {label.length>0 && <Label {...props} >
201
- {label}
202
- </Label>}
203
- <ParentDiv {...props}>
204
- {options?.map((item, i) => {
205
- return <OutterDiv key={i} >
206
- <WrapperDiv
207
- key={Math.random() * 101 | 0}
208
- {...props}>
209
- <CheckBox variant={variant} disabled={true}
210
- {...props} />
211
- <TextDiv>
212
- <OptionText
213
- ref={(el) => (myRefs.current[i] = el)}
214
- disabled={true}
215
- onChange={(e) => changeValue(e, i)}
216
- onBlur={() => saveValue(i)}
217
- onKeyPress={(e) => saveLabel(e, i)}
218
- defaultValue={item.label} />
219
- <OptionSpan>
220
- <span
221
- style={{paddingRight:'4px'}}
222
- ref={(el) => (mySpanRefs.current[i] = el)}>{item.label}
223
- </span>
224
- <img key={Math.random() * 101 | 0}
225
- style={{ cursor: 'pointer', marginLeft: '10px' }}
226
- onClick={() => changeHandler(i)}
227
- src={editIcon}
228
- alt="Edit" />
229
- </OptionSpan>
230
- </TextDiv>
231
- <IconDiv key={Math.random() * 101 | 0}
232
- onClick={() => deleteLabel(i)}>
233
- <Icon icon='cross-icon'
234
- size={12}
235
- color={theme.neutral['neutral-2']} />
236
- </IconDiv>
237
- </WrapperDiv>
238
- </OutterDiv>
239
- })}
240
-
241
- {other &&
242
- <OutterDiv>
243
- <ParentDiv>
244
- <WrapperDiv style={{ paddingTop: 0 }}>
245
- <CheckBox style={{ marginTop: '-52px' }} disabled={true} />
246
- <OtherDiv>
247
- <div style={{ display: 'flex', alignItems: 'center', width: "100%" }}>
248
- <span style={{
249
- paddingTop: '10px',
250
- marginLeft: '14px',
251
- fontSize: '14px',
252
- lineHeight: '16px',
253
- color: '#6B747F'
254
- }}>
255
- Others
256
- </span>
257
- <IconDiv style={{ marginTop: 0, marginRight:'3px' }}
258
- key={Math.random() * 101 | 0}
259
- onClick={() => setOther(false)}>
260
- <Icon icon='cross-icon'
261
- size={12}
262
- color={theme.neutral['neutral-2']} />
263
- </IconDiv>
264
- </div>
265
- <div style={{
266
- marginTop: '10px', marginLeft: '8px', width: 'inherit'
267
- }}>
268
- <TextInput
269
- placeholder="Type Something..."
270
- value={otherValue}
271
- onChange={(e) => setOtherValue(e.target.value)} />
272
- </div>
273
- </OtherDiv>
274
- </WrapperDiv>
275
- </ParentDiv>
276
- </OutterDiv>}
277
- </ParentDiv>
278
- {previewMode &&
279
- <CheckBoxInput
280
- variant='primary-1'
281
- label={previewModeHeader}
282
- options={options}
283
- setOptions={setOptions}
284
- inline={false} />
285
- }
286
- </div>
287
- )
288
- }
289
-
290
- CheckBoxEditableInput.propTypes = {
291
- /**
292
- * Theme props
293
- */
294
- theme: PropTypes.object,
295
- /**
296
- * Type of color on background of checkbox
297
- */
298
- variant: PropTypes.string,
299
- /**
300
- * Label of Checkbox editor
301
- */
302
- label: PropTypes.string,
303
- /**
304
- * Preview mode enable or not
305
- */
306
- previewMode: PropTypes.bool,
307
- /**
308
- * Preview mode header
309
- */
310
- previewModeHeader: PropTypes.string,
311
- /**
312
- * Other Value in the textbox
313
- */
314
- otherValue: PropTypes.string,
315
- /**
316
- * Other Value in the setter
317
- */
318
- setOtherValue: PropTypes.func,
319
- /**
320
- * Other Value should be showed or not
321
- */
322
- other: PropTypes.bool,
323
- /**
324
- * Other Value should be showed or not setter
325
- */
326
- setOther: PropTypes.func,
327
- /**
328
- * Array that will be rendered for checkbox options
329
- */
330
- options: PropTypes.array,
331
- /**
332
- * CheckBox label changeHandler
333
- */
334
- setOptions: PropTypes.func,
335
-
336
- }
337
-
338
- CheckBoxEditableInput.defaultProps = {
339
- theme: defaultThemeColor,
340
- variant: 'primary-1',
341
- label: '',
342
- previewMode:true,
343
- previewModeHeader:'',
344
- otherValue:'',
345
- setOtherValue:()=>{},
346
- other: false,
347
- setOther: () => {},
348
- options:[],
349
- setOptions: () => {},
350
- }
351
-
352
- export default CheckBoxEditableInput;
@@ -1,160 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import styled, { useTheme } from 'styled-components';
4
- import defaultThemeColor from '../../constants/defaultThemeColor';
5
- import tick from '../../assets/icons/checkmark.svg';
6
-
7
- const border = `#D4D7E3`;
8
-
9
- const CheckBox = styled.input.attrs({ type: "checkbox" })`
10
- width: 15px;
11
- height: 15px;
12
- cursor:pointer;
13
- visibility: hidden;
14
- margin: 0;
15
-
16
- &:focus {
17
- border: 2px solid ${({ theme, variant }) => theme.variant[variant]};
18
- outline: none;
19
- }
20
-
21
- &:after {
22
- background-color: ${border};
23
- border-radius: 3px;
24
- content: " ";
25
- display: inline-block;
26
- visibility: visible;
27
- width: inherit;
28
- height: inherit;
29
- }
30
-
31
- &:checked:before {
32
- content: '';
33
- color: white;
34
- }
35
-
36
- &:checked:after {
37
- background-image: url(${tick});
38
- background-size: 8px 11px;
39
- background-repeat: no-repeat;
40
- background-position: center;
41
- width: 15px;
42
- height: 15px;
43
- color: white;
44
- background-color: ${({ theme, variant, color }) => color ? color : theme.variant[variant]};
45
- border-radius: 3px;
46
- text-align: center;
47
- }
48
- `;
49
-
50
- const Label = styled.label`
51
- display: block;
52
- margin-bottom: ${({ labelInline }) => !labelInline ? '27px' : ''};
53
- margin-right: ${({ labelInline }) => labelInline ? '26px' : ''};
54
- color: ${({ theme }) => theme.variant['neutral-1']};
55
- `;
56
- // margin-right: ${({ inline }) => !inline ? '30px' : ''};
57
- const OptionText = styled.span`
58
- background-color: transparent;
59
- color: ${defaultThemeColor.variant['primary-2']};
60
- font-size: 14px;
61
- margin-left: 10px;
62
- margin-right: 0px;
63
- ${CheckBox}:checked + && {
64
- color: ${defaultThemeColor.variant['primary-2']};
65
- }
66
- white-space: nowrap;
67
- overflow: hidden;
68
- text-overflow: ellipsis;
69
- `;
70
-
71
- const WrapperDiv = styled.label`
72
- margin-bottom: ${({ inline }) => !inline ? '0px' : ''};
73
- align-items: center;
74
- display: flex;
75
- line-height: 17.3px;
76
- `
77
- const ParentDiv = styled.div`
78
- display: ${({ inline }) => !inline ? "block" : "inline-flex"};
79
- width: auto;
80
- padding: 8px 18.3px;
81
- `
82
-
83
- const CheckBoxInputMS = ({ label, options, variant, inline, myKey, color, ...props }) => {
84
- return (
85
- <div {...props}>
86
- <ParentDiv inline={inline} {...props} >
87
- {options?.map((item, i) => {
88
- return <WrapperDiv
89
- key={myKey.concat((Math.random() * 101 | 0).toString())}
90
- onClick={() => { item.checked = !item.checked }}
91
- inline={inline} {...props}
92
- >
93
- <CheckBox
94
- variant={variant}
95
- checked={item.checked}
96
- color={color}
97
- {...props}
98
- />
99
- <OptionText>{item.label}</OptionText>
100
- </WrapperDiv>
101
- })}
102
- </ParentDiv>
103
- </div>
104
- )
105
- }
106
-
107
- CheckBox.defaultProps = {
108
- theme: defaultThemeColor,
109
- }
110
-
111
- OptionText.defaultProps = {
112
- theme: defaultThemeColor,
113
- }
114
-
115
- Label.defaultProps = {
116
- theme: defaultThemeColor,
117
- }
118
-
119
- CheckBoxInputMS.propTypes = {
120
- /**
121
- * Type of color on background of checkbox
122
- */
123
- variant: PropTypes.string,
124
- /**
125
- * Label of Checkboxs
126
- */
127
- label: PropTypes.string,
128
- /**
129
- * Should checkboxes be inline?
130
- */
131
- inline: PropTypes.bool,
132
- /**
133
- * CheckBox Contents
134
- */
135
- options: PropTypes.array,
136
- /**
137
- * CheckBox Contents
138
- */
139
- onChange: PropTypes.func,
140
- /**
141
- * Custom color on background of checkbox if present override the variant
142
- */
143
- color: PropTypes.string,
144
- /**
145
- * Prefix to use for the key for the element when mapping
146
- */
147
- myKey: PropTypes.string,
148
- }
149
-
150
- CheckBoxInputMS.defaultProps = {
151
- variant: 'primary-1',
152
- label: '',
153
- inline: false,
154
- options: [],
155
- onChange: undefined,
156
- color: null,
157
- myKey: null
158
- }
159
-
160
- export default CheckBoxInputMS;
@@ -1,198 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import PropTypes from 'prop-types';
3
- import styled, { css, useTheme } from 'styled-components';
4
- import defaultThemeColor from '../../constants/defaultThemeColor';
5
-
6
- const border = `#D4D7E3`;
7
-
8
- const TextBox = styled.div`
9
- border: 1px solid ${({ theme, isValid }) => isValid ? border : theme.variant['error']};
10
- border-radius: 4px;
11
- padding: 8px 12px;
12
- display: flex;
13
- align-items: center;
14
- position: relative;
15
- z-index: 2;
16
- cursor: pointer;
17
-
18
- .input-icon svg path {
19
- fill: ${({ theme }) => theme.variant['primary-2']};
20
- }
21
-
22
- &:focus-within {
23
- border: 1px solid ${({ theme }) => theme.variant['primary-1']};
24
- outline: none;
25
-
26
- .input-icon svg path {
27
- fill: ${({ theme, iconVariant }) => theme.variant[iconVariant]};
28
- }
29
- }
30
- `;
31
-
32
- TextBox.defaultProps = {
33
- theme: defaultThemeColor,
34
- }
35
-
36
- const InputBorder = styled.div`
37
- position: absolute;
38
- top: calc(100% - 3px);
39
- bottom: -2px;
40
- left: 0;
41
- right: 0;
42
- z-index: 0;
43
- border: 1px solid ${border};
44
- border-top: none;
45
- border-bottom: none;
46
- visibility: ${({ menuIsOpen }) => menuIsOpen ? 'visible' : 'hidden'}
47
- `
48
-
49
- const Input = styled.input`
50
- border: 0;
51
- outline: 0;
52
- color: ${({ theme }) => theme.variant['primary-2']};
53
- margin: 0 5px;
54
- padding: 0;
55
- font-size: 14px;
56
- flex-grow: 1;
57
- flex-shrink: 0;
58
- cursor: pointer;
59
- white-space: nowrap;
60
- overflow: hidden;
61
- text-overflow: ellipsis;
62
-
63
- ::placeholder {
64
- color: ${({ theme, textValue }) => textValue ? theme.variant['primary-2'] : theme.variant['neutral-3']};
65
- }
66
- `;
67
-
68
- Input.defaultProps = {
69
- theme: defaultThemeColor,
70
- }
71
-
72
- const requiredAsterisk = css`
73
- &:after {
74
- content:" *";
75
- color: ${({ theme }) => theme.variant['error']};
76
- }
77
- `
78
-
79
- const Label = styled.label`
80
- display: block;
81
- margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '8px'};
82
- margin-right: ${({ labelInline }) => labelInline ? '10px' : ''};
83
- color: ${({ theme }) => theme.variant['neutral-2']};
84
- ${({ required }) => required ? requiredAsterisk : null}
85
- `;
86
-
87
- Label.defaultProps = {
88
- theme: defaultThemeColor,
89
- }
90
-
91
- const inline = css`
92
- display: flex;
93
- align-items: center;
94
- `
95
-
96
- const Form = styled.div`
97
- ${({ labelInline }) => labelInline ? inline : null}
98
- .err-text {
99
- color: ${({ theme }) => theme.variant['error']};
100
- margin-top: 5px;
101
- font-size: 10px;
102
- }
103
-
104
- > div {
105
- flex: 1 0 auto;
106
- }
107
- `
108
-
109
- Form.defaultProps = {
110
- theme: defaultThemeColor,
111
- }
112
-
113
- const TextInputClicable = forwardRef(({ label, errMsg, iconBefore, iconAfter, onClick, onBlur, iconVariant, readonly, value, placeHolder, onChange, inputText, textValue, autofocusP, menuIsOpen, ...props }, ref) => {
114
- const theme = useTheme() || defaultThemeColor;
115
-
116
- return (
117
- <Form {...props}>
118
- <Label {...props} errMsg={errMsg} >
119
- {label}
120
- </Label>
121
- <div ref={ref.refForm}>
122
- <InputBorder menuIsOpen={menuIsOpen}></InputBorder>
123
- <TextBox
124
- {...props}
125
- onClick={onClick}
126
- >
127
- <div className="input-icon">
128
- {iconBefore}
129
- </div>
130
- <Input
131
- {...props}
132
- ref={ref.refInput}
133
- readOnly={readonly}
134
- onChange={onChange}
135
- value={value}
136
- placeholder={placeHolder}
137
- textValue={textValue} //for styling
138
- autoFocus={autofocusP}
139
- menuIsOpen={menuIsOpen}
140
- size='1'
141
- />
142
- <div className="input-icon">
143
- {iconAfter}
144
- </div>
145
- </TextBox>
146
- {!menuIsOpen && <div className='err-text'>{errMsg}</div>}
147
- </div>
148
- </Form>
149
- )
150
- })
151
-
152
- TextInputClicable.propTypes = {
153
- /**
154
- * Theme props
155
- */
156
- theme: PropTypes.object,
157
- /**
158
- * Label of Input
159
- */
160
- label: PropTypes.string,
161
- /**
162
- * Is the input required?
163
- */
164
- required: PropTypes.bool,
165
- /**
166
- * Should label be inline?
167
- */
168
- labelInline: PropTypes.bool,
169
- /**
170
- * Is the input correct?
171
- */
172
- isValid: PropTypes.bool,
173
- /**
174
- * Error Message
175
- */
176
- errMsg: PropTypes.string,
177
- /**
178
- * Icon before input value
179
- */
180
- iconBefore: PropTypes.any,
181
- /**
182
- * Icon after input value
183
- */
184
- iconAfter: PropTypes.any,
185
- }
186
-
187
- TextInputClicable.defaultProps = {
188
- theme: defaultThemeColor,
189
- label: '',
190
- required: false,
191
- labelInline: false,
192
- isValid: true,
193
- errMsg: '',
194
- iconBefore: null,
195
- iconAfter: null,
196
- }
197
-
198
- export default TextInputClicable;