groundfloor-react-ui 1.0.17 → 1.0.20
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 +12 -6
- package/components/Button/PrimaryButton.js +15 -8
- package/components/Button/SecondaryButton.js +11 -9
- package/components/Cards/Card.js +25 -30
- package/components/Cards/DocumentCard.js +83 -89
- package/components/Divider/Divider.js +23 -30
- 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/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 +67 -38
- package/components/Pagination/Pagination.js +30 -54
- package/components/ProgressBar/ProgressBar.js +57 -40
- package/components/Rating/Rating.js +8 -14
- package/components/Tables/Table.js +56 -34
- package/components/Tooltip/Tooltip.js +135 -141
- package/components/constants/defaultStyle.js +28 -38
- package/dist/index.es.js +484 -438
- package/dist/index.js +483 -437
- package/package.json +1 -1
|
@@ -1,83 +1,59 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
|
|
6
6
|
const StyledPagination = styled.div`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
|
-
StyledPagination.defaultProps = {
|
|
13
|
-
theme: defaultThemeColor,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
12
|
export const Pagination = ({ ...props }) => {
|
|
13
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
17
14
|
|
|
18
15
|
return (
|
|
19
|
-
<StyledPagination>
|
|
20
|
-
{props.children}
|
|
21
|
-
</ StyledPagination>
|
|
16
|
+
<StyledPagination theme={activeTheme}>{props.children}</StyledPagination>
|
|
22
17
|
);
|
|
23
18
|
};
|
|
24
19
|
|
|
25
|
-
Pagination.propTypes = {
|
|
26
|
-
/**
|
|
27
|
-
* Theme props
|
|
28
|
-
*/
|
|
29
|
-
theme: PropTypes.object,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
Pagination.defaultProps = {
|
|
33
|
-
theme: defaultThemeColor,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
20
|
const Item = styled.div`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
color: ${({ selected, theme }) =>
|
|
23
|
+
selected ? theme.variant['primary-1'] : null};
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
width: 14px;
|
|
27
|
+
height: 14px;
|
|
28
|
+
path {
|
|
29
|
+
fill: ${({ selected, theme }) =>
|
|
30
|
+
selected ? theme.variant['primary-1'] : theme.variant['neutral-2']};
|
|
46
31
|
}
|
|
32
|
+
}
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
&:not(:first-child):not(:last-child) {
|
|
36
|
+
margin: 0 22px;
|
|
37
|
+
}
|
|
52
38
|
`;
|
|
53
39
|
|
|
54
|
-
Item.defaultProps = {
|
|
55
|
-
theme: defaultThemeColor,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
40
|
Pagination.PageItem = function PageItem({ selected, ...props }) {
|
|
41
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
42
|
+
|
|
59
43
|
return (
|
|
60
|
-
<Item selected={selected} {...props}>
|
|
44
|
+
<Item selected={selected} theme={activeTheme} {...props}>
|
|
61
45
|
{props.children}
|
|
62
46
|
</Item>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
65
49
|
|
|
66
50
|
Pagination.PageItem.propTypes = {
|
|
67
|
-
/**
|
|
68
|
-
* Theme props
|
|
69
|
-
*/
|
|
70
|
-
theme: PropTypes.object,
|
|
71
51
|
/**
|
|
72
52
|
* Is Page selected?
|
|
73
|
-
|
|
53
|
+
*/
|
|
74
54
|
selected: PropTypes.bool,
|
|
75
|
-
}
|
|
55
|
+
};
|
|
76
56
|
|
|
77
57
|
Pagination.PageItem.defaultProps = {
|
|
78
|
-
theme: defaultThemeColor,
|
|
79
58
|
selected: false,
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
59
|
+
};
|
|
@@ -1,47 +1,68 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
5
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
-
import
|
|
6
|
+
import { hexToRGB } from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
|
-
import { hexToRGB } from "../constants/utils";
|
|
9
8
|
|
|
10
9
|
const WrapperDiv = styled.div`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
height: 10px;
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
margin-top: 13px;
|
|
13
|
+
margin-left: 13px;
|
|
14
|
+
margin-right: 13px;
|
|
15
|
+
width: inherit;
|
|
16
|
+
background-color: ${({ color, theme }) =>
|
|
17
|
+
color ? hexToRGB(color, 0.5) : hexToRGB(theme.primary['primary-1'], 0.5)};
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
20
|
const Container = styled.div`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
height: inherit;
|
|
22
|
+
width: inherit;
|
|
23
|
+
transition: width 1s ease-in-out;
|
|
24
|
+
border-radius: inherit;
|
|
25
|
+
text-align: right;
|
|
26
|
+
|
|
27
|
+
// custom styles
|
|
28
|
+
${({ progressBarStyle }) => progressBarStyle}
|
|
29
|
+
width: ${({ now }) => now + '%'};
|
|
30
|
+
background-color: ${({ color, theme }) =>
|
|
31
|
+
color ? color : theme.primary['primary-1']};
|
|
30
32
|
`;
|
|
31
33
|
|
|
32
|
-
export const ProgressBar = ({
|
|
34
|
+
export const ProgressBar = ({
|
|
35
|
+
labelStyle,
|
|
36
|
+
progressBarStyle,
|
|
37
|
+
label,
|
|
38
|
+
now,
|
|
39
|
+
color,
|
|
40
|
+
...props
|
|
41
|
+
}) => {
|
|
42
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
43
|
+
|
|
33
44
|
return (
|
|
34
45
|
<div>
|
|
35
46
|
<Label
|
|
36
|
-
|
|
47
|
+
inBuiltCss={defaultStyles}
|
|
37
48
|
customStyles={labelStyle}
|
|
38
49
|
type={'progressbarLabel'}
|
|
39
50
|
text={label}
|
|
40
|
-
{...props}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
<WrapperDiv
|
|
54
|
+
progressBarStyle={progressBarStyle}
|
|
55
|
+
theme={activeTheme}
|
|
56
|
+
color={color}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<Container
|
|
60
|
+
progressBarStyle={progressBarStyle}
|
|
61
|
+
now={now}
|
|
62
|
+
theme={activeTheme}
|
|
63
|
+
color={color}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
45
66
|
</WrapperDiv>
|
|
46
67
|
</div>
|
|
47
68
|
);
|
|
@@ -49,19 +70,19 @@ export const ProgressBar = ({ labelStyle,progressBarStyle,label,now,color,...pro
|
|
|
49
70
|
|
|
50
71
|
ProgressBar.propTypes = {
|
|
51
72
|
/**
|
|
52
|
-
* Custom style of the
|
|
73
|
+
* Custom style of the label of the progressBar
|
|
53
74
|
*/
|
|
54
75
|
labelStyle: PropTypes.object,
|
|
55
76
|
/**
|
|
56
|
-
* Custom style of the
|
|
77
|
+
* Custom style of the progressBar
|
|
57
78
|
*/
|
|
58
79
|
progressBarStyle: PropTypes.object,
|
|
59
|
-
|
|
80
|
+
|
|
60
81
|
/**
|
|
61
|
-
* Custom color(HEX format) of the
|
|
82
|
+
* Custom color(HEX format) of the progressBar
|
|
62
83
|
*/
|
|
63
84
|
color: PropTypes.string,
|
|
64
|
-
|
|
85
|
+
|
|
65
86
|
/**
|
|
66
87
|
* label props
|
|
67
88
|
*/
|
|
@@ -73,12 +94,8 @@ ProgressBar.propTypes = {
|
|
|
73
94
|
};
|
|
74
95
|
|
|
75
96
|
ProgressBar.defaultProps = {
|
|
76
|
-
labelStyle:{},
|
|
97
|
+
labelStyle: {},
|
|
77
98
|
progressBarStyle: {},
|
|
78
|
-
label:'',
|
|
79
|
-
now:0,
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
99
|
+
label: '',
|
|
100
|
+
now: 0,
|
|
101
|
+
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import styled, { css, useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
5
|
|
|
7
6
|
const StyledContainer = styled.div`
|
|
8
7
|
box-sizing: border-box;
|
|
@@ -112,7 +111,6 @@ function getPercentage(value, maxRange) {
|
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
export const Rating = ({
|
|
115
|
-
theme,
|
|
116
114
|
type,
|
|
117
115
|
customStylesContainer,
|
|
118
116
|
customStylesStar,
|
|
@@ -127,6 +125,7 @@ export const Rating = ({
|
|
|
127
125
|
toggleSet,
|
|
128
126
|
identifier,
|
|
129
127
|
...props }) => {
|
|
128
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
130
129
|
|
|
131
130
|
const [starArr, setStarArr] = useState(undefined);
|
|
132
131
|
const [starVal, setStarVal] = useState(undefined);
|
|
@@ -182,18 +181,15 @@ export const Rating = ({
|
|
|
182
181
|
</>
|
|
183
182
|
|
|
184
183
|
return (
|
|
185
|
-
<StyledContainer
|
|
184
|
+
<StyledContainer customStyles={customStylesContainer} type={type} size={size} {...props} className={'container'} >
|
|
186
185
|
{toggleStar ? stars :
|
|
187
|
-
<StyledPercentage
|
|
186
|
+
<StyledPercentage type={type} customStyles={customStylesPercentage}>{percentage}%</StyledPercentage>}
|
|
188
187
|
</StyledContainer>
|
|
189
188
|
)
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
Rating.propTypes = {
|
|
193
|
-
|
|
194
|
-
* Theme props
|
|
195
|
-
*/
|
|
196
|
-
theme: PropTypes.object,
|
|
192
|
+
|
|
197
193
|
/**
|
|
198
194
|
* Custom style object for container
|
|
199
195
|
*/
|
|
@@ -249,7 +245,6 @@ Rating.propTypes = {
|
|
|
249
245
|
}
|
|
250
246
|
|
|
251
247
|
Rating.defaultProps = {
|
|
252
|
-
theme: defaultStyles,
|
|
253
248
|
customStylesContainer: null,
|
|
254
249
|
customStylesStar: null,
|
|
255
250
|
customStylesPercentage: null,
|
|
@@ -260,5 +255,4 @@ Rating.defaultProps = {
|
|
|
260
255
|
toggleStar: true,
|
|
261
256
|
toggleSet: false,
|
|
262
257
|
color: '#F7B001'
|
|
263
|
-
}
|
|
264
|
-
|
|
258
|
+
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import DataTable from 'react-data-table-component';
|
|
4
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
5
|
import defaultStyles from '../constants/defaultStyle';
|
|
6
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
7
|
import { Icon } from '../Icon';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Primary UI component for user interaction
|
|
9
11
|
*/
|
|
10
12
|
|
|
13
|
+
const WrapperDiv = styled.div`
|
|
14
|
+
.form-check-input {
|
|
15
|
+
accent-color: ${({ theme }) => theme.primary['primary-1']};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
11
19
|
export const Table = ({
|
|
12
|
-
theme,
|
|
13
20
|
customStyles,
|
|
21
|
+
inBuiltCss,
|
|
14
22
|
type = 'table',
|
|
15
23
|
sortIcon,
|
|
16
24
|
data,
|
|
@@ -24,26 +32,40 @@ export const Table = ({
|
|
|
24
32
|
conditionalRowStyles,
|
|
25
33
|
fixedHeader,
|
|
26
34
|
fixedHeaderScrollHeight,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
tableStyle =
|
|
35
|
+
checkboxColor,
|
|
36
|
+
...props
|
|
37
|
+
}) => {
|
|
38
|
+
let tableStyle = {};
|
|
39
|
+
|
|
40
|
+
if (inBuiltCss) {
|
|
41
|
+
if (inBuiltCss[type]) {
|
|
42
|
+
tableStyle = inBuiltCss[type];
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
|
|
39
46
|
if (customStyles) {
|
|
40
47
|
for (const property in customStyles) {
|
|
41
|
-
tableStyle[property] = customStyles[property]
|
|
48
|
+
tableStyle[property] = customStyles[property];
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
53
|
+
|
|
54
|
+
const Checkbox = React.forwardRef(({ onClick, ...rest }, ref) => {
|
|
55
|
+
return (
|
|
56
|
+
<WrapperDiv theme={activeTheme}>
|
|
57
|
+
<input
|
|
58
|
+
type='checkbox'
|
|
59
|
+
className='form-check-input'
|
|
60
|
+
ref={ref}
|
|
61
|
+
onClick={onClick}
|
|
62
|
+
{...rest}
|
|
63
|
+
/>
|
|
64
|
+
</WrapperDiv>
|
|
65
|
+
);
|
|
66
|
+
});
|
|
46
67
|
|
|
68
|
+
return (
|
|
47
69
|
<DataTable
|
|
48
70
|
responsive={responsive}
|
|
49
71
|
data={data}
|
|
@@ -57,25 +79,22 @@ export const Table = ({
|
|
|
57
79
|
progressComponent={progressComponent ? progressComponent : undefined}
|
|
58
80
|
sortServer={sortServer}
|
|
59
81
|
onSort={(columnInfo, direction, event) => {
|
|
60
|
-
handleOnSort(columnInfo, direction, event)
|
|
82
|
+
handleOnSort(columnInfo, direction, event);
|
|
61
83
|
}}
|
|
62
84
|
conditionalRowStyles={conditionalRowStyles}
|
|
63
85
|
fixedHeader={fixedHeader}
|
|
64
86
|
fixedHeaderScrollHeight={fixedHeaderScrollHeight}
|
|
87
|
+
selectableRowsComponent={Checkbox}
|
|
65
88
|
{...props}
|
|
66
89
|
/>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
90
|
);
|
|
72
91
|
};
|
|
73
92
|
|
|
74
93
|
Table.propTypes = {
|
|
75
94
|
/**
|
|
76
|
-
*
|
|
95
|
+
* inBuiltCss object
|
|
77
96
|
*/
|
|
78
|
-
|
|
97
|
+
inBuiltCss: PropTypes.object,
|
|
79
98
|
/**
|
|
80
99
|
* Optional component to override the default sorting icon (must be downward)
|
|
81
100
|
*/
|
|
@@ -121,7 +140,7 @@ Table.propTypes = {
|
|
|
121
140
|
*/
|
|
122
141
|
fixedHeader: PropTypes.bool,
|
|
123
142
|
/**
|
|
124
|
-
* Optional to set height of the table
|
|
143
|
+
* Optional to set height of the table
|
|
125
144
|
*/
|
|
126
145
|
fixedHeaderScrollHeight: PropTypes.string,
|
|
127
146
|
/**
|
|
@@ -133,24 +152,27 @@ Table.propTypes = {
|
|
|
133
152
|
};
|
|
134
153
|
|
|
135
154
|
Table.defaultProps = {
|
|
136
|
-
|
|
137
|
-
sortIcon:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
155
|
+
inBuiltCss: defaultStyles,
|
|
156
|
+
sortIcon: (
|
|
157
|
+
<Icon
|
|
158
|
+
icon={'arrow-down'}
|
|
159
|
+
size={11}
|
|
160
|
+
color={'#333333'}
|
|
161
|
+
style={{
|
|
162
|
+
transform: 'scaleX(0.7) scaleY(0.7) translate(5px, -3px)',
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
165
|
+
),
|
|
145
166
|
data: [],
|
|
146
167
|
tableColumns: [],
|
|
147
168
|
progressPending: false,
|
|
148
169
|
defaultSortFieldId: null,
|
|
149
|
-
handleOnSort: (columnInfo, direction, event) => {
|
|
170
|
+
handleOnSort: (columnInfo, direction, event) => {
|
|
171
|
+
console.log(columnInfo, direction, event);
|
|
172
|
+
},
|
|
150
173
|
sortServer: null,
|
|
151
174
|
progressComponent: undefined,
|
|
152
175
|
responsive: true,
|
|
153
176
|
fixedHeader: true,
|
|
154
177
|
fixedHeaderScrollHeight: '100vh',
|
|
155
|
-
};
|
|
156
|
-
|
|
178
|
+
};
|