groundfloor-react-ui 1.0.22 → 1.2.0
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 +4 -1
- package/components/Accordion/AccordionSB.js +4 -0
- package/components/Accordion/AccordionSBfooter.js +4 -0
- package/components/ArrowBar/ArrowBar.js +1 -1
- package/components/Avatar/AvatarSBfooter.js +40 -6
- package/components/Breadcrumb/Breadcrumb.js +18 -0
- package/components/Button/PrimaryButton.js +8 -0
- package/components/Button/SecondaryButton.js +7 -0
- package/components/Button/TinyButton.js +8 -2
- package/components/DesignComponent/StyledComponent/StyledComponent.js +21 -7
- package/components/Form/FormComponent.js +9 -11
- package/components/Inputs/CheckBoxInput.js +1 -0
- package/components/Inputs/ColorInput.js +144 -0
- package/components/Inputs/DropdownSelect.js +56 -12
- package/components/Inputs/DropzoneInput.js +7 -0
- package/components/Inputs/NumericInput.js +7 -0
- package/components/Inputs/PasswordInput.js +21 -5
- package/components/Inputs/RadioInput.js +22 -3
- package/components/Inputs/SearchInput.js +2 -1
- package/components/Inputs/Signature.js +8 -0
- package/components/Inputs/TextArea.js +7 -0
- package/components/Inputs/TextInput.js +9 -2
- package/components/Inputs/TimeInput.js +7 -1
- package/components/Inputs/ToggleSwitch.js +6 -0
- package/components/Inputs/index.js +10 -9
- package/components/Modal/ModalComp.js +1 -1
- package/components/Tooltip/Tooltip.js +394 -285
- package/components/constants/defaultStyle.js +32 -0
- package/dist/index.es.js +1377 -1307
- package/dist/index.js +1390 -1320
- package/index.js +39 -39
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ export const Accordion = ({
|
|
|
33
33
|
contentToggle,
|
|
34
34
|
toggleState,
|
|
35
35
|
contentIsOpen,
|
|
36
|
+
id,
|
|
36
37
|
...props
|
|
37
38
|
}) => {
|
|
38
39
|
// const [contentIsOpen, setContentIsOpen] = useState(false);
|
|
@@ -112,6 +113,7 @@ export const Accordion = ({
|
|
|
112
113
|
? { minHeight: contentRef.current.scrollHeight + 'px', borderColor: activeTheme.borderColor }
|
|
113
114
|
: { height: '0px', borderBottom: 'none' }
|
|
114
115
|
}
|
|
116
|
+
id={id}
|
|
115
117
|
content={content}
|
|
116
118
|
/>
|
|
117
119
|
}
|
|
@@ -153,6 +155,7 @@ Accordion.propTypes = {
|
|
|
153
155
|
*/
|
|
154
156
|
contentToggle: PropTypes.any,
|
|
155
157
|
toggleState: PropTypes.func,
|
|
158
|
+
id: PropTypes.string
|
|
156
159
|
};
|
|
157
160
|
|
|
158
161
|
Accordion.defaultProps = {
|
|
@@ -160,5 +163,5 @@ Accordion.defaultProps = {
|
|
|
160
163
|
content: 'Content',
|
|
161
164
|
toggleIconAnimation: true,
|
|
162
165
|
toggleState: () => { },
|
|
163
|
-
|
|
166
|
+
id: ''
|
|
164
167
|
};
|
|
@@ -19,6 +19,7 @@ export const AccordionSB = ({
|
|
|
19
19
|
index,
|
|
20
20
|
handleClick,
|
|
21
21
|
isAccordionOpen,
|
|
22
|
+
id,
|
|
22
23
|
...props
|
|
23
24
|
}) => {
|
|
24
25
|
const [contentIsOpen, setContentIsOpen] = useState(false);
|
|
@@ -116,6 +117,7 @@ export const AccordionSB = ({
|
|
|
116
117
|
? { height: contentRef.current.scrollHeight + 'px' }
|
|
117
118
|
: { height: '0px', borderBottom: 'none' }
|
|
118
119
|
}
|
|
120
|
+
id={id}
|
|
119
121
|
content={content}
|
|
120
122
|
/>
|
|
121
123
|
}
|
|
@@ -156,9 +158,11 @@ AccordionSB.propTypes = {
|
|
|
156
158
|
* String or element to be display in the header of the accordion
|
|
157
159
|
*/
|
|
158
160
|
contentToggle: PropTypes.any,
|
|
161
|
+
id: PropTypes.string
|
|
159
162
|
};
|
|
160
163
|
|
|
161
164
|
AccordionSB.defaultProps = {
|
|
162
165
|
contentToggle: 'Toggle',
|
|
163
166
|
content: 'Content',
|
|
167
|
+
id: ''
|
|
164
168
|
};
|
|
@@ -20,6 +20,7 @@ export const AccordionSBfooter = ({
|
|
|
20
20
|
handleClick,
|
|
21
21
|
isAccordionOpen,
|
|
22
22
|
disable,
|
|
23
|
+
id,
|
|
23
24
|
...props
|
|
24
25
|
}) => {
|
|
25
26
|
const [contentIsOpen, setContentIsOpen] = useState(false);
|
|
@@ -119,6 +120,7 @@ export const AccordionSBfooter = ({
|
|
|
119
120
|
? { height: contentRef.current.scrollHeight + 'px' }
|
|
120
121
|
: { height: '0px', borderBottom: 'none' }
|
|
121
122
|
}
|
|
123
|
+
id={id}
|
|
122
124
|
content={content}
|
|
123
125
|
/>
|
|
124
126
|
}
|
|
@@ -159,9 +161,11 @@ AccordionSBfooter.propTypes = {
|
|
|
159
161
|
* String or element to be display in the header of the accordion
|
|
160
162
|
*/
|
|
161
163
|
contentToggle: PropTypes.any,
|
|
164
|
+
id: PropTypes.string
|
|
162
165
|
};
|
|
163
166
|
|
|
164
167
|
AccordionSBfooter.defaultProps = {
|
|
165
168
|
contentToggle: 'Toggle',
|
|
166
169
|
content: 'Content',
|
|
170
|
+
id: ''
|
|
167
171
|
};
|
|
@@ -232,7 +232,7 @@ export const ArrowBar = ({ variant, data, scroll, onClick, clickable, ...props }
|
|
|
232
232
|
{data.map((singleData, index) => {
|
|
233
233
|
return (
|
|
234
234
|
// Add the ref to the Arrow with the longest text label + value
|
|
235
|
-
<StyledArrow theme={activeTheme} onClick={clickable ? (e) => onClick(e, singleData) : null} clickable={clickable} scroll={scroll} ref={scroll ? null : singleData.label === longest.label ? arrowRef : null} key={'fa' + index + '-' + singleData.label} index={index} dataLength={data.length} color={singleData.color}>
|
|
235
|
+
<StyledArrow id={singleData.id} theme={activeTheme} onClick={clickable ? (e) => onClick(e, singleData) : null} clickable={clickable} scroll={scroll} ref={scroll ? null : singleData.label === longest.label ? arrowRef : null} key={'fa' + index + '-' + singleData.label} index={index} dataLength={data.length} color={singleData.color}>
|
|
236
236
|
{ArrowContent(singleData.value, singleData.label)}
|
|
237
237
|
</StyledArrow>
|
|
238
238
|
)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
|
|
3
5
|
import styled, { css, useTheme } from 'styled-components';
|
|
4
6
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
7
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
@@ -9,16 +11,20 @@ import { Image } from '../Images';
|
|
|
9
11
|
* Primary UI component for user interaction
|
|
10
12
|
*/
|
|
11
13
|
const StyledContainer = styled.span`
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
${({ inBuiltCss, type, customStyles }) => {
|
|
16
|
+
|
|
13
17
|
if (inBuiltCss) {
|
|
14
18
|
let tempObj = {};
|
|
15
19
|
if (inBuiltCss[type]) {
|
|
16
20
|
for (const property in inBuiltCss['common']) {
|
|
17
|
-
|
|
21
|
+
|
|
22
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
18
23
|
}
|
|
19
24
|
for (const property in inBuiltCss[type]) {
|
|
20
|
-
tempObj[property] = inBuiltCss[type][property]
|
|
21
|
-
delete inBuiltCss.common[property]
|
|
25
|
+
tempObj[property] = inBuiltCss[type][property]
|
|
26
|
+
delete inBuiltCss.common[property]
|
|
27
|
+
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
return { ...tempObj, ...customStyles };
|
|
@@ -28,10 +34,12 @@ const StyledContainer = styled.span`
|
|
|
28
34
|
`;
|
|
29
35
|
|
|
30
36
|
const StyledCircle = styled.div`
|
|
37
|
+
|
|
31
38
|
background-color: ${({ theme }) => theme.primary['primary-1']};
|
|
32
39
|
color: ${({ theme }) => theme.bgColor};
|
|
33
40
|
|
|
34
41
|
${({ inBuiltCss, type, size, customStyles }) => {
|
|
42
|
+
|
|
35
43
|
if (inBuiltCss) {
|
|
36
44
|
let tempObj = {};
|
|
37
45
|
if (inBuiltCss[type]) {
|
|
@@ -45,6 +53,7 @@ const StyledCircle = styled.div`
|
|
|
45
53
|
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
46
54
|
tempObj[property] = inBuiltCss[`${type}${size}`][property];
|
|
47
55
|
delete inBuiltCss.common[property];
|
|
56
|
+
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
return { ...tempObj, ...customStyles };
|
|
@@ -80,13 +89,16 @@ const StyledCircle = styled.div`
|
|
|
80
89
|
// console.log("customStylesCircle" + i + ": ", customStylesCircle)
|
|
81
90
|
|
|
82
91
|
const StyledName = styled.span`
|
|
92
|
+
|
|
83
93
|
color: ${({ theme }) => theme.textColor};
|
|
84
94
|
|
|
85
95
|
${({ inBuiltCss, type, size, customStyles }) => {
|
|
96
|
+
|
|
86
97
|
if (inBuiltCss) {
|
|
87
98
|
let tempObj = {};
|
|
88
99
|
if (inBuiltCss[type]) {
|
|
89
100
|
for (const property in inBuiltCss['common']) {
|
|
101
|
+
|
|
90
102
|
tempObj[property] = inBuiltCss['common'][property];
|
|
91
103
|
}
|
|
92
104
|
for (const property in inBuiltCss[type]) {
|
|
@@ -96,14 +108,17 @@ const StyledName = styled.span`
|
|
|
96
108
|
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
97
109
|
tempObj[property] = inBuiltCss[`${type}${size}`][property];
|
|
98
110
|
delete inBuiltCss.common[property];
|
|
111
|
+
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
114
|
return { ...tempObj, ...customStyles };
|
|
102
115
|
}
|
|
103
116
|
}}
|
|
104
117
|
|
|
118
|
+
|
|
105
119
|
&:hover {
|
|
106
120
|
${({ inBuiltCss, type, size, customStylesHover }) => {
|
|
121
|
+
|
|
107
122
|
if (inBuiltCss) {
|
|
108
123
|
let tempObj = {};
|
|
109
124
|
// if (inBuiltCss[type]) {
|
|
@@ -126,6 +141,9 @@ const StyledName = styled.span`
|
|
|
126
141
|
`;
|
|
127
142
|
|
|
128
143
|
export const AvatarSBfooter = ({
|
|
144
|
+
|
|
145
|
+
inBuiltCss,
|
|
146
|
+
|
|
129
147
|
customStylesContainer,
|
|
130
148
|
customStylesImage,
|
|
131
149
|
customStylesCircle,
|
|
@@ -141,14 +159,17 @@ export const AvatarSBfooter = ({
|
|
|
141
159
|
value,
|
|
142
160
|
...props
|
|
143
161
|
}) => {
|
|
144
|
-
|
|
162
|
+
|
|
145
163
|
const activeTheme = useTheme() || defaultThemeColor;
|
|
164
|
+
const [avatarStatus, setAvatarStatus] = useState("loading");
|
|
165
|
+
|
|
146
166
|
|
|
147
167
|
const handleImageStatus = (imageStatus) => {
|
|
148
168
|
setAvatarStatus(imageStatus);
|
|
149
169
|
};
|
|
150
170
|
// console.log('user', user)
|
|
151
171
|
return (
|
|
172
|
+
|
|
152
173
|
<StyledContainer
|
|
153
174
|
border={border}
|
|
154
175
|
theme={activeTheme}
|
|
@@ -177,6 +198,7 @@ export const AvatarSBfooter = ({
|
|
|
177
198
|
{...props}
|
|
178
199
|
theme={activeTheme}
|
|
179
200
|
inBuiltCss={defaultStyles}
|
|
201
|
+
|
|
180
202
|
type={'avatarCircle'}
|
|
181
203
|
customStyles={customStylesCircle}
|
|
182
204
|
size={size}
|
|
@@ -187,6 +209,7 @@ export const AvatarSBfooter = ({
|
|
|
187
209
|
>
|
|
188
210
|
{value}
|
|
189
211
|
</StyledCircle>
|
|
212
|
+
|
|
190
213
|
{toggleName && (
|
|
191
214
|
<StyledName
|
|
192
215
|
theme={activeTheme}
|
|
@@ -200,6 +223,7 @@ export const AvatarSBfooter = ({
|
|
|
200
223
|
{user.userName}{' '}
|
|
201
224
|
</StyledName>
|
|
202
225
|
)}
|
|
226
|
+
|
|
203
227
|
</StyledContainer>
|
|
204
228
|
);
|
|
205
229
|
};
|
|
@@ -233,9 +257,19 @@ AvatarSBfooter.propTypes = {
|
|
|
233
257
|
* Object with user information. To display the user's picture need a key "url". To display the name need a key "userName"
|
|
234
258
|
*/
|
|
235
259
|
user: PropTypes.object,
|
|
260
|
+
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
AvatarSBfooter.defaultProps = {
|
|
264
|
+
/**
|
|
265
|
+
* inBuiltCss object
|
|
266
|
+
*/
|
|
267
|
+
inBuiltCss: PropTypes.object,
|
|
236
268
|
};
|
|
237
269
|
|
|
238
270
|
AvatarSBfooter.defaultProps = {
|
|
271
|
+
inBuiltCss: defaultStyles,
|
|
272
|
+
|
|
239
273
|
block: false,
|
|
240
274
|
size: 'MD',
|
|
241
275
|
toggleName: false,
|
|
@@ -122,6 +122,7 @@ export const Breadcrumb = ({
|
|
|
122
122
|
<div className='breadcrumb-icon-separator'>{separator}</div>
|
|
123
123
|
)}
|
|
124
124
|
<StyledItem
|
|
125
|
+
id={item.id}
|
|
125
126
|
theme={activeTheme}
|
|
126
127
|
onClick={() => {
|
|
127
128
|
if (item.href) onClick(item.href);
|
|
@@ -180,6 +181,23 @@ Breadcrumb.propTypes = {
|
|
|
180
181
|
separator: PropTypes.any,
|
|
181
182
|
/**
|
|
182
183
|
* List of the elements of breadcramb
|
|
184
|
+
* ex: [
|
|
185
|
+
{
|
|
186
|
+
href: '/',
|
|
187
|
+
label: 'Home',
|
|
188
|
+
id: '1'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
href: '/level1',
|
|
192
|
+
label: 'Level 1',
|
|
193
|
+
id: '2'
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
href: null,
|
|
197
|
+
label: 'Level 2',
|
|
198
|
+
id: '3'
|
|
199
|
+
},
|
|
200
|
+
]
|
|
183
201
|
*/
|
|
184
202
|
items: PropTypes.array,
|
|
185
203
|
/**
|
|
@@ -67,12 +67,14 @@ export const PrimaryButton = ({
|
|
|
67
67
|
isLoading,
|
|
68
68
|
type,
|
|
69
69
|
theme,
|
|
70
|
+
id,
|
|
70
71
|
...props
|
|
71
72
|
}) => {
|
|
72
73
|
const activeTheme = useTheme() || defaultThemeColor
|
|
73
74
|
|
|
74
75
|
return (
|
|
75
76
|
<StyledButton
|
|
77
|
+
id={id}
|
|
76
78
|
block={block}
|
|
77
79
|
variant={variant}
|
|
78
80
|
defaultStyle='button'
|
|
@@ -141,6 +143,11 @@ PrimaryButton.propTypes = {
|
|
|
141
143
|
* custom style of button
|
|
142
144
|
*/
|
|
143
145
|
btnStyle: PropTypes.object,
|
|
146
|
+
/**
|
|
147
|
+
* id of the primaryBtn
|
|
148
|
+
*/
|
|
149
|
+
id: PropTypes.string,
|
|
150
|
+
|
|
144
151
|
};
|
|
145
152
|
|
|
146
153
|
StyledButton.defaultProps = {
|
|
@@ -156,4 +163,5 @@ PrimaryButton.defaultProps = {
|
|
|
156
163
|
size: 'md',
|
|
157
164
|
onClick: undefined,
|
|
158
165
|
btnStyle: {},
|
|
166
|
+
id: ''
|
|
159
167
|
};
|
|
@@ -62,11 +62,13 @@ export const SecondaryButton = ({
|
|
|
62
62
|
disabled,
|
|
63
63
|
type,
|
|
64
64
|
theme,
|
|
65
|
+
id,
|
|
65
66
|
...props
|
|
66
67
|
}) => {
|
|
67
68
|
const activeTheme = useTheme() || defaultThemeColor
|
|
68
69
|
return (
|
|
69
70
|
<StyledButton
|
|
71
|
+
id={id}
|
|
70
72
|
block={block}
|
|
71
73
|
variant={variant}
|
|
72
74
|
defaultStyle='button'
|
|
@@ -132,6 +134,10 @@ SecondaryButton.propTypes = {
|
|
|
132
134
|
* custome style of button
|
|
133
135
|
*/
|
|
134
136
|
btnStyle: PropTypes.object,
|
|
137
|
+
/**
|
|
138
|
+
* id of the secondaryBtn
|
|
139
|
+
*/
|
|
140
|
+
id: PropTypes.string,
|
|
135
141
|
};
|
|
136
142
|
|
|
137
143
|
StyledButton.defaultProps = {
|
|
@@ -146,4 +152,5 @@ SecondaryButton.defaultProps = {
|
|
|
146
152
|
size: 'md',
|
|
147
153
|
onClick: undefined,
|
|
148
154
|
btnStyle: {},
|
|
155
|
+
id: ''
|
|
149
156
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
import getDefaultStyles from '../constants/utils';
|
|
@@ -37,10 +37,11 @@ const StyledButton = styled.button`
|
|
|
37
37
|
}}
|
|
38
38
|
`;
|
|
39
39
|
|
|
40
|
-
export const TinyButton = ({ block, style, variant, disabled, type, ...props }) => {
|
|
40
|
+
export const TinyButton = ({ block, style, variant, disabled, type, id, ...props }) => {
|
|
41
41
|
const theme = useTheme() || defaultThemeColor;
|
|
42
42
|
return (
|
|
43
43
|
<StyledButton
|
|
44
|
+
id={id}
|
|
44
45
|
block={block}
|
|
45
46
|
variant={variant}
|
|
46
47
|
defaultStyle="button"
|
|
@@ -79,6 +80,10 @@ TinyButton.propTypes = {
|
|
|
79
80
|
* Type of the btn i.e: button or submit etc.
|
|
80
81
|
*/
|
|
81
82
|
type: PropTypes.string,
|
|
83
|
+
/**
|
|
84
|
+
* id of the tinybtn
|
|
85
|
+
*/
|
|
86
|
+
id: PropTypes.string,
|
|
82
87
|
};
|
|
83
88
|
|
|
84
89
|
StyledButton.defaultProps = {
|
|
@@ -91,5 +96,6 @@ TinyButton.defaultProps = {
|
|
|
91
96
|
block: false,
|
|
92
97
|
disabled: false,
|
|
93
98
|
onClick: undefined,
|
|
99
|
+
id: ''
|
|
94
100
|
};
|
|
95
101
|
|
|
@@ -289,13 +289,7 @@ export const FormContainer = styled.div`
|
|
|
289
289
|
}
|
|
290
290
|
`;
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
width: 40vw;
|
|
294
|
-
display: flex;
|
|
295
|
-
justify-content: center;
|
|
296
|
-
flex-direction: column;
|
|
297
|
-
gap: 20px;
|
|
298
|
-
`;
|
|
292
|
+
|
|
299
293
|
|
|
300
294
|
export const SubmitButtonContainer = styled.div`
|
|
301
295
|
display: flex;
|
|
@@ -316,3 +310,23 @@ export const MultiColumnDiv = styled.div`
|
|
|
316
310
|
min-width: 48%;
|
|
317
311
|
|
|
318
312
|
`;
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
export const FormWrapper = ({ customStyles }) => {
|
|
318
|
+
|
|
319
|
+
const Wrapper = styled.form`
|
|
320
|
+
width: 40vw;
|
|
321
|
+
display: flex;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
flex-direction: column;
|
|
324
|
+
gap: 20px;
|
|
325
|
+
${({ customStyles }) => customStyles}
|
|
326
|
+
`;
|
|
327
|
+
return (
|
|
328
|
+
<Wrapper customStyles={customStyles}>
|
|
329
|
+
</Wrapper>
|
|
330
|
+
);
|
|
331
|
+
};
|
|
332
|
+
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
|
+
import { PrimaryButton, SecondaryButton, TinyButton } from '../Button';
|
|
2
3
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
4
|
+
import {
|
|
5
|
+
FormContainer,
|
|
6
|
+
FormWrapper, MultiColumnDiv, MultiColumnWrapper
|
|
7
|
+
} from '../DesignComponent';
|
|
3
8
|
import { Header } from '../Header';
|
|
4
|
-
import { Label } from '../Label';
|
|
5
9
|
import {
|
|
6
10
|
CheckBoxInput,
|
|
7
11
|
DateSelect,
|
|
@@ -14,16 +18,10 @@ import {
|
|
|
14
18
|
SignatureInput,
|
|
15
19
|
TextArea,
|
|
16
20
|
TextInput,
|
|
17
|
-
ToggleSwitch
|
|
21
|
+
ToggleSwitch
|
|
18
22
|
} from '../Inputs';
|
|
23
|
+
import { Label } from '../Label';
|
|
19
24
|
import { Rating } from '../Rating';
|
|
20
|
-
import { PrimaryButton, SecondaryButton, TinyButton } from '../Button';
|
|
21
|
-
import {
|
|
22
|
-
FormContainer,
|
|
23
|
-
FormWrapper,
|
|
24
|
-
MultiColumnWrapper,
|
|
25
|
-
MultiColumnDiv,
|
|
26
|
-
} from '../DesignComponent';
|
|
27
25
|
import { Table } from '../Tables';
|
|
28
26
|
import { HeaderComponent } from './HeaderComponent';
|
|
29
27
|
|
|
@@ -213,8 +211,8 @@ export const FormComponent = ({ formData, ...props }) => {
|
|
|
213
211
|
|
|
214
212
|
return (
|
|
215
213
|
<Fragment>
|
|
216
|
-
<FormContainer defaultThemeColor={defaultThemeColor}>
|
|
217
|
-
<FormWrapper onSubmit={handleSubmit}>
|
|
214
|
+
<FormContainer defaultThemeColor={defaultThemeColor} >
|
|
215
|
+
<FormWrapper onSubmit={handleSubmit} >
|
|
218
216
|
{formData.map((row, i) => {
|
|
219
217
|
if (row.length > 1) {
|
|
220
218
|
return (
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
+
import getDefaultStyles from '../constants/utils';
|
|
7
|
+
import { Label } from '../Label';
|
|
8
|
+
|
|
9
|
+
const ColorWrapper = styled.div`
|
|
10
|
+
border: 1px solid ${({ theme }) => theme.variant['neutral-4']};
|
|
11
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
12
|
+
|
|
13
|
+
&:focus-within {
|
|
14
|
+
border: 1px solid ${({ theme }) => theme.primary['primary-1']};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
${({ inBuiltCss, defaultColorWrapperStyle }) => {
|
|
18
|
+
return getDefaultStyles(inBuiltCss, defaultColorWrapperStyle);
|
|
19
|
+
}}
|
|
20
|
+
// custom styles
|
|
21
|
+
${({ customColorWrapperStyle }) => customColorWrapperStyle}
|
|
22
|
+
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
const InputColor = styled.input`
|
|
26
|
+
|
|
27
|
+
border: 0.5px solid ${({ theme }) => theme.variant['neutral-4']};
|
|
28
|
+
box-shadow: 0px 5px 37px rgba(56, 66, 100, 0.0880136);
|
|
29
|
+
-webkit-appearance: none;
|
|
30
|
+
padding: 0;
|
|
31
|
+
|
|
32
|
+
&::-webkit-color-swatch-wrapper {
|
|
33
|
+
padding: 0;
|
|
34
|
+
border-radius: 4px;
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
&::-webkit-color-swatch {
|
|
38
|
+
border: none;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${({ inBuiltCss, defaultInputColorStyle }) => {
|
|
44
|
+
return getDefaultStyles(inBuiltCss, defaultInputColorStyle);
|
|
45
|
+
}}
|
|
46
|
+
// custom styles
|
|
47
|
+
${({ customInputColorStyle }) => customInputColorStyle}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export const ColorInput = ({
|
|
52
|
+
label,
|
|
53
|
+
labelStyle,
|
|
54
|
+
value,
|
|
55
|
+
setValue,
|
|
56
|
+
customInputColorStyle,
|
|
57
|
+
customColorWrapperStyle,
|
|
58
|
+
id,
|
|
59
|
+
...props
|
|
60
|
+
}) => {
|
|
61
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
62
|
+
return (
|
|
63
|
+
|
|
64
|
+
<ColorWrapper customColorWrapperStyle={customColorWrapperStyle}
|
|
65
|
+
defaultColorWrapperStyle={'ColorWrapper'}
|
|
66
|
+
theme={activeTheme}
|
|
67
|
+
inBuiltCss={defaultStyles}
|
|
68
|
+
{...props}>
|
|
69
|
+
|
|
70
|
+
<InputColor
|
|
71
|
+
id={id}
|
|
72
|
+
customInputColorStyle={customInputColorStyle}
|
|
73
|
+
defaultInputColorStyle={'input-color'}
|
|
74
|
+
inBuiltCss={defaultStyles}
|
|
75
|
+
theme={activeTheme}
|
|
76
|
+
{...props}
|
|
77
|
+
type="color"
|
|
78
|
+
value={value}
|
|
79
|
+
|
|
80
|
+
onChange={
|
|
81
|
+
(e)=>{
|
|
82
|
+
setValue(e.target.value)}}
|
|
83
|
+
/>
|
|
84
|
+
<Label
|
|
85
|
+
themeColor={defaultThemeColor}
|
|
86
|
+
customStyles={labelStyle}
|
|
87
|
+
type={'label-text'}
|
|
88
|
+
text={label}
|
|
89
|
+
style={{
|
|
90
|
+
display: 'flex',
|
|
91
|
+
paddingBottom: '0px',
|
|
92
|
+
paddingLeft: '10px'
|
|
93
|
+
}}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
</ColorWrapper>
|
|
98
|
+
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
ColorInput.propTypes = {
|
|
103
|
+
/**
|
|
104
|
+
* Label of ColorInput
|
|
105
|
+
*/
|
|
106
|
+
label: PropTypes.string,
|
|
107
|
+
/**
|
|
108
|
+
* Label style of ColorInput
|
|
109
|
+
*/
|
|
110
|
+
labelStyle: PropTypes.object,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* color value of input
|
|
114
|
+
*/
|
|
115
|
+
value: PropTypes.string,
|
|
116
|
+
/**
|
|
117
|
+
* value setter function
|
|
118
|
+
*/
|
|
119
|
+
setValue: PropTypes.func,
|
|
120
|
+
/**
|
|
121
|
+
* custom style of color-input box
|
|
122
|
+
*/
|
|
123
|
+
customInputColorStyle: PropTypes.object,
|
|
124
|
+
/**
|
|
125
|
+
* custom style of the wrapper around the color-input
|
|
126
|
+
*/
|
|
127
|
+
customColorWrapperStyle: PropTypes.object,
|
|
128
|
+
/**
|
|
129
|
+
* id of the colorInput
|
|
130
|
+
*/
|
|
131
|
+
id: PropTypes.string
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
ColorInput.defaultProps ={
|
|
136
|
+
label: '',
|
|
137
|
+
labelStyle: {},
|
|
138
|
+
customInputColorStyle: {},
|
|
139
|
+
customColorWrapperStyle: {},
|
|
140
|
+
value: '#FFFFFF',
|
|
141
|
+
setValue: ()=>{ },
|
|
142
|
+
id: ''
|
|
143
|
+
};
|
|
144
|
+
|