groundfloor-react-ui 1.0.4 → 1.0.7
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/{Form → DesignComponent/StyledComponent}/StyledComponent.js +12 -17
- package/components/DesignComponent/StyledComponent/index.js +1 -0
- package/components/DesignComponent/index.js +1 -0
- package/components/Form/FormComponent.js +119 -187
- package/components/Form/SubmitComponent.js +1 -1
- package/components/Form/index.js +0 -1
- package/components/Icon/Icon.js +4 -1
- package/components/Inputs/CheckBoxInput.js +17 -8
- 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 +709 -708
- package/dist/index.js +707 -706
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -4,120 +4,126 @@ import styled, { css, useTheme } from 'styled-components';
|
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
|
|
6
6
|
const TextBox = styled.div`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
border: 1px solid
|
|
8
|
+
${({ theme }) =>
|
|
9
|
+
theme ? defaultThemeColor.border : theme.variant['primary-1']};
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
padding: 6.5px 12px;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
15
|
+
.input-icon svg path {
|
|
16
|
+
fill: ${({ theme }) => theme.variant['neutral-1']};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:focus-within {
|
|
20
|
+
border: 1px solid ${({ theme }) => theme.variant['primary-1']};
|
|
21
|
+
outline: none;
|
|
22
|
+
|
|
23
|
+
.input-icon svg path {
|
|
24
|
+
fill: ${({ theme }) => theme.variant['primary-1']};
|
|
24
25
|
}
|
|
26
|
+
}
|
|
25
27
|
`;
|
|
26
28
|
|
|
27
29
|
TextBox.defaultProps = {
|
|
28
30
|
theme: defaultThemeColor,
|
|
29
|
-
}
|
|
31
|
+
};
|
|
30
32
|
|
|
31
33
|
const Input = styled.input`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
border: 0;
|
|
35
|
+
outline: 0;
|
|
36
|
+
color: ${({ theme }) => theme.variant['primary-2']};
|
|
37
|
+
margin: 0px;
|
|
38
|
+
padding: 0;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
flex-grow: 1;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
|
|
43
|
+
// custom styles
|
|
44
|
+
${({ inputStyle }) => inputStyle}
|
|
43
45
|
`;
|
|
44
46
|
|
|
45
47
|
Input.defaultProps = {
|
|
46
48
|
theme: defaultThemeColor,
|
|
47
|
-
}
|
|
49
|
+
};
|
|
48
50
|
|
|
49
51
|
const requiredAsterisk = css`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
&:after {
|
|
53
|
+
content: ' *';
|
|
54
|
+
color: ${({ theme }) => theme.variant['error']};
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
55
57
|
|
|
56
58
|
const Label = styled.label`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
display: flex;
|
|
60
|
+
margin-right: 10px;
|
|
61
|
+
align-content: center;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
display: block;
|
|
65
|
+
margin-bottom: ${({ labelInline }) => (labelInline ? '0' : '7px')};
|
|
66
|
+
margin-right: ${({ labelInline }) => (labelInline ? '7px' : '')};
|
|
67
|
+
padding-bottom: 0px;
|
|
68
|
+
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
66
69
|
`;
|
|
67
70
|
|
|
68
71
|
Label.defaultProps = {
|
|
69
72
|
theme: defaultThemeColor,
|
|
70
|
-
}
|
|
73
|
+
};
|
|
71
74
|
|
|
72
75
|
const inline = css`
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
`;
|
|
76
79
|
|
|
77
80
|
const Form = styled.div`
|
|
78
|
-
|
|
81
|
+
${({ labelInline }) => (labelInline ? inline : null)}
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
> div {
|
|
84
|
+
flex: 1 0 auto;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
84
87
|
|
|
85
88
|
Form.defaultProps = {
|
|
86
89
|
theme: defaultThemeColor,
|
|
87
|
-
}
|
|
88
|
-
export const NumericInput = ({
|
|
90
|
+
};
|
|
91
|
+
export const NumericInput = ({
|
|
92
|
+
label,
|
|
93
|
+
inputValue,
|
|
94
|
+
inputStyle,
|
|
95
|
+
iconBefore,
|
|
96
|
+
iconAfter,
|
|
97
|
+
onChange,
|
|
98
|
+
...props
|
|
99
|
+
}) => {
|
|
89
100
|
const handleChange = (e) => {
|
|
90
101
|
const re = /^[0-9\b.-]+$/;
|
|
91
102
|
const { value } = e.currentTarget;
|
|
92
103
|
if (value === '' || re.test(value)) {
|
|
93
104
|
onChange(value);
|
|
94
105
|
}
|
|
95
|
-
}
|
|
106
|
+
};
|
|
96
107
|
|
|
97
108
|
return (
|
|
98
109
|
<Form {...props}>
|
|
99
110
|
{label.length > 0 && <Label {...props}>{label}</Label>}
|
|
100
111
|
<div>
|
|
101
|
-
<TextBox
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{iconBefore}
|
|
106
|
-
</div>
|
|
107
|
-
<Input {...props}
|
|
112
|
+
<TextBox {...props}>
|
|
113
|
+
<div className='input-icon'>{iconBefore}</div>
|
|
114
|
+
<Input
|
|
115
|
+
{...props}
|
|
108
116
|
inputStyle={inputStyle}
|
|
109
117
|
value={inputValue}
|
|
110
118
|
onChange={handleChange}
|
|
111
119
|
type='number'
|
|
112
120
|
/>
|
|
113
|
-
<div className=
|
|
114
|
-
{iconAfter}
|
|
115
|
-
</div>
|
|
121
|
+
<div className='input-icon'>{iconAfter}</div>
|
|
116
122
|
</TextBox>
|
|
117
123
|
</div>
|
|
118
124
|
</Form>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
125
|
+
);
|
|
126
|
+
};
|
|
121
127
|
|
|
122
128
|
NumericInput.propTypes = {
|
|
123
129
|
/**
|
|
@@ -138,8 +144,7 @@ NumericInput.propTypes = {
|
|
|
138
144
|
inputValue: PropTypes.any,
|
|
139
145
|
|
|
140
146
|
inputStyle: PropTypes.object,
|
|
141
|
-
|
|
142
|
-
}
|
|
147
|
+
};
|
|
143
148
|
|
|
144
149
|
NumericInput.defaultProps = {
|
|
145
150
|
theme: defaultThemeColor,
|
|
@@ -147,4 +152,4 @@ NumericInput.defaultProps = {
|
|
|
147
152
|
labelInline: false,
|
|
148
153
|
inputStyle: {},
|
|
149
154
|
inputValue: null,
|
|
150
|
-
}
|
|
155
|
+
};
|
|
@@ -6,64 +6,87 @@ import defaultStyles from '../constants/defaultStyle';
|
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
const RadioOuterCircle = styled.div`
|
|
10
|
+
box-sizing: initial;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
//Set the styles from the default styles object
|
|
13
|
+
${({ theme, defaultRadioOuterCircleStyle }) => {
|
|
14
14
|
return getDefaultStyles(theme, defaultRadioOuterCircleStyle);
|
|
15
15
|
}}
|
|
16
|
-
|
|
17
|
-
border: 2px solid ${({ value, selected, selectedCircleColor, defaultBorderColor }) => value !== selected ? defaultBorderColor : selectedCircleColor};
|
|
18
|
-
|
|
19
|
-
// custom styles
|
|
20
|
-
${({ radioOuterCircleStyle }) => radioOuterCircleStyle}
|
|
21
|
-
`;
|
|
22
16
|
|
|
17
|
+
border: 2px solid ${({
|
|
18
|
+
value,
|
|
19
|
+
selected,
|
|
20
|
+
selectedCircleColor,
|
|
21
|
+
defaultBorderColor,
|
|
22
|
+
}) => (value !== selected ? defaultBorderColor : selectedCircleColor)};
|
|
23
|
+
|
|
24
|
+
// custom styles
|
|
25
|
+
${({ radioOuterCircleStyle }) => radioOuterCircleStyle}
|
|
26
|
+
`;
|
|
23
27
|
|
|
24
28
|
const RadioInnerCircle = styled.div`
|
|
29
|
+
box-sizing: initial;
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
//Set the styles from the default styles object
|
|
32
|
+
${({ theme, defaultRadioInnerCircleStyle }) => {
|
|
28
33
|
return getDefaultStyles(theme, defaultRadioInnerCircleStyle);
|
|
29
34
|
}}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
width: ${({ value, selected, width }) => (value === selected ? width : 0)};
|
|
37
|
+
height: ${({ value, selected, height }) => (value === selected ? height : 0)};
|
|
38
|
+
background-color: ${({ value, selected, selectedCircleColor }) =>
|
|
39
|
+
value === selected ? selectedCircleColor : 'transparent'};
|
|
40
|
+
|
|
41
|
+
// custom styles
|
|
42
|
+
${({ radioInnerCircleStyle }) => radioInnerCircleStyle}
|
|
37
43
|
`;
|
|
38
44
|
|
|
39
45
|
const OptionText = styled.div`
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
//Set the styles from the default styles object
|
|
47
|
+
${({ theme, defaultOptionStyle }) => {
|
|
42
48
|
return getDefaultStyles(theme, defaultOptionStyle);
|
|
43
49
|
}}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
selectedOptionTextColor : defaultOptionColor};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
margin-right: ${({ inline }) => (!inline ? '30px' : '')};
|
|
51
|
+
color: ${({ selected, selectedOptionTextColor, defaultOptionColor }) =>
|
|
52
|
+
selected ? selectedOptionTextColor : defaultOptionColor};
|
|
53
|
+
|
|
54
|
+
// custom styles
|
|
55
|
+
${({ optionStyle }) => optionStyle}
|
|
50
56
|
`;
|
|
51
57
|
|
|
52
58
|
const WrapperDiv = styled.div`
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
margin-bottom: ${({ inline }) => (!inline ? '14px' : '')};
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
align-items: center;
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 10px;
|
|
64
|
+
`;
|
|
59
65
|
|
|
60
66
|
const ParentDiv = styled.div`
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
display: ${({ inline }) => (!inline ? 'inline-block' : 'flex')};
|
|
68
|
+
width: max-content;
|
|
69
|
+
margin: 0;
|
|
70
|
+
`;
|
|
65
71
|
|
|
66
|
-
export const RadioInput = ({
|
|
72
|
+
export const RadioInput = ({
|
|
73
|
+
radioOuterCircleStyle,
|
|
74
|
+
radioInnerCircleStyle,
|
|
75
|
+
labelStyle,
|
|
76
|
+
label,
|
|
77
|
+
optionStyle,
|
|
78
|
+
options,
|
|
79
|
+
selectedCircleColor,
|
|
80
|
+
selectedOptionTextColor,
|
|
81
|
+
onChange,
|
|
82
|
+
selected,
|
|
83
|
+
width,
|
|
84
|
+
height,
|
|
85
|
+
inline,
|
|
86
|
+
defaultBorderColor,
|
|
87
|
+
defaultOptionColor,
|
|
88
|
+
...props
|
|
89
|
+
}) => {
|
|
67
90
|
return (
|
|
68
91
|
<div>
|
|
69
92
|
<Label
|
|
@@ -72,52 +95,71 @@ export const RadioInput = ({ radioOuterCircleStyle, radioInnerCircleStyle, label
|
|
|
72
95
|
type={'radio-label'}
|
|
73
96
|
text={label}
|
|
74
97
|
/>
|
|
75
|
-
<ParentDiv inline={inline}
|
|
98
|
+
<ParentDiv inline={inline}>
|
|
76
99
|
{options.map((item, i) => {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
defaultBorderColor={defaultBorderColor}
|
|
85
|
-
selectedCircleColor={selectedCircleColor}
|
|
86
|
-
radioOuterCircleStyle={{ ...radioOuterCircleStyle, cursor: item?.disabled ? 'not-allowed ' : ' pointer', borderColor: item?.disabled && item?.disabledColor }}
|
|
87
|
-
defaultRadioOuterCircleStyle={'radio-outer-circle'}
|
|
88
|
-
value={item.value}
|
|
89
|
-
selected={!item?.disabled && selected}
|
|
100
|
+
return (
|
|
101
|
+
<WrapperDiv
|
|
102
|
+
key={i + Math.random() * 101}
|
|
103
|
+
inline={inline}
|
|
104
|
+
onClick={() => {
|
|
105
|
+
!item?.disabled && onChange(item.value);
|
|
106
|
+
}}
|
|
90
107
|
>
|
|
91
|
-
|
|
92
|
-
<RadioInnerCircle
|
|
108
|
+
<RadioOuterCircle
|
|
93
109
|
theme={defaultStyles}
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
themeColor={defaultThemeColor}
|
|
111
|
+
defaultBorderColor={defaultBorderColor}
|
|
96
112
|
selectedCircleColor={selectedCircleColor}
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
radioOuterCircleStyle={{
|
|
114
|
+
...radioOuterCircleStyle,
|
|
115
|
+
cursor: item?.disabled ? 'not-allowed ' : ' pointer',
|
|
116
|
+
borderColor: item?.disabled && item?.disabledColor,
|
|
117
|
+
}}
|
|
118
|
+
defaultRadioOuterCircleStyle={'radio-outer-circle'}
|
|
99
119
|
value={item.value}
|
|
100
|
-
selected={selected}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
selected={!item?.disabled && selected}
|
|
121
|
+
>
|
|
122
|
+
<RadioInnerCircle
|
|
123
|
+
theme={defaultStyles}
|
|
124
|
+
width={width}
|
|
125
|
+
height={height}
|
|
126
|
+
selectedCircleColor={selectedCircleColor}
|
|
127
|
+
radioInnerCircleStyle={{
|
|
128
|
+
...radioInnerCircleStyle,
|
|
129
|
+
cursor: item?.disabled ? 'not-allowed ' : ' pointer',
|
|
130
|
+
backgroundColor: item?.disabled
|
|
131
|
+
? 'transparent'
|
|
132
|
+
: item?.value === selected
|
|
133
|
+
? radioInnerCircleStyle?.backgroundColor
|
|
134
|
+
: 'transparent',
|
|
135
|
+
}}
|
|
136
|
+
defaultRadioInnerCircleStyle={'radio-inner-circle'}
|
|
137
|
+
value={item.value}
|
|
138
|
+
selected={selected}
|
|
139
|
+
/>
|
|
140
|
+
</RadioOuterCircle>
|
|
141
|
+
<OptionText
|
|
142
|
+
defaultOptionColor={defaultOptionColor}
|
|
143
|
+
optionStyle={{
|
|
144
|
+
...optionStyle,
|
|
145
|
+
cursor: item?.disabled ? 'not-allowed ' : ' pointer',
|
|
146
|
+
color: item?.disabled && item?.disabledColor,
|
|
147
|
+
}}
|
|
148
|
+
theme={defaultStyles}
|
|
149
|
+
defaultOptionStyle={'option-text'}
|
|
150
|
+
selectedOptionTextColor={selectedOptionTextColor}
|
|
151
|
+
// selected={item.value === selected}
|
|
152
|
+
selected={!item?.disabled && item.value === selected}
|
|
153
|
+
>
|
|
154
|
+
{item.label}
|
|
155
|
+
</OptionText>
|
|
156
|
+
</WrapperDiv>
|
|
157
|
+
);
|
|
116
158
|
})}
|
|
117
159
|
</ParentDiv>
|
|
118
160
|
</div>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
161
|
+
);
|
|
162
|
+
};
|
|
121
163
|
|
|
122
164
|
RadioInput.propTypes = {
|
|
123
165
|
/**
|
|
@@ -133,11 +175,11 @@ RadioInput.propTypes = {
|
|
|
133
175
|
*/
|
|
134
176
|
inline: PropTypes.bool,
|
|
135
177
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
178
|
+
* RadioButton Contents i.e:-
|
|
179
|
+
[{ label: "First Radio Button", value: "first", disabled:true, disabledColor: '#ae3232' },
|
|
180
|
+
{ label: "Second Radio Button", value: "second" },
|
|
181
|
+
{ label: "Third Radio Button", value: "third" }]
|
|
182
|
+
*/
|
|
141
183
|
options: PropTypes.array,
|
|
142
184
|
/**
|
|
143
185
|
* RadioButton style object
|
|
@@ -183,7 +225,7 @@ RadioInput.propTypes = {
|
|
|
183
225
|
* RadioButton selected option
|
|
184
226
|
*/
|
|
185
227
|
selectedOptionTextColor: PropTypes.string,
|
|
186
|
-
}
|
|
228
|
+
};
|
|
187
229
|
|
|
188
230
|
RadioInput.defaultProps = {
|
|
189
231
|
label: '',
|
|
@@ -201,5 +243,4 @@ RadioInput.defaultProps = {
|
|
|
201
243
|
height: '14px',
|
|
202
244
|
selectedCircleColor: `${defaultThemeColor.primary['primary-1']}`,
|
|
203
245
|
selectedOptionTextColor: `${defaultThemeColor.neutral['neutral-1']}`,
|
|
204
|
-
}
|
|
205
|
-
|
|
246
|
+
};
|