groundfloor-react-ui 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/assets/icons/eye-hide.svg +1 -1
- package/components/Button/PrimaryButton.js +4 -7
- package/components/Button/SecondaryButton.js +7 -8
- package/components/Footer/{FooterContentLev3.js → FooterContent.js} +6 -2
- package/components/Footer/index.js +1 -1
- package/components/Form/FormComponent.js +4 -1
- package/components/Icon/Icon.js +10 -0
- package/components/Inputs/CheckBoxInput.js +1 -1
- package/components/Inputs/DateSelect.js +1 -2
- package/components/Inputs/DropdownSelect.js +176 -174
- package/components/Inputs/DropzoneInput.js +3 -5
- package/components/Inputs/NumericInput.js +5 -9
- package/components/Inputs/PasswordInput.js +192 -0
- package/components/Inputs/TextArea.js +2 -2
- package/components/Inputs/TextInput.js +4 -2
- package/components/Inputs/TimeInput.js +2 -2
- package/components/Inputs/index.js +1 -0
- package/components/Modal/ModalComp.js +20 -8
- package/components/constants/defaultStyle.js +13 -14
- package/dist/index.es.js +248 -183
- package/dist/index.js +288 -223
- package/package.json +1 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
6
|
+
import getDefaultStyles from '../constants/utils';
|
|
7
|
+
import { Label } from '../Label';
|
|
8
|
+
import { Icon } from '../Icon';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
|
|
12
|
+
const TextWrapper = styled.div`
|
|
13
|
+
//Set the styles from the default styles object
|
|
14
|
+
${({ theme, defaultWrapperStyle }) => {
|
|
15
|
+
return getDefaultStyles(theme, defaultWrapperStyle);
|
|
16
|
+
}}
|
|
17
|
+
|
|
18
|
+
border: ${({ isValid, themeColor }) =>
|
|
19
|
+
!isValid
|
|
20
|
+
? '1px solid ' + themeColor.variant['error']
|
|
21
|
+
: '1px solid ' + defaultThemeColor.border};
|
|
22
|
+
|
|
23
|
+
.input-icon svg path {
|
|
24
|
+
fill: ${({ themeColor }) => themeColor.variant['neutral-1']};
|
|
25
|
+
}
|
|
26
|
+
.input-icon {
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:focus-within {
|
|
31
|
+
border: 1px solid ${({ themeColor }) => themeColor.variant['primary-1']};
|
|
32
|
+
outline: none;
|
|
33
|
+
|
|
34
|
+
.input-icon svg path {
|
|
35
|
+
fill: ${({ themeColor }) => themeColor.variant['primary-1']};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// custom styles
|
|
40
|
+
${({ textBoxStyle }) => textBoxStyle}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const Input = styled.input`
|
|
44
|
+
width: inherit;
|
|
45
|
+
//Set the styles from the default styles object
|
|
46
|
+
${({ theme, defaultInputStyle }) => {
|
|
47
|
+
return getDefaultStyles(theme, defaultInputStyle);
|
|
48
|
+
}}
|
|
49
|
+
|
|
50
|
+
// custom styles
|
|
51
|
+
${({ inputStyle }) => inputStyle}
|
|
52
|
+
|
|
53
|
+
.sc-furwcr bxRAoq {
|
|
54
|
+
color: ${defaultThemeColor.variant['neutral-3']};
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const inline = css`
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: 7px;
|
|
61
|
+
align-items: center;
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
const Form = styled.div`
|
|
65
|
+
${({ labelInline }) => (labelInline ? inline : null)}
|
|
66
|
+
.err-text {
|
|
67
|
+
color: ${({ themeColor }) => themeColor.variant['error']};
|
|
68
|
+
margin-top: 5px;
|
|
69
|
+
font-size: 10px;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
Form.defaultProps = {
|
|
74
|
+
themeColor: defaultThemeColor,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const PasswordInput = ({
|
|
78
|
+
themeColor,
|
|
79
|
+
textBoxStyle,
|
|
80
|
+
labelStyle,
|
|
81
|
+
inputStyle,
|
|
82
|
+
errMsg,
|
|
83
|
+
required,
|
|
84
|
+
label,
|
|
85
|
+
labelInline,
|
|
86
|
+
isValid,
|
|
87
|
+
...props
|
|
88
|
+
}) => {
|
|
89
|
+
const [showEye, setShowEye] = useState(false);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Form labelInline={labelInline} {...props}>
|
|
93
|
+
<div style={{ display: 'flex' }}>
|
|
94
|
+
<Label
|
|
95
|
+
customStyles={labelStyle}
|
|
96
|
+
type={'label-text'}
|
|
97
|
+
labelInline={labelInline}
|
|
98
|
+
text={label}
|
|
99
|
+
errMsg={errMsg}
|
|
100
|
+
style={{
|
|
101
|
+
display: 'flex',
|
|
102
|
+
marginBottom: `${!labelInline ? '7px' : ''}`,
|
|
103
|
+
}}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
{required && (
|
|
107
|
+
<div
|
|
108
|
+
style={{
|
|
109
|
+
marginLeft: '4px',
|
|
110
|
+
color: `${themeColor.variant['error']}`,
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
*
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
<TextWrapper
|
|
118
|
+
required={required}
|
|
119
|
+
themeColor={defaultThemeColor}
|
|
120
|
+
textBoxStyle={textBoxStyle}
|
|
121
|
+
isValid={isValid}
|
|
122
|
+
theme={defaultStyles}
|
|
123
|
+
defaultWrapperStyle={'textbox-wrapper'}
|
|
124
|
+
{...props}
|
|
125
|
+
>
|
|
126
|
+
<Input
|
|
127
|
+
inputStyle={inputStyle}
|
|
128
|
+
type={showEye ? 'text' : 'password'}
|
|
129
|
+
defaultInputStyle={'input-wrapper'}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
<div className='input-icon' onClick={() => setShowEye(!showEye)}>
|
|
133
|
+
{showEye ? <Icon icon='eye-show' /> : <Icon icon='eye-hide' />}
|
|
134
|
+
</div>
|
|
135
|
+
</TextWrapper>
|
|
136
|
+
{errMsg.length > 0 && <div className='err-text'>{errMsg}</div>}
|
|
137
|
+
</Form>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
PasswordInput.propTypes = {
|
|
142
|
+
/**
|
|
143
|
+
* Theme props of default in-built css
|
|
144
|
+
*/
|
|
145
|
+
theme: PropTypes.object,
|
|
146
|
+
/**
|
|
147
|
+
* Color props of default theme
|
|
148
|
+
*/
|
|
149
|
+
themeColor: PropTypes.object,
|
|
150
|
+
/**
|
|
151
|
+
* Label of Input
|
|
152
|
+
*/
|
|
153
|
+
label: PropTypes.string,
|
|
154
|
+
/**
|
|
155
|
+
* Is the input required?
|
|
156
|
+
*/
|
|
157
|
+
required: PropTypes.bool,
|
|
158
|
+
/**
|
|
159
|
+
* Should label be inline with textbox?
|
|
160
|
+
*/
|
|
161
|
+
labelInline: PropTypes.bool,
|
|
162
|
+
/**
|
|
163
|
+
* Error Message
|
|
164
|
+
*/
|
|
165
|
+
errMsg: PropTypes.string,
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* custom style of textbox Wrapper
|
|
169
|
+
*/
|
|
170
|
+
textBoxStyle: PropTypes.object,
|
|
171
|
+
/**
|
|
172
|
+
* custom style of textbox input
|
|
173
|
+
*/
|
|
174
|
+
labelStyle: PropTypes.object,
|
|
175
|
+
/**
|
|
176
|
+
* custom style of textbox label
|
|
177
|
+
*/
|
|
178
|
+
inputStyle: PropTypes.object,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
PasswordInput.defaultProps = {
|
|
182
|
+
themeColor: defaultThemeColor,
|
|
183
|
+
theme: defaultStyles,
|
|
184
|
+
label: '',
|
|
185
|
+
required: false,
|
|
186
|
+
isValid: true,
|
|
187
|
+
labelInline: false,
|
|
188
|
+
errMsg: '',
|
|
189
|
+
textBoxStyle: {},
|
|
190
|
+
labelStyle: {},
|
|
191
|
+
inputStyle: {},
|
|
192
|
+
};
|
|
@@ -52,7 +52,7 @@ const Input = styled.textarea`
|
|
|
52
52
|
|
|
53
53
|
const inline = css`
|
|
54
54
|
display: flex;
|
|
55
|
-
gap:
|
|
55
|
+
gap: 7px;
|
|
56
56
|
align-items: center;
|
|
57
57
|
`
|
|
58
58
|
|
|
@@ -89,7 +89,7 @@ export const TextArea = React.forwardRef(({ themeColor, customStylesForm, textAr
|
|
|
89
89
|
errMsg={errMsg}
|
|
90
90
|
style={{
|
|
91
91
|
'display': 'flex',
|
|
92
|
-
'paddingBottom': `${!labelInline ? '
|
|
92
|
+
'paddingBottom': `${!labelInline ? '7px' : ''}`,
|
|
93
93
|
}}
|
|
94
94
|
{...props} />
|
|
95
95
|
{required && <div style={{
|
|
@@ -35,6 +35,8 @@ const TextWrapper = styled.div`
|
|
|
35
35
|
`;
|
|
36
36
|
|
|
37
37
|
const Input = styled.input`
|
|
38
|
+
width:inherit;
|
|
39
|
+
|
|
38
40
|
//Set the styles from the default styles object
|
|
39
41
|
${({ theme, defaultInputStyle }) => {
|
|
40
42
|
return getDefaultStyles(theme, defaultInputStyle);
|
|
@@ -51,7 +53,7 @@ const Input = styled.input`
|
|
|
51
53
|
|
|
52
54
|
const inline = css`
|
|
53
55
|
display: flex;
|
|
54
|
-
|
|
56
|
+
gap: 7px;
|
|
55
57
|
align-items: center;
|
|
56
58
|
`
|
|
57
59
|
|
|
@@ -80,7 +82,7 @@ export const TextInput = ({ themeColor, textBoxStyle, labelStyle, inputStyle, er
|
|
|
80
82
|
errMsg={errMsg}
|
|
81
83
|
style={{
|
|
82
84
|
'display': 'flex',
|
|
83
|
-
'marginBottom': `${!labelInline ? '
|
|
85
|
+
'marginBottom': `${!labelInline ? '7px' : ''}`,
|
|
84
86
|
}}
|
|
85
87
|
{...props} />
|
|
86
88
|
{required && <div style={{
|
|
@@ -46,8 +46,8 @@ const requiredAsterisk = css`
|
|
|
46
46
|
|
|
47
47
|
const Label = styled.label`
|
|
48
48
|
display: block;
|
|
49
|
-
margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '
|
|
50
|
-
margin-right: ${({ labelInline }) => labelInline ? '
|
|
49
|
+
margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '7px'};
|
|
50
|
+
margin-right: ${({ labelInline }) => labelInline ? '7px' : ''};
|
|
51
51
|
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
52
52
|
${({ required }) => required ? requiredAsterisk : null}
|
|
53
53
|
`;
|
|
@@ -9,17 +9,19 @@ import defaultThemeColor from '../constants/defaultThemeColor';
|
|
|
9
9
|
|
|
10
10
|
const customStyles = {
|
|
11
11
|
overlay: {
|
|
12
|
-
zIndex: '
|
|
12
|
+
zIndex: '999999',
|
|
13
|
+
backgroundColor: 'rgb(0 0 0 / 30%)'
|
|
13
14
|
},
|
|
14
15
|
content: {
|
|
16
|
+
borderColor: defaultThemeColor.border,
|
|
15
17
|
top: '50%',
|
|
16
18
|
left: '50%',
|
|
17
19
|
right: 'auto',
|
|
18
20
|
bottom: 'auto',
|
|
19
21
|
marginRight: '-50%',
|
|
20
|
-
padding: '
|
|
22
|
+
padding: '0px',
|
|
21
23
|
transform: 'translate(-50%, -50%)',
|
|
22
|
-
maxHeight: '
|
|
24
|
+
maxHeight: '75vh'
|
|
23
25
|
},
|
|
24
26
|
};
|
|
25
27
|
|
|
@@ -30,7 +32,11 @@ const ModalClose = styled.button`
|
|
|
30
32
|
}}
|
|
31
33
|
// custom styles
|
|
32
34
|
${({ customModalCloseStyle }) => customModalCloseStyle}
|
|
33
|
-
|
|
35
|
+
//Set the styles from the default styles object
|
|
36
|
+
&:focus{
|
|
37
|
+
outline: none;
|
|
38
|
+
border: none;
|
|
39
|
+
}
|
|
34
40
|
`;
|
|
35
41
|
|
|
36
42
|
const ModalHeader = styled.div`
|
|
@@ -66,6 +72,10 @@ const ModalFooter = styled.div`
|
|
|
66
72
|
${({ customModalFooterStyle }) => customModalFooterStyle}
|
|
67
73
|
`;
|
|
68
74
|
|
|
75
|
+
const CommonDiv = styled.div`
|
|
76
|
+
padding: 2rem 3rem 0rem 3rem;
|
|
77
|
+
`;
|
|
78
|
+
|
|
69
79
|
Modal.setAppElement('#root');
|
|
70
80
|
|
|
71
81
|
export const ModalComp = ({
|
|
@@ -102,13 +112,16 @@ export const ModalComp = ({
|
|
|
102
112
|
/>
|
|
103
113
|
</ModalClose>
|
|
104
114
|
|
|
105
|
-
<ModalHeader style={customModalHeaderStyle}>
|
|
115
|
+
<ModalHeader style={customModalHeaderStyle}>
|
|
116
|
+
<CommonDiv>{headerContent}</CommonDiv>
|
|
117
|
+
</ModalHeader>
|
|
106
118
|
<ModalBody
|
|
107
119
|
theme={defaultStyles}
|
|
108
120
|
type={'modalComp-modal-body'}
|
|
109
121
|
style={customModalBodyStyle}
|
|
110
122
|
>
|
|
111
|
-
{bodyContent}
|
|
123
|
+
<CommonDiv> {bodyContent}
|
|
124
|
+
</CommonDiv>
|
|
112
125
|
</ModalBody>
|
|
113
126
|
|
|
114
127
|
<ModalFooter
|
|
@@ -176,5 +189,4 @@ ModalComp.defaultProps = {
|
|
|
176
189
|
customModalHeaderStyle: {},
|
|
177
190
|
customModalBodyStyle: {},
|
|
178
191
|
customModalFooterStyle: {},
|
|
179
|
-
};
|
|
180
|
-
|
|
192
|
+
};
|
|
@@ -15,13 +15,13 @@ const defaultStyles = {
|
|
|
15
15
|
'padding-left': '6px',
|
|
16
16
|
'font-style': 'normal',
|
|
17
17
|
'font-weight': 'normal',
|
|
18
|
-
'font-size': '
|
|
18
|
+
'font-size': '14px',
|
|
19
19
|
'display': 'flex',
|
|
20
20
|
'width': 'inherit',
|
|
21
21
|
'align-items': 'flex-start',
|
|
22
|
-
'color': '
|
|
23
|
-
'margin-bottom': '0'
|
|
24
|
-
|
|
22
|
+
'color': `${defaultThemeColor.variant['neutral-2']}`,
|
|
23
|
+
'margin-bottom': '0',
|
|
24
|
+
'padding-bottom': '0'
|
|
25
25
|
},
|
|
26
26
|
'button': {
|
|
27
27
|
'color': 'red',
|
|
@@ -144,7 +144,7 @@ const defaultStyles = {
|
|
|
144
144
|
'textbox-wrapper': {
|
|
145
145
|
'border': `1px solid ${defaultThemeColor.border}`,
|
|
146
146
|
'border-radius': '4px',
|
|
147
|
-
'padding': '
|
|
147
|
+
'padding': '6.5px 7px',
|
|
148
148
|
'display': 'flex',
|
|
149
149
|
'align-items': 'center',
|
|
150
150
|
'line-height': '.5rem',
|
|
@@ -243,7 +243,7 @@ const defaultStyles = {
|
|
|
243
243
|
fontSize: '14px',
|
|
244
244
|
fontWeight: '600',
|
|
245
245
|
'&:first-of-type': {
|
|
246
|
-
paddingLeft: '0px' //Remove default value since already apply the paddingLeft to the whole table to align the head to the body
|
|
246
|
+
paddingLeft: '0px !important' //Remove default value since already apply the paddingLeft to the whole table to align the head to the body
|
|
247
247
|
},
|
|
248
248
|
},
|
|
249
249
|
},
|
|
@@ -322,8 +322,8 @@ const defaultStyles = {
|
|
|
322
322
|
},
|
|
323
323
|
'radio-label': {
|
|
324
324
|
'display': 'block',
|
|
325
|
-
'margin-bottom': '
|
|
326
|
-
'color': '
|
|
325
|
+
'margin-bottom': '7px',
|
|
326
|
+
'color': `${defaultThemeColor.variant['neutral-2']}`
|
|
327
327
|
},
|
|
328
328
|
'option-text': {
|
|
329
329
|
// 'background-color': `${defaultThemeColor.bgColor}`,
|
|
@@ -365,7 +365,8 @@ const defaultStyles = {
|
|
|
365
365
|
},
|
|
366
366
|
'check-label': {
|
|
367
367
|
'display': 'block',
|
|
368
|
-
'margin-bottom': '
|
|
368
|
+
'margin-bottom': '7px',
|
|
369
|
+
'color': `${defaultThemeColor.variant['neutral-2']}`
|
|
369
370
|
},
|
|
370
371
|
'checkbox-option-text': {
|
|
371
372
|
'font-size': '16px',
|
|
@@ -375,7 +376,7 @@ const defaultStyles = {
|
|
|
375
376
|
'toggle-switch-wrapper': {
|
|
376
377
|
'display': 'flex',
|
|
377
378
|
'align-items': 'center',
|
|
378
|
-
'gap': '
|
|
379
|
+
'gap': '7px',
|
|
379
380
|
'width': 'fit-content',
|
|
380
381
|
},
|
|
381
382
|
'toggle-switch-checkbox-label': {
|
|
@@ -395,8 +396,7 @@ const defaultStyles = {
|
|
|
395
396
|
* Default Style of the dropZone component
|
|
396
397
|
*/
|
|
397
398
|
'dropzone-parent': {
|
|
398
|
-
'width': '
|
|
399
|
-
'max-width': '514px',
|
|
399
|
+
'width': '100%',
|
|
400
400
|
'height': '86px',
|
|
401
401
|
'padding-left': '8px',
|
|
402
402
|
'padding-right': '8px',
|
|
@@ -409,7 +409,6 @@ const defaultStyles = {
|
|
|
409
409
|
},
|
|
410
410
|
'dropzone-file-div': {
|
|
411
411
|
'width': 'inherit',
|
|
412
|
-
'max-width': '532px',
|
|
413
412
|
'height': '38px',
|
|
414
413
|
'display': 'flex',
|
|
415
414
|
'justify-content': 'center',
|
|
@@ -744,7 +743,7 @@ const defaultStyles = {
|
|
|
744
743
|
cursor: 'pointer'
|
|
745
744
|
},
|
|
746
745
|
'modalComp-modal-body': {
|
|
747
|
-
'margin-top': '
|
|
746
|
+
'margin-top': '20px',
|
|
748
747
|
'margin-bottom': '15px',
|
|
749
748
|
},
|
|
750
749
|
'modalComp-modal-footer': {
|