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,73 +1,72 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import styled, { css, useTheme } from 'styled-components';
|
|
4
4
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
-
import
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
+
import { Image } from '../Images';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Primary UI component for user interaction
|
|
9
10
|
*/
|
|
10
11
|
const StyledContainer = styled.span`
|
|
11
|
-
${({
|
|
12
|
-
if (
|
|
12
|
+
${({ inBuiltCss, type, customStyles }) => {
|
|
13
|
+
if (inBuiltCss) {
|
|
13
14
|
let tempObj = {};
|
|
14
|
-
if (
|
|
15
|
-
for (const property in
|
|
16
|
-
tempObj[property] =
|
|
15
|
+
if (inBuiltCss[type]) {
|
|
16
|
+
for (const property in inBuiltCss['common']) {
|
|
17
|
+
tempObj[property] = inBuiltCss['common'][property];
|
|
17
18
|
}
|
|
18
|
-
for (const property in
|
|
19
|
-
tempObj[property] =
|
|
20
|
-
delete
|
|
19
|
+
for (const property in inBuiltCss[type]) {
|
|
20
|
+
tempObj[property] = inBuiltCss[type][property];
|
|
21
|
+
delete inBuiltCss.common[property];
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
return { ...tempObj, ...customStyles };
|
|
24
25
|
}
|
|
25
26
|
}}
|
|
26
|
-
|
|
27
|
+
width: auto;
|
|
27
28
|
`;
|
|
28
29
|
|
|
29
30
|
const StyledCircle = styled.div`
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
background-color: ${({ theme }) => theme.primary['primary-1']};
|
|
32
|
+
color: ${({ theme }) => theme.bgColor};
|
|
33
|
+
|
|
34
|
+
${({ inBuiltCss, type, size, customStyles }) => {
|
|
35
|
+
if (inBuiltCss) {
|
|
32
36
|
let tempObj = {};
|
|
33
|
-
if (
|
|
34
|
-
for (const property in
|
|
35
|
-
tempObj[property] =
|
|
37
|
+
if (inBuiltCss[type]) {
|
|
38
|
+
for (const property in inBuiltCss['common']) {
|
|
39
|
+
tempObj[property] = inBuiltCss['common'][property];
|
|
36
40
|
}
|
|
37
|
-
for (const property in
|
|
38
|
-
tempObj[property] =
|
|
39
|
-
delete
|
|
41
|
+
for (const property in inBuiltCss[type]) {
|
|
42
|
+
tempObj[property] = inBuiltCss[type][property];
|
|
43
|
+
delete inBuiltCss.common[property];
|
|
40
44
|
}
|
|
41
|
-
for (const property in
|
|
42
|
-
tempObj[property] =
|
|
43
|
-
delete
|
|
45
|
+
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
46
|
+
tempObj[property] = inBuiltCss[`${type}${size}`][property];
|
|
47
|
+
delete inBuiltCss.common[property];
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
return { ...tempObj, ...customStyles };
|
|
47
51
|
}
|
|
48
52
|
}}
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
${({ isSelected, selectedStyle, notSelectedStyle }) => {
|
|
51
54
|
if (isSelected) {
|
|
52
55
|
return css`
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
${selectedStyle}
|
|
57
|
+
|
|
58
|
+
min-width: 42px;
|
|
59
|
+
min-height: 42px;
|
|
60
|
+
`;
|
|
58
61
|
} else {
|
|
59
62
|
return css`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// width: 38px;
|
|
63
|
-
// height: 38px;
|
|
64
|
-
`
|
|
63
|
+
${notSelectedStyle}
|
|
64
|
+
`;
|
|
65
65
|
}
|
|
66
66
|
}}
|
|
67
67
|
font-weight: 600;
|
|
68
68
|
`;
|
|
69
69
|
|
|
70
|
-
|
|
71
70
|
//Create the style for the Avatar
|
|
72
71
|
|
|
73
72
|
// let customStylesCircle = {}
|
|
@@ -81,52 +80,52 @@ const StyledCircle = styled.div`
|
|
|
81
80
|
// console.log("customStylesCircle" + i + ": ", customStylesCircle)
|
|
82
81
|
|
|
83
82
|
const StyledName = styled.span`
|
|
84
|
-
${({ theme
|
|
85
|
-
|
|
83
|
+
color: ${({ theme }) => theme.textColor};
|
|
84
|
+
|
|
85
|
+
${({ inBuiltCss, type, size, customStyles }) => {
|
|
86
|
+
if (inBuiltCss) {
|
|
86
87
|
let tempObj = {};
|
|
87
|
-
if (
|
|
88
|
-
for (const property in
|
|
89
|
-
tempObj[property] =
|
|
88
|
+
if (inBuiltCss[type]) {
|
|
89
|
+
for (const property in inBuiltCss['common']) {
|
|
90
|
+
tempObj[property] = inBuiltCss['common'][property];
|
|
90
91
|
}
|
|
91
|
-
for (const property in
|
|
92
|
-
delete
|
|
93
|
-
tempObj[property] =
|
|
92
|
+
for (const property in inBuiltCss[type]) {
|
|
93
|
+
delete inBuiltCss.common[property];
|
|
94
|
+
tempObj[property] = inBuiltCss[type][property];
|
|
94
95
|
}
|
|
95
|
-
for (const property in
|
|
96
|
-
tempObj[property] =
|
|
97
|
-
delete
|
|
96
|
+
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
97
|
+
tempObj[property] = inBuiltCss[`${type}${size}`][property];
|
|
98
|
+
delete inBuiltCss.common[property];
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
return { ...tempObj, ...customStyles };
|
|
101
102
|
}
|
|
102
103
|
}}
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (
|
|
105
|
+
&:hover {
|
|
106
|
+
${({ inBuiltCss, type, size, customStylesHover }) => {
|
|
107
|
+
if (inBuiltCss) {
|
|
107
108
|
let tempObj = {};
|
|
108
|
-
// if (
|
|
109
|
-
// for (const property in
|
|
110
|
-
// tempObj[property] =
|
|
109
|
+
// if (inBuiltCss[type]) {
|
|
110
|
+
// for (const property in inBuiltCss['common']) {
|
|
111
|
+
// tempObj[property] = inBuiltCss['common'][property]
|
|
111
112
|
// }
|
|
112
|
-
// for (const property in
|
|
113
|
-
// delete
|
|
114
|
-
// tempObj[property] =
|
|
113
|
+
// for (const property in inBuiltCss[type]) {
|
|
114
|
+
// delete inBuiltCss.common[property]
|
|
115
|
+
// tempObj[property] = inBuiltCss[type][property]
|
|
115
116
|
// }
|
|
116
|
-
// for (const property in
|
|
117
|
-
// tempObj[property] =
|
|
118
|
-
// delete
|
|
117
|
+
// for (const property in inBuiltCss[`${type}${size}`]) {
|
|
118
|
+
// tempObj[property] = inBuiltCss[`${type}${size}`][property]
|
|
119
|
+
// delete inBuiltCss.common[property]
|
|
119
120
|
// }
|
|
120
121
|
// }
|
|
121
122
|
return { ...tempObj, ...customStylesHover };
|
|
122
123
|
}
|
|
123
124
|
}}
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
}
|
|
126
126
|
`;
|
|
127
127
|
|
|
128
128
|
export const AvatarSBfooter = ({
|
|
129
|
-
theme,
|
|
130
129
|
customStylesContainer,
|
|
131
130
|
customStylesImage,
|
|
132
131
|
customStylesCircle,
|
|
@@ -136,43 +135,71 @@ export const AvatarSBfooter = ({
|
|
|
136
135
|
toggleName,
|
|
137
136
|
user,
|
|
138
137
|
border,
|
|
138
|
+
selectedStyle,
|
|
139
|
+
notSelectedStyle,
|
|
139
140
|
isSelected,
|
|
140
141
|
value,
|
|
141
142
|
...props
|
|
142
143
|
}) => {
|
|
143
|
-
|
|
144
|
-
const
|
|
144
|
+
const [avatarStatus, setAvatarStatus] = useState('loading');
|
|
145
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
145
146
|
|
|
146
147
|
const handleImageStatus = (imageStatus) => {
|
|
147
148
|
setAvatarStatus(imageStatus);
|
|
148
|
-
}
|
|
149
|
+
};
|
|
149
150
|
// console.log('user', user)
|
|
150
151
|
return (
|
|
151
|
-
<StyledContainer
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
<StyledContainer
|
|
153
|
+
border={border}
|
|
154
|
+
theme={activeTheme}
|
|
155
|
+
inBuiltCss={defaultStyles}
|
|
156
|
+
customStyles={customStylesContainer}
|
|
157
|
+
type={'avatarContainer'}
|
|
158
|
+
{...props}
|
|
159
|
+
>
|
|
160
|
+
{user?.url && (
|
|
161
|
+
<Image
|
|
162
|
+
{...props}
|
|
163
|
+
inBuiltCss={defaultStyles}
|
|
164
|
+
customStyles={customStylesImage}
|
|
165
|
+
type={'imageAvatar'}
|
|
166
|
+
size={size}
|
|
167
|
+
alt='user-picture'
|
|
168
|
+
src={user.url}
|
|
169
|
+
handleImageStatus={handleImageStatus}
|
|
170
|
+
style={{
|
|
171
|
+
visibility: avatarStatus !== 'loaded' ? 'hidden' : 'visible',
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
163
175
|
|
|
164
|
-
<StyledCircle
|
|
165
|
-
|
|
176
|
+
<StyledCircle
|
|
177
|
+
{...props}
|
|
178
|
+
theme={activeTheme}
|
|
179
|
+
inBuiltCss={defaultStyles}
|
|
166
180
|
type={'avatarCircle'}
|
|
167
|
-
customStyles={customStylesCircle}
|
|
168
|
-
|
|
181
|
+
customStyles={customStylesCircle}
|
|
182
|
+
size={size}
|
|
183
|
+
style={{ visibility: avatarStatus !== 'loaded' ? 'visible' : 'hidden' }}
|
|
169
184
|
isSelected={isSelected}
|
|
185
|
+
selectedStyle={selectedStyle}
|
|
186
|
+
notSelectedStyle={notSelectedStyle}
|
|
170
187
|
>
|
|
171
|
-
{
|
|
172
|
-
value
|
|
173
|
-
}
|
|
188
|
+
{value}
|
|
174
189
|
</StyledCircle>
|
|
175
|
-
{toggleName &&
|
|
190
|
+
{toggleName && (
|
|
191
|
+
<StyledName
|
|
192
|
+
theme={activeTheme}
|
|
193
|
+
{...props}
|
|
194
|
+
inBuiltCss={defaultStyles}
|
|
195
|
+
type={'avatarName'}
|
|
196
|
+
customStyles={customStylesName}
|
|
197
|
+
customStylesHover={customStylesNameHover}
|
|
198
|
+
size={size}
|
|
199
|
+
>
|
|
200
|
+
{user.userName}{' '}
|
|
201
|
+
</StyledName>
|
|
202
|
+
)}
|
|
176
203
|
</StyledContainer>
|
|
177
204
|
);
|
|
178
205
|
};
|
|
@@ -206,14 +233,9 @@ AvatarSBfooter.propTypes = {
|
|
|
206
233
|
* Object with user information. To display the user's picture need a key "url". To display the name need a key "userName"
|
|
207
234
|
*/
|
|
208
235
|
user: PropTypes.object,
|
|
209
|
-
/**
|
|
210
|
-
* Theme object
|
|
211
|
-
*/
|
|
212
|
-
theme: PropTypes.object,
|
|
213
236
|
};
|
|
214
237
|
|
|
215
238
|
AvatarSBfooter.defaultProps = {
|
|
216
|
-
theme: defaultStyles,
|
|
217
239
|
block: false,
|
|
218
240
|
size: 'MD',
|
|
219
241
|
toggleName: false,
|
|
@@ -222,5 +244,4 @@ AvatarSBfooter.defaultProps = {
|
|
|
222
244
|
customStylesImage: null,
|
|
223
245
|
customStylesCircle: null,
|
|
224
246
|
customStylesName: null,
|
|
225
|
-
};
|
|
226
|
-
|
|
247
|
+
};
|
|
@@ -1,46 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import styled from 'styled-components';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
|
|
6
6
|
const BannerWrapper = styled.div`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
7
|
+
color: ${({ theme }) => theme.textColor};
|
|
8
|
+
display: flex;
|
|
9
|
+
background-color: ${({ backgroundColor, theme }) =>
|
|
10
|
+
backgroundColor ? backgroundColor : theme.variant['insight-purple']};
|
|
11
|
+
border-left: 5px solid
|
|
12
|
+
${({ borderColor, theme }) =>
|
|
13
|
+
borderColor ? borderColor : theme.variant['graph-3']};
|
|
14
|
+
padding-left: 28px;
|
|
15
|
+
padding-top: 22px;
|
|
16
|
+
padding-bottom: 22px;
|
|
17
|
+
width: inherit;
|
|
18
|
+
`;
|
|
20
19
|
|
|
21
20
|
const BannerContent = styled.div`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
color: ${({ theme }) => theme.textColor};
|
|
22
|
+
display: flex;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
text-align: left;
|
|
25
|
+
word-wrap: break-word;
|
|
26
|
+
`;
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
export const Banner = ({
|
|
29
|
+
backgroundColor,
|
|
30
|
+
borderColor,
|
|
31
|
+
variant,
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
32
36
|
|
|
33
|
-
export const Banner = ({ backgroundColor, borderColor,variant, children,...props}) =>{
|
|
34
37
|
return (
|
|
35
38
|
<>
|
|
36
|
-
<BannerWrapper
|
|
37
|
-
|
|
39
|
+
<BannerWrapper
|
|
40
|
+
theme={activeTheme}
|
|
41
|
+
backgroundColor={backgroundColor}
|
|
42
|
+
borderColor={borderColor}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<BannerContent theme={activeTheme} {...props}>
|
|
38
46
|
{children}
|
|
39
47
|
</BannerContent>
|
|
40
48
|
</BannerWrapper>
|
|
41
49
|
</>
|
|
42
50
|
);
|
|
43
|
-
}
|
|
51
|
+
};
|
|
44
52
|
|
|
45
53
|
Banner.propTypes = {
|
|
46
54
|
/**
|
|
@@ -54,12 +62,9 @@ Banner.propTypes = {
|
|
|
54
62
|
/**
|
|
55
63
|
* What will be rendered inside the bannaer
|
|
56
64
|
*/
|
|
57
|
-
children: PropTypes.any
|
|
58
|
-
}
|
|
65
|
+
children: PropTypes.any,
|
|
66
|
+
};
|
|
59
67
|
|
|
60
68
|
Banner.defaultProps = {
|
|
61
69
|
children: '',
|
|
62
|
-
|
|
63
|
-
borderColor:'#8b2dff',
|
|
64
|
-
}
|
|
65
|
-
|
|
70
|
+
};
|