groundfloor-react-ui 1.0.18 → 1.0.21
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/components/Accordion/Accordion.js +83 -33
- package/components/Accordion/AccordionSB.js +50 -54
- package/components/Accordion/AccordionSBfooter.js +51 -55
- package/components/ArrowBar/ArrowBar.js +6 -23
- package/components/Avatar/Avatar.js +49 -45
- package/components/Avatar/AvatarSB.js +121 -92
- package/components/Avatar/AvatarSBfooter.js +113 -92
- package/components/Banner/Banner.js +40 -35
- package/components/Breadcrumb/Breadcrumb.js +178 -163
- package/components/Button/PrimaryButton.js +15 -8
- package/components/Button/SecondaryButton.js +11 -9
- package/components/Cards/Card.js +25 -30
- package/components/Cards/CardRef.js +41 -34
- package/components/Cards/DocumentCard.js +83 -89
- package/components/Divider/Divider.js +23 -30
- package/components/Drawer/Drawer.js +46 -55
- package/components/FilterChip/FilterChip.js +34 -32
- package/components/Form/HeaderComponent.js +57 -27
- package/components/GroupAvatars/GroupAvatars.js +12 -16
- package/components/GroupButtons/GroupButtonsPopup.js +3 -9
- package/components/Images/Image.js +16 -21
- package/components/Inputs/CheckBoxInput.js +71 -33
- package/components/Inputs/DateSelect.js +22 -17
- package/components/Inputs/DropdownSelect.js +86 -30
- package/components/Inputs/DropzoneInput.js +83 -68
- package/components/Inputs/NumericInput.js +66 -63
- package/components/Inputs/PasswordInput.js +36 -27
- package/components/Inputs/RadioInput.js +55 -29
- package/components/Inputs/Signature.js +88 -38
- package/components/Inputs/TextArea.js +24 -40
- package/components/Inputs/TextInput.js +43 -28
- package/components/Inputs/TimeInput.js +92 -107
- package/components/Inputs/ToggleSwitch.js +87 -59
- package/components/Modal/ModalComp.js +61 -37
- package/components/Pagination/Pagination.js +30 -54
- package/components/ProgressBar/ProgressBar.js +57 -40
- package/components/Rating/Rating.js +8 -14
- package/components/Sidebar/Navbar.js +196 -170
- package/components/Tables/Table.js +56 -34
- package/components/Tooltip/Tooltip.js +135 -141
- package/components/Typography/Typography.js +9 -10
- package/components/constants/defaultStyle.js +38 -41
- package/dist/index.es.js +675 -596
- package/dist/index.js +660 -581
- package/package.json +1 -1
|
@@ -1,31 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
3
|
import SignaturePad from 'react-signature-pad-wrapper';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
+
import styled, { useTheme } from 'styled-components';
|
|
5
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
4
6
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
import defaultStyle from '../constants/defaultStyle';
|
|
6
7
|
import getDefaultStyles from '../constants/utils';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
8
|
import { Icon } from '../Icon';
|
|
10
9
|
|
|
11
10
|
const ParentDiv = styled.div`
|
|
12
11
|
//Set the styles from the default styles object
|
|
13
|
-
${({
|
|
14
|
-
return getDefaultStyles(
|
|
12
|
+
${({ inBuiltCss, defaultParentDivStyle }) => {
|
|
13
|
+
return getDefaultStyles(inBuiltCss, defaultParentDivStyle);
|
|
15
14
|
}}
|
|
16
15
|
|
|
17
|
-
border: 1px solid ${({
|
|
18
|
-
isMyInputFocused
|
|
16
|
+
border: 1px solid ${({
|
|
17
|
+
isMyInputFocused,
|
|
18
|
+
activeColor,
|
|
19
|
+
defaultColor,
|
|
20
|
+
theme,
|
|
21
|
+
}) => {
|
|
22
|
+
if (isMyInputFocused && activeColor) return activeColor;
|
|
23
|
+
else if (isMyInputFocused && !activeColor)
|
|
24
|
+
return theme.primary['primary-1'];
|
|
25
|
+
else if (!isMyInputFocused && defaultColor) return defaultColor;
|
|
26
|
+
else if (!isMyInputFocused && !defaultColor)
|
|
27
|
+
return theme.neutral['neutral-3'];
|
|
28
|
+
}};
|
|
19
29
|
|
|
20
30
|
&:focus-within {
|
|
21
|
-
border-color: ${({ activeColor }) =>
|
|
31
|
+
border-color: ${({ activeColor, theme }) =>
|
|
32
|
+
activeColor ? activeColor : theme.primary['primary-1']};
|
|
22
33
|
}
|
|
23
34
|
`;
|
|
24
35
|
|
|
25
36
|
const WrapperDiv = styled.div`
|
|
26
37
|
//Set the styles from the default styles object
|
|
27
|
-
${({
|
|
28
|
-
return getDefaultStyles(
|
|
38
|
+
${({ inBuiltCss, defaultWrapperDivStyle }) => {
|
|
39
|
+
return getDefaultStyles(inBuiltCss, defaultWrapperDivStyle);
|
|
29
40
|
}}
|
|
30
41
|
|
|
31
42
|
flex-direction: ${({ signIcon }) => (signIcon ? 'column' : 'initial')};
|
|
@@ -33,8 +44,16 @@ const WrapperDiv = styled.div`
|
|
|
33
44
|
signIcon ? 'min-content' : 'calc(100% - 50px) !important'};
|
|
34
45
|
max-width: ${({ signIcon }) => (signIcon ? '42px' : '490px')};
|
|
35
46
|
border-right: 1px solid
|
|
36
|
-
${({ activeColor, defaultColor, isMyInputFocused, signIcon }) =>
|
|
37
|
-
signIcon
|
|
47
|
+
${({ activeColor, defaultColor, isMyInputFocused, signIcon, theme }) => {
|
|
48
|
+
if (signIcon && isMyInputFocused && activeColor) return activeColor;
|
|
49
|
+
else if (signIcon && isMyInputFocused && !activeColor)
|
|
50
|
+
return theme.primary['primary-1'];
|
|
51
|
+
else if (signIcon && !isMyInputFocused && defaultColor)
|
|
52
|
+
return defaultColor;
|
|
53
|
+
else if (signIcon && !isMyInputFocused && !defaultColor)
|
|
54
|
+
return theme.neutral['neutral-3'];
|
|
55
|
+
else if (!signIcon) return 'none';
|
|
56
|
+
}};
|
|
38
57
|
border-left: ${({ signIcon }) => (!signIcon ? 'none' : '')};
|
|
39
58
|
margin-left: ${({ signIcon }) => (!signIcon ? '42px' : '')};
|
|
40
59
|
position: ${({ signIcon }) => (!signIcon ? '' : 'absolute')};
|
|
@@ -47,34 +66,47 @@ const ControllerDiv = styled.div`
|
|
|
47
66
|
flex-direction: row;
|
|
48
67
|
justify-content: center;
|
|
49
68
|
align-items: center;
|
|
50
|
-
border-bottom: ${({
|
|
69
|
+
border-bottom: ${({
|
|
70
|
+
penIcon,
|
|
71
|
+
isMyInputFocused,
|
|
72
|
+
activeColor,
|
|
73
|
+
defaultColor,
|
|
74
|
+
theme,
|
|
75
|
+
}) =>
|
|
51
76
|
penIcon
|
|
52
77
|
? isMyInputFocused
|
|
53
|
-
?
|
|
54
|
-
|
|
78
|
+
? `1px solid ` +
|
|
79
|
+
`${activeColor ? activeColor : theme.primary['primary-1']}`
|
|
80
|
+
: `1px solid ` +
|
|
81
|
+
`${defaultColor ? defaultColor : theme.neutral['neutral-3']}`
|
|
55
82
|
: ''};
|
|
56
83
|
background-color: rgba(255, 255, 255, 0.05);
|
|
57
84
|
cursor: pointer;
|
|
58
85
|
`;
|
|
59
86
|
|
|
60
87
|
const InputText = styled.input`
|
|
61
|
-
${({
|
|
62
|
-
return getDefaultStyles(
|
|
88
|
+
${({ inBuiltCss, defaultInputStyle }) => {
|
|
89
|
+
return getDefaultStyles(inBuiltCss, defaultInputStyle);
|
|
63
90
|
}}
|
|
64
91
|
|
|
65
|
-
border-bottom: ${({ value, defaultColor }) =>
|
|
66
|
-
value.length > 0
|
|
92
|
+
border-bottom: ${({ value, defaultColor, theme }) =>
|
|
93
|
+
value.length > 0
|
|
94
|
+
? 'none'
|
|
95
|
+
: '1px solid ' + defaultColor
|
|
96
|
+
? defaultColor
|
|
97
|
+
: theme.neutral['neutral-3']};
|
|
67
98
|
|
|
68
99
|
&::placeholder {
|
|
69
100
|
font-size: 17px;
|
|
70
101
|
text-align: center;
|
|
71
|
-
color: ${({ placeholderColor }) =>
|
|
102
|
+
color: ${({ placeholderColor, theme }) =>
|
|
103
|
+
placeholderColor ? placeholderColor : theme.neutral['neutral-3']};
|
|
72
104
|
font-family: 'Averta';
|
|
73
105
|
font-style: normal;
|
|
74
106
|
font-weight: normal;
|
|
75
107
|
line-height: 22px;
|
|
76
108
|
}
|
|
77
|
-
&:focus-within {
|
|
109
|
+
&: focus-within {
|
|
78
110
|
border: none;
|
|
79
111
|
outline: none;
|
|
80
112
|
|
|
@@ -118,6 +150,7 @@ export const SignatureInput = ({
|
|
|
118
150
|
setImageURL,
|
|
119
151
|
...props
|
|
120
152
|
}) => {
|
|
153
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
121
154
|
const [selected, setSelected] = useState('default');
|
|
122
155
|
const [isMyInputFocused, setIsMyInputFocused] = useState(false);
|
|
123
156
|
const [dirty, setDirty] = useState(false);
|
|
@@ -148,26 +181,29 @@ export const SignatureInput = ({
|
|
|
148
181
|
|
|
149
182
|
return (
|
|
150
183
|
<ParentDiv
|
|
151
|
-
|
|
184
|
+
inBuiltCss={defaultStyles}
|
|
152
185
|
defaultParentDivStyle={'signature-parent-div'}
|
|
153
186
|
isMyInputFocused={isMyInputFocused}
|
|
154
187
|
selected={selected}
|
|
155
188
|
activeColor={activeColor}
|
|
156
189
|
defaultColor={defaultColor}
|
|
190
|
+
theme={activeTheme}
|
|
157
191
|
>
|
|
158
192
|
<WrapperDiv
|
|
159
|
-
|
|
193
|
+
inBuiltCss={defaultStyles}
|
|
160
194
|
defaultWrapperDivStyle={'signature-wrapper-div'}
|
|
161
195
|
activeColor={activeColor}
|
|
162
196
|
defaultColor={defaultColor}
|
|
163
197
|
selected={selected}
|
|
164
198
|
isMyInputFocused={isMyInputFocused}
|
|
165
199
|
signIcon={true}
|
|
200
|
+
theme={activeTheme}
|
|
166
201
|
>
|
|
167
202
|
<ControllerDiv
|
|
168
203
|
activeColor={activeColor}
|
|
169
204
|
defaultColor={defaultColor}
|
|
170
205
|
isMyInputFocused={isMyInputFocused}
|
|
206
|
+
theme={activeTheme}
|
|
171
207
|
penIcon={true}
|
|
172
208
|
onClick={() => {
|
|
173
209
|
setSelected('default');
|
|
@@ -176,12 +212,19 @@ export const SignatureInput = ({
|
|
|
176
212
|
>
|
|
177
213
|
<Icon
|
|
178
214
|
icon='pen-icon'
|
|
179
|
-
color={
|
|
215
|
+
color={
|
|
216
|
+
selected === 'default'
|
|
217
|
+
? activeColor
|
|
218
|
+
? activeColor
|
|
219
|
+
: activeTheme.primary['primary-1']
|
|
220
|
+
: activeTheme.black
|
|
221
|
+
}
|
|
180
222
|
/>
|
|
181
223
|
</ControllerDiv>
|
|
182
224
|
<ControllerDiv
|
|
183
225
|
activeColor={activeColor}
|
|
184
226
|
defaultColor={defaultColor}
|
|
227
|
+
theme={activeTheme}
|
|
185
228
|
isMyInputFocused={isMyInputFocused}
|
|
186
229
|
penIcon={false}
|
|
187
230
|
onClick={() => {
|
|
@@ -191,25 +234,30 @@ export const SignatureInput = ({
|
|
|
191
234
|
>
|
|
192
235
|
<Icon
|
|
193
236
|
icon='sign-icon'
|
|
194
|
-
color={
|
|
237
|
+
color={
|
|
238
|
+
selected !== 'default'
|
|
239
|
+
? activeColor
|
|
240
|
+
? activeColor
|
|
241
|
+
: activeTheme.primary['primary-1']
|
|
242
|
+
: activeTheme.black
|
|
243
|
+
}
|
|
195
244
|
/>
|
|
196
245
|
</ControllerDiv>
|
|
197
246
|
</WrapperDiv>
|
|
198
247
|
<WrapperDiv
|
|
199
|
-
|
|
248
|
+
inBuiltCss={defaultStyles}
|
|
200
249
|
defaultWrapperDivStyle={'signature-wrapper-div'}
|
|
201
250
|
activeColor={activeColor}
|
|
202
251
|
defaultColor={defaultColor}
|
|
252
|
+
theme={activeTheme}
|
|
203
253
|
selected={selected}
|
|
204
254
|
isMyInputFocused={isMyInputFocused}
|
|
205
255
|
signIcon={false}
|
|
206
|
-
onTouchStart={() => {
|
|
207
|
-
console.log('touchstart');
|
|
208
|
-
}}
|
|
256
|
+
onTouchStart={() => { }}
|
|
209
257
|
>
|
|
210
258
|
{selected === 'default' ? (
|
|
211
259
|
<InputText
|
|
212
|
-
|
|
260
|
+
inBuiltCss={defaultStyles}
|
|
213
261
|
defaultInputStyle={'signature-input-text'}
|
|
214
262
|
placeholder={placeholderText}
|
|
215
263
|
placeholderColor={placeholderColor}
|
|
@@ -218,6 +266,7 @@ export const SignatureInput = ({
|
|
|
218
266
|
onFocus={() => setIsMyInputFocused(true)}
|
|
219
267
|
value={value}
|
|
220
268
|
defaultColor={defaultColor}
|
|
269
|
+
theme={activeTheme}
|
|
221
270
|
onChange={(e) => setValue(e.target.value)}
|
|
222
271
|
/>
|
|
223
272
|
) : (
|
|
@@ -239,7 +288,12 @@ export const SignatureInput = ({
|
|
|
239
288
|
)}
|
|
240
289
|
{(value || dirty) && (
|
|
241
290
|
<IconDiv selected={selected} onClick={() => onClear()}>
|
|
242
|
-
<Icon
|
|
291
|
+
<Icon
|
|
292
|
+
icon='cross-icon'
|
|
293
|
+
color={
|
|
294
|
+
defaultColor ? defaultColor : activeTheme.neutral['neutral-3']
|
|
295
|
+
}
|
|
296
|
+
/>
|
|
243
297
|
</IconDiv>
|
|
244
298
|
)}
|
|
245
299
|
</WrapperDiv>
|
|
@@ -295,9 +349,6 @@ SignatureInput.propTypes = {
|
|
|
295
349
|
};
|
|
296
350
|
|
|
297
351
|
SignatureInput.defaultProps = {
|
|
298
|
-
activeColor: `${defaultThemeColor.primary['primary-1']}`,
|
|
299
|
-
defaultColor: `${defaultThemeColor.neutral['neutral-3']}`,
|
|
300
|
-
placeholderColor: `${defaultThemeColor.neutral['neutral-3']}`,
|
|
301
352
|
customInputStyle: {},
|
|
302
353
|
placeholderText: 'Type your signature here',
|
|
303
354
|
pointsArray: null,
|
|
@@ -307,5 +358,4 @@ SignatureInput.defaultProps = {
|
|
|
307
358
|
imageURL: '',
|
|
308
359
|
setImageURL: () => { },
|
|
309
360
|
setValueForSignatureDrawing: () => { },
|
|
310
|
-
};
|
|
311
|
-
|
|
361
|
+
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css, useTheme } from 'styled-components';
|
|
5
4
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
8
|
|
|
9
9
|
const TextWrapper = styled.div`
|
|
10
10
|
//Set the styles from the default styles object
|
|
11
|
-
${({
|
|
12
|
-
return getDefaultStyles(
|
|
11
|
+
${({ inBuiltCss, defaultWrapperStyle }) => {
|
|
12
|
+
return getDefaultStyles(inBuiltCss, defaultWrapperStyle);
|
|
13
13
|
}}
|
|
14
14
|
|
|
15
|
-
border: ${({ isValid,
|
|
15
|
+
border: ${({ isValid, theme }) =>
|
|
16
16
|
!isValid
|
|
17
|
-
? '1px solid ' +
|
|
18
|
-
: '1px solid ' +
|
|
17
|
+
? '1px solid ' + theme.variant['error']
|
|
18
|
+
: '1px solid ' + theme.border};
|
|
19
19
|
|
|
20
20
|
.input-icon svg path {
|
|
21
|
-
fill: ${({
|
|
21
|
+
fill: ${({ theme }) => theme.variant['neutral-1']};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&:focus-within {
|
|
25
|
-
border: 1px solid ${({
|
|
25
|
+
border: 1px solid ${({ theme }) => theme.variant['primary-1']};
|
|
26
26
|
outline: none;
|
|
27
27
|
|
|
28
28
|
.input-icon svg path {
|
|
29
|
-
fill: ${({
|
|
29
|
+
fill: ${({ theme }) => theme.variant['primary-1']};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -34,18 +34,14 @@ const TextWrapper = styled.div`
|
|
|
34
34
|
${({ textAreaStyle }) => textAreaStyle}
|
|
35
35
|
`;
|
|
36
36
|
|
|
37
|
-
TextWrapper.defaultProps = {
|
|
38
|
-
themeColor: defaultThemeColor,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
37
|
const Input = styled.textarea`
|
|
42
38
|
//Set the styles from the default styles object
|
|
43
|
-
${({
|
|
44
|
-
return getDefaultStyles(
|
|
39
|
+
${({ inBuiltCss, defaultInputStyle }) => {
|
|
40
|
+
return getDefaultStyles(inBuiltCss, defaultInputStyle);
|
|
45
41
|
}}
|
|
46
42
|
margin: 0;
|
|
47
43
|
overflow: auto;
|
|
48
|
-
resize:
|
|
44
|
+
resize: vertical // custom styles
|
|
49
45
|
${({ inputStyle }) => inputStyle};
|
|
50
46
|
`;
|
|
51
47
|
|
|
@@ -64,20 +60,15 @@ const Form = styled.div`
|
|
|
64
60
|
}}
|
|
65
61
|
position: relative;
|
|
66
62
|
.err-text {
|
|
67
|
-
color: ${({
|
|
63
|
+
color: ${({ theme }) => theme.variant['error']};
|
|
68
64
|
margin-top: 5px;
|
|
69
65
|
font-size: 10px;
|
|
70
66
|
}
|
|
71
67
|
`;
|
|
72
68
|
|
|
73
|
-
Form.defaultProps = {
|
|
74
|
-
themeColor: defaultThemeColor,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
69
|
export const TextArea = React.forwardRef(
|
|
78
70
|
(
|
|
79
71
|
{
|
|
80
|
-
themeColor,
|
|
81
72
|
customStylesForm,
|
|
82
73
|
textAreaStyle,
|
|
83
74
|
labelStyle,
|
|
@@ -95,15 +86,17 @@ export const TextArea = React.forwardRef(
|
|
|
95
86
|
},
|
|
96
87
|
ref
|
|
97
88
|
) => {
|
|
89
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
90
|
+
|
|
98
91
|
return (
|
|
99
92
|
<Form
|
|
100
93
|
labelInline={labelInline}
|
|
101
94
|
customStylesForm={customStylesForm}
|
|
95
|
+
theme={activeTheme}
|
|
102
96
|
{...props}
|
|
103
97
|
>
|
|
104
98
|
<div style={{ display: 'flex' }}>
|
|
105
99
|
<Label
|
|
106
|
-
themeColor={defaultThemeColor}
|
|
107
100
|
customStyles={labelStyle}
|
|
108
101
|
type={'label-text'}
|
|
109
102
|
labelInline={labelInline}
|
|
@@ -120,7 +113,7 @@ export const TextArea = React.forwardRef(
|
|
|
120
113
|
<div
|
|
121
114
|
style={{
|
|
122
115
|
marginLeft: '4px',
|
|
123
|
-
color: `${
|
|
116
|
+
color: `${activeTheme.variant['error']}`,
|
|
124
117
|
}}
|
|
125
118
|
>
|
|
126
119
|
*
|
|
@@ -128,11 +121,11 @@ export const TextArea = React.forwardRef(
|
|
|
128
121
|
)}
|
|
129
122
|
</div>
|
|
130
123
|
<TextWrapper
|
|
124
|
+
theme={activeTheme}
|
|
131
125
|
required={required}
|
|
132
|
-
themeColor={defaultThemeColor}
|
|
133
126
|
textAreaStyle={textAreaStyle}
|
|
134
127
|
isValid={isValid}
|
|
135
|
-
|
|
128
|
+
inBuiltCss={defaultStyles}
|
|
136
129
|
defaultWrapperStyle={'textbox-wrapper'}
|
|
137
130
|
{...props}
|
|
138
131
|
>
|
|
@@ -143,6 +136,7 @@ export const TextArea = React.forwardRef(
|
|
|
143
136
|
defaultInputStyle={'textarea-wrapper'}
|
|
144
137
|
cols={cols}
|
|
145
138
|
rows={rows}
|
|
139
|
+
inBuiltCss={defaultStyles}
|
|
146
140
|
{...props}
|
|
147
141
|
size='1'
|
|
148
142
|
/>
|
|
@@ -155,14 +149,6 @@ export const TextArea = React.forwardRef(
|
|
|
155
149
|
);
|
|
156
150
|
|
|
157
151
|
TextArea.propTypes = {
|
|
158
|
-
/**
|
|
159
|
-
* Theme props of default in-built css
|
|
160
|
-
*/
|
|
161
|
-
theme: PropTypes.object,
|
|
162
|
-
/**
|
|
163
|
-
* Color props of default theme
|
|
164
|
-
*/
|
|
165
|
-
themeColor: PropTypes.object,
|
|
166
152
|
/**
|
|
167
153
|
* row number of the text area
|
|
168
154
|
*/
|
|
@@ -206,8 +192,6 @@ TextArea.propTypes = {
|
|
|
206
192
|
};
|
|
207
193
|
|
|
208
194
|
TextArea.defaultProps = {
|
|
209
|
-
themeColor: defaultThemeColor,
|
|
210
|
-
theme: defaultStyles,
|
|
211
195
|
label: '',
|
|
212
196
|
required: false,
|
|
213
197
|
isValid: true,
|
|
@@ -218,6 +202,6 @@ TextArea.defaultProps = {
|
|
|
218
202
|
textAreaStyle: {},
|
|
219
203
|
labelStyle: {},
|
|
220
204
|
inputStyle: {},
|
|
221
|
-
|
|
222
|
-
// cols:100
|
|
205
|
+
rows: 3,
|
|
206
|
+
// cols: 100
|
|
223
207
|
};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
4
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
8
|
|
|
9
9
|
const TextWrapper = styled.div`
|
|
10
10
|
//Set the styles from the default styles object
|
|
11
|
-
${({
|
|
12
|
-
return getDefaultStyles(
|
|
11
|
+
${({ inBuiltCss, defaultWrapperStyle }) => {
|
|
12
|
+
return getDefaultStyles(inBuiltCss, defaultWrapperStyle);
|
|
13
13
|
}}
|
|
14
14
|
|
|
15
|
-
border: ${({ isValid,
|
|
15
|
+
border: ${({ isValid, theme }) =>
|
|
16
16
|
!isValid
|
|
17
|
-
? '1px solid ' +
|
|
18
|
-
: '1px solid ' +
|
|
17
|
+
? '1px solid ' + theme.variant['error']
|
|
18
|
+
: '1px solid ' + theme.border};
|
|
19
19
|
|
|
20
20
|
.input-icon svg path {
|
|
21
|
-
fill: ${({
|
|
21
|
+
fill: ${({ theme }) => theme.variant['neutral-1']};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&:focus-within {
|
|
25
|
-
border: 1px solid ${({
|
|
25
|
+
border: 1px solid ${({ theme }) => theme.variant['primary-1']};
|
|
26
26
|
outline: none;
|
|
27
27
|
|
|
28
28
|
.input-icon svg path {
|
|
29
|
-
fill: ${({
|
|
29
|
+
fill: ${({ theme }) => theme.variant['primary-1']};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// custom styles
|
|
34
34
|
${({ textBoxStyle }) => textBoxStyle}
|
|
35
35
|
|
|
36
|
-
background-color: ${({ isDisabled }) => isDisabled ?
|
|
36
|
+
background-color: ${({ isDisabled, theme }) => isDisabled ? theme.variant['neutral-5'] : theme.bgColor}
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
39
|
const Input = styled.input`
|
|
40
40
|
width: inherit;
|
|
41
41
|
//Set the styles from the default styles object
|
|
42
|
-
${({
|
|
43
|
-
return getDefaultStyles(
|
|
42
|
+
${({ inBuiltCss, defaultInputStyle }) => {
|
|
43
|
+
return getDefaultStyles(inBuiltCss, defaultInputStyle);
|
|
44
44
|
}}
|
|
45
45
|
|
|
46
46
|
// custom styles
|
|
@@ -49,7 +49,7 @@ const Input = styled.input`
|
|
|
49
49
|
.sc-furwcr bxRAoq {
|
|
50
50
|
color: ${defaultThemeColor.variant['neutral-3']};
|
|
51
51
|
}
|
|
52
|
-
background-color: ${({ isDisabled }) => isDisabled ?
|
|
52
|
+
background-color: ${({ isDisabled, theme }) => isDisabled ? theme.variant['neutral-5'] : theme.bgColor}
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
55
|
const inline = css`
|
|
@@ -61,18 +61,17 @@ const inline = css`
|
|
|
61
61
|
const Form = styled.div`
|
|
62
62
|
${({ labelInline }) => (labelInline ? inline : null)}
|
|
63
63
|
.err-text {
|
|
64
|
-
color: ${({
|
|
64
|
+
color: ${({ theme }) => theme.variant['error']};
|
|
65
65
|
margin-top: 5px;
|
|
66
66
|
font-size: 10px;
|
|
67
67
|
}
|
|
68
68
|
`;
|
|
69
69
|
|
|
70
70
|
Form.defaultProps = {
|
|
71
|
-
|
|
71
|
+
theme: defaultThemeColor,
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
export const TextInput = ({
|
|
75
|
-
themeColor,
|
|
76
75
|
textBoxStyle,
|
|
77
76
|
labelStyle,
|
|
78
77
|
inputStyle,
|
|
@@ -84,11 +83,13 @@ export const TextInput = ({
|
|
|
84
83
|
iconAfter,
|
|
85
84
|
isValid,
|
|
86
85
|
type,
|
|
86
|
+
theme,
|
|
87
87
|
isDisabled,
|
|
88
88
|
...props
|
|
89
89
|
}) => {
|
|
90
|
+
|
|
90
91
|
return (
|
|
91
|
-
<Form labelInline={labelInline} {...props}>
|
|
92
|
+
<Form labelInline={labelInline} {...props} theme={theme}>
|
|
92
93
|
<div style={{ display: 'flex' }}>
|
|
93
94
|
<Label
|
|
94
95
|
customStyles={labelStyle}
|
|
@@ -107,7 +108,7 @@ export const TextInput = ({
|
|
|
107
108
|
<div
|
|
108
109
|
style={{
|
|
109
110
|
marginLeft: '4px',
|
|
110
|
-
color: `${
|
|
111
|
+
color: `${theme.variant['error']}`,
|
|
111
112
|
}}
|
|
112
113
|
>
|
|
113
114
|
*
|
|
@@ -116,11 +117,11 @@ export const TextInput = ({
|
|
|
116
117
|
</div>
|
|
117
118
|
<TextWrapper
|
|
118
119
|
required={required}
|
|
119
|
-
themeColor={defaultThemeColor}
|
|
120
120
|
isDisabled={isDisabled}
|
|
121
|
+
theme={theme}
|
|
121
122
|
textBoxStyle={textBoxStyle}
|
|
122
123
|
isValid={isValid}
|
|
123
|
-
|
|
124
|
+
inBuiltCss={defaultStyles}
|
|
124
125
|
defaultWrapperStyle={'textbox-wrapper'}
|
|
125
126
|
{...props}
|
|
126
127
|
>
|
|
@@ -128,6 +129,7 @@ export const TextInput = ({
|
|
|
128
129
|
<Input
|
|
129
130
|
inputStyle={inputStyle}
|
|
130
131
|
type={type}
|
|
132
|
+
theme={theme}
|
|
131
133
|
defaultInputStyle={'input-wrapper'}
|
|
132
134
|
isDisabled={isDisabled}
|
|
133
135
|
disabled={isDisabled}
|
|
@@ -144,11 +146,7 @@ TextInput.propTypes = {
|
|
|
144
146
|
/**
|
|
145
147
|
* Theme props of default in-built css
|
|
146
148
|
*/
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Color props of default theme
|
|
150
|
-
*/
|
|
151
|
-
themeColor: PropTypes.object,
|
|
149
|
+
inBuiltCss: PropTypes.object,
|
|
152
150
|
/**
|
|
153
151
|
* Label of Input
|
|
154
152
|
*/
|
|
@@ -193,11 +191,28 @@ TextInput.propTypes = {
|
|
|
193
191
|
* input field disabled or not
|
|
194
192
|
*/
|
|
195
193
|
isDisabled: PropTypes.bool,
|
|
194
|
+
/**
|
|
195
|
+
* receives theme object
|
|
196
|
+
*/
|
|
197
|
+
theme: PropTypes.object,
|
|
198
|
+
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
Input.defaultProps = {
|
|
202
|
+
theme: defaultThemeColor,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
TextWrapper.defaultProps = {
|
|
206
|
+
theme: defaultThemeColor,
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
Form.defaultProps = {
|
|
210
|
+
theme: defaultThemeColor,
|
|
196
211
|
};
|
|
197
212
|
|
|
198
213
|
TextInput.defaultProps = {
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
theme: defaultThemeColor,
|
|
215
|
+
inBuiltCss: defaultStyles,
|
|
201
216
|
label: '',
|
|
202
217
|
required: false,
|
|
203
218
|
isValid: true,
|