groundfloor-react-ui 1.0.5 → 1.0.8
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/assets/icons/file-icon.svg +1 -0
- package/components/Button/PrimaryButton.js +63 -34
- package/components/Button/SecondaryButton.js +64 -31
- package/components/Form/FormComponent.js +118 -186
- package/components/Icon/Icon.js +4 -1
- package/components/Inputs/CheckBoxInput.js +153 -80
- package/components/Inputs/DateSelect.js +274 -227
- package/components/Inputs/DropdownSelect.js +160 -159
- package/components/Inputs/DropzoneInput.js +27 -22
- package/components/Inputs/NumericInput.js +76 -71
- package/components/Inputs/PasswordInput.js +1 -0
- package/components/Inputs/RadioInput.js +124 -83
- package/components/Inputs/TextArea.js +122 -94
- package/components/Inputs/TextInput.js +87 -67
- package/components/Inputs/TimeInput.js +87 -72
- package/components/Modal/ModalComp.js +2 -1
- package/components/constants/defaultStyle.js +184 -184
- package/dist/index.es.js +602 -590
- package/dist/index.js +620 -608
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="b2bc64ed-393d-4e15-8787-df9ec8050d97" data-name="ae65933b-c6e6-4b40-868c-58201eab117d" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21.4 24"><defs><style>.bb405ea1-9d39-4705-a069-9048c97b4cda{fill:#2e56f4;}.accb9cd8-805e-4c9f-9b46-25d8ccc4d9c0{isolation:isolate;font-size:9.07px;fill:#fff;font-family:AvertaCY-Extrabold, Averta CY;font-weight:800;letter-spacing:0.04em;}</style></defs><path class="bb405ea1-9d39-4705-a069-9048c97b4cda" d="M20.1,8.5h-.6V5.6h0c0-.2-.1-.3-.1-.4L14.6,0H2.8a.9.9,0,0,0-.9.9h0V8.5H1.3A1.3,1.3,0,0,0,0,9.8H0v7a1.3,1.3,0,0,0,1.2,1.4h.7v4.9a.9.9,0,0,0,.9.9H18.5a1,1,0,0,0,1-.8h0v-5h.6a1.3,1.3,0,0,0,1.3-1.3h0v-7a1.3,1.3,0,0,0-1.3-1.3ZM18.5,22.8H2.8V18.2H18.5Zm0-14.3H2.8V.7h11V5.6c.1.3.3.5.5.4h4.2Z"/><text class="accb9cd8-805e-4c9f-9b46-25d8ccc4d9c0" transform="translate(0.8 16.6)">FILE</text></svg>
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
|
|
6
|
-
import getDefaultStyles, { hexToRGB } from
|
|
5
|
+
import { Loader } from '../Loaders';
|
|
6
|
+
import getDefaultStyles, { hexToRGB } from '../constants/utils';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Primary UI component for user interaction
|
|
@@ -12,61 +12,85 @@ import getDefaultStyles, { hexToRGB } from "../constants/utils";
|
|
|
12
12
|
const sizes = {
|
|
13
13
|
sm: {
|
|
14
14
|
fontSize: '14px',
|
|
15
|
-
padding: '5px 15px'
|
|
15
|
+
padding: '5px 15px',
|
|
16
16
|
},
|
|
17
17
|
md: {
|
|
18
18
|
fontSize: '16px',
|
|
19
|
-
padding: '5.5px 15px'
|
|
19
|
+
padding: '5.5px 15px',
|
|
20
20
|
},
|
|
21
21
|
lg: {
|
|
22
22
|
fontSize: '18px',
|
|
23
|
-
padding: '8px 20px'
|
|
23
|
+
padding: '8px 20px',
|
|
24
24
|
},
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
|
|
27
|
-
const buttonDisabledBg = ({ theme, variant }) =>
|
|
27
|
+
const buttonDisabledBg = ({ theme, variant }) =>
|
|
28
|
+
hexToRGB(theme.variant[variant], 0.6);
|
|
28
29
|
const fontColor = defaultThemeColor.bgColor;
|
|
29
30
|
|
|
30
31
|
const StyledButton = styled.button`
|
|
31
|
-
|
|
32
|
+
background: ${({ theme, variant }) => theme.variant[variant]};
|
|
33
|
+
color: ${fontColor};
|
|
34
|
+
padding: ${({ size }) => sizes[size].padding};
|
|
35
|
+
border: 1px solid ${({ theme, variant }) => theme.variant[variant]};
|
|
36
|
+
border-radius: 5px;
|
|
37
|
+
font-size: ${({ size }) => sizes[size].fontSize};
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
width: ${({ block }) => (block ? '100%' : 'auto')};
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
line-height: 18px;
|
|
43
|
+
&:disabled {
|
|
32
44
|
color: ${fontColor};
|
|
33
|
-
|
|
34
|
-
border: 1px solid ${
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
width: ${({ block }) => block ? '100%' : 'auto'};
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
line-height: 18px;
|
|
42
|
-
&:disabled {
|
|
43
|
-
color: ${fontColor};
|
|
44
|
-
background: ${buttonDisabledBg};
|
|
45
|
-
border: 1px solid ${buttonDisabledBg};
|
|
46
|
-
cursor: not-allowed;
|
|
47
|
-
}
|
|
45
|
+
background: ${buttonDisabledBg};
|
|
46
|
+
border: 1px solid ${buttonDisabledBg};
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
}
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
//Set the styles from the default styles object
|
|
51
|
+
${({ theme, defaultStyle }) => {
|
|
51
52
|
return getDefaultStyles(theme, defaultStyle);
|
|
52
53
|
}}
|
|
53
|
-
`;
|
|
54
|
-
// console.log(fontColor)
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
// custom styles
|
|
56
|
+
${({ btnStyle }) => btnStyle}
|
|
57
|
+
`;
|
|
57
58
|
|
|
59
|
+
export const PrimaryButton = ({
|
|
60
|
+
btnStyle,
|
|
61
|
+
block,
|
|
62
|
+
size,
|
|
63
|
+
style,
|
|
64
|
+
variant,
|
|
65
|
+
disabled,
|
|
66
|
+
isLoading,
|
|
67
|
+
type,
|
|
68
|
+
...props
|
|
69
|
+
}) => {
|
|
58
70
|
return (
|
|
59
71
|
<StyledButton
|
|
60
72
|
block={block}
|
|
61
73
|
variant={variant}
|
|
62
|
-
defaultStyle=
|
|
74
|
+
defaultStyle='button'
|
|
63
75
|
type={type}
|
|
64
76
|
style={style}
|
|
65
77
|
size={size}
|
|
66
78
|
disabled={disabled}
|
|
79
|
+
btnStyle={btnStyle}
|
|
67
80
|
{...props}
|
|
68
81
|
>
|
|
69
|
-
{
|
|
82
|
+
{isLoading && (
|
|
83
|
+
<div
|
|
84
|
+
style={{
|
|
85
|
+
paddingRight: '10px',
|
|
86
|
+
display: 'flex',
|
|
87
|
+
justifyContent: 'center',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<Loader customStyles={{ 'background-color': fontColor }} size={16} />
|
|
92
|
+
</div>
|
|
93
|
+
)}
|
|
70
94
|
{props.children}
|
|
71
95
|
</StyledButton>
|
|
72
96
|
);
|
|
@@ -102,14 +126,18 @@ PrimaryButton.propTypes = {
|
|
|
102
126
|
*/
|
|
103
127
|
theme: PropTypes.object,
|
|
104
128
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
* Type of the btn i.e: button or submit etc.
|
|
130
|
+
*/
|
|
107
131
|
type: PropTypes.string,
|
|
132
|
+
/**
|
|
133
|
+
* custome style of button
|
|
134
|
+
*/
|
|
135
|
+
btnStyle: PropTypes.object,
|
|
108
136
|
};
|
|
109
137
|
|
|
110
138
|
StyledButton.defaultProps = {
|
|
111
139
|
theme: defaultThemeColor,
|
|
112
|
-
}
|
|
140
|
+
};
|
|
113
141
|
|
|
114
142
|
PrimaryButton.defaultProps = {
|
|
115
143
|
theme: defaultThemeColor,
|
|
@@ -119,4 +147,5 @@ PrimaryButton.defaultProps = {
|
|
|
119
147
|
disabled: false,
|
|
120
148
|
size: 'md',
|
|
121
149
|
onClick: undefined,
|
|
122
|
-
}
|
|
150
|
+
btnStyle: {},
|
|
151
|
+
};
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
import getDefaultStyles from '../constants/utils';
|
|
6
|
+
import { Loader } from '../Loaders';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Secondary UI component for user interaction
|
|
@@ -10,60 +11,87 @@ import getDefaultStyles from '../constants/utils';
|
|
|
10
11
|
|
|
11
12
|
const sizes = {
|
|
12
13
|
sm: {
|
|
13
|
-
fontSize: '
|
|
14
|
-
padding: '5px 15px'
|
|
14
|
+
fontSize: '14',
|
|
15
|
+
padding: '5px 15px',
|
|
15
16
|
},
|
|
16
17
|
md: {
|
|
17
|
-
fontSize: '
|
|
18
|
-
padding: '5.5px 15px'
|
|
18
|
+
fontSize: '16',
|
|
19
|
+
padding: '5.5px 15px',
|
|
19
20
|
},
|
|
20
21
|
lg: {
|
|
21
|
-
fontSize: '
|
|
22
|
-
padding: '8px 20px'
|
|
22
|
+
fontSize: '18',
|
|
23
|
+
padding: '8px 20px',
|
|
23
24
|
},
|
|
24
|
-
}
|
|
25
|
+
};
|
|
25
26
|
|
|
26
27
|
const buttonDisabledBg = '#BBC4CF';
|
|
28
|
+
const fontColor = defaultThemeColor.primary['primary-1'];
|
|
27
29
|
|
|
28
30
|
const StyledButton = styled.button`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
32
|
+
background: ${({ theme }) => theme.bgColor};
|
|
33
|
+
padding: ${({ size }) => sizes[size].padding};
|
|
34
|
+
border: 1px solid ${({ theme, variant }) => theme.variant[variant]};
|
|
35
|
+
font-size: ${({ size }) => sizes[size].fontSize};
|
|
36
|
+
border-radius: 5px;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
width: ${({ block }) => (block ? '100%' : 'auto')};
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
line-height: 18px;
|
|
42
|
+
&:disabled {
|
|
43
|
+
color: #929eac;
|
|
44
|
+
border: 1px solid ${buttonDisabledBg};
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
}
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
//Set the styles from the default styles object
|
|
49
|
+
${({ theme, defaultStyle }) => {
|
|
48
50
|
return getDefaultStyles(theme, defaultStyle);
|
|
49
51
|
}}
|
|
52
|
+
// custom styles
|
|
53
|
+
${({ btnStyle }) => btnStyle}
|
|
50
54
|
`;
|
|
51
55
|
|
|
52
|
-
export const SecondaryButton = ({
|
|
56
|
+
export const SecondaryButton = ({
|
|
57
|
+
btnStyle,
|
|
58
|
+
isLoading,
|
|
59
|
+
block,
|
|
60
|
+
size,
|
|
61
|
+
style,
|
|
62
|
+
variant,
|
|
63
|
+
disabled,
|
|
64
|
+
type,
|
|
65
|
+
...props
|
|
66
|
+
}) => {
|
|
53
67
|
const theme = useTheme() || defaultThemeColor;
|
|
54
68
|
|
|
55
69
|
return (
|
|
56
70
|
<StyledButton
|
|
57
71
|
block={block}
|
|
58
72
|
variant={variant}
|
|
59
|
-
defaultStyle=
|
|
73
|
+
defaultStyle='button'
|
|
60
74
|
style={style}
|
|
61
75
|
size={size}
|
|
62
76
|
disabled={disabled}
|
|
63
77
|
type={type}
|
|
78
|
+
btnStyle={btnStyle}
|
|
79
|
+
isLoading={isLoading}
|
|
64
80
|
{...props}
|
|
65
81
|
>
|
|
66
|
-
{
|
|
82
|
+
{isLoading && (
|
|
83
|
+
<div
|
|
84
|
+
style={{
|
|
85
|
+
paddingRight: '10px',
|
|
86
|
+
display: 'flex',
|
|
87
|
+
justifyContent: 'center',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<Loader customStyles={{ 'background-color': fontColor }} size={16} />
|
|
92
|
+
</div>
|
|
93
|
+
)}
|
|
94
|
+
{props.children}{' '}
|
|
67
95
|
</StyledButton>
|
|
68
96
|
);
|
|
69
97
|
};
|
|
@@ -94,14 +122,18 @@ SecondaryButton.propTypes = {
|
|
|
94
122
|
*/
|
|
95
123
|
theme: PropTypes.object,
|
|
96
124
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
125
|
+
* Type of the btn i.e: button or submit etc.
|
|
126
|
+
*/
|
|
99
127
|
type: PropTypes.string,
|
|
128
|
+
/**
|
|
129
|
+
* custome style of button
|
|
130
|
+
*/
|
|
131
|
+
btnStyle: PropTypes.object,
|
|
100
132
|
};
|
|
101
133
|
|
|
102
134
|
StyledButton.defaultProps = {
|
|
103
135
|
theme: defaultThemeColor,
|
|
104
|
-
}
|
|
136
|
+
};
|
|
105
137
|
|
|
106
138
|
SecondaryButton.defaultProps = {
|
|
107
139
|
theme: defaultThemeColor,
|
|
@@ -110,4 +142,5 @@ SecondaryButton.defaultProps = {
|
|
|
110
142
|
disabled: false,
|
|
111
143
|
size: 'md',
|
|
112
144
|
onClick: undefined,
|
|
145
|
+
btnStyle: {},
|
|
113
146
|
};
|