groundfloor-react-ui 1.0.3 → 1.0.6
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 -154
- 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/constants/defaultStyle.js +184 -184
- package/dist/index.es.js +709 -703
- package/dist/index.js +725 -719
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -3,134 +3,150 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import styled, { css, useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
const TextBox = styled.div`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
7
|
+
color: #a9b1b8;
|
|
8
|
+
font-size: 21px;
|
|
9
|
+
border: 1px solid
|
|
10
|
+
${({ theme, isValid }) =>
|
|
11
|
+
isValid ? defaultThemeColor.border : theme.variant['error']};
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
padding: 5px;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
align-items: center;
|
|
16
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
17
|
+
&:focus-within {
|
|
18
|
+
border: 1px solid ${({ theme }) => theme.variant['primary-1']};
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
20
21
|
`;
|
|
21
22
|
|
|
22
23
|
TextBox.defaultProps = {
|
|
23
24
|
theme: defaultThemeColor,
|
|
24
|
-
}
|
|
25
|
+
};
|
|
25
26
|
|
|
26
27
|
const Input = styled.input`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
border: 0;
|
|
29
|
+
outline: 0;
|
|
30
|
+
color: ${({ theme }) => theme.variant['primary-2']};
|
|
31
|
+
margin: 0 5px;
|
|
32
|
+
padding: 0;
|
|
33
|
+
font-size: 21px;
|
|
34
|
+
width: 24px;
|
|
35
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
34
36
|
`;
|
|
35
37
|
|
|
36
38
|
Input.defaultProps = {
|
|
37
39
|
theme: defaultThemeColor,
|
|
38
|
-
}
|
|
40
|
+
};
|
|
39
41
|
|
|
40
42
|
const requiredAsterisk = css`
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
&:after {
|
|
44
|
+
content: ' *';
|
|
45
|
+
color: ${({ theme }) => theme.variant['error']};
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
46
48
|
|
|
47
49
|
const Label = styled.label`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
display: block;
|
|
51
|
+
margin-bottom: ${({ labelInline, errMsg }) =>
|
|
52
|
+
labelInline && errMsg ? '18px' : '7px'};
|
|
53
|
+
margin-right: ${({ labelInline }) => (labelInline ? '7px' : '')};
|
|
54
|
+
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
55
|
+
${({ required }) => (required ? requiredAsterisk : null)}
|
|
56
|
+
padding-bottom: 0px;
|
|
53
57
|
`;
|
|
54
58
|
|
|
55
59
|
Label.defaultProps = {
|
|
56
60
|
theme: defaultThemeColor,
|
|
57
|
-
}
|
|
61
|
+
};
|
|
58
62
|
|
|
59
63
|
const inline = css`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
`;
|
|
63
67
|
|
|
64
68
|
const Form = styled.div`
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
${({ labelInline }) => (labelInline ? inline : null)}
|
|
70
|
+
.err-text {
|
|
71
|
+
color: ${({ theme }) => theme.variant['error']};
|
|
72
|
+
margin-top: 5px;
|
|
73
|
+
font-size: 10px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
> div {
|
|
77
|
+
flex: 1 0 auto;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
76
80
|
|
|
77
81
|
Form.defaultProps = {
|
|
78
82
|
theme: defaultThemeColor,
|
|
79
|
-
}
|
|
83
|
+
};
|
|
80
84
|
|
|
81
85
|
const Button = styled.button`
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
border: none;
|
|
87
|
+
outline: none;
|
|
88
|
+
border-radius: 4px;
|
|
89
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
90
|
+
color: #444;
|
|
91
|
+
padding: 5px 6px;
|
|
92
|
+
font-size: 18px;
|
|
93
|
+
cursor: pointer;
|
|
90
94
|
`;
|
|
91
95
|
|
|
92
96
|
Button.defaultProps = {
|
|
93
97
|
theme: defaultThemeColor,
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export const TimeInput = ({
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const TimeInput = ({
|
|
101
|
+
label,
|
|
102
|
+
errMsg,
|
|
103
|
+
hour,
|
|
104
|
+
minute,
|
|
105
|
+
period,
|
|
106
|
+
onChange,
|
|
107
|
+
...props
|
|
108
|
+
}) => {
|
|
97
109
|
const theme = useTheme() || defaultThemeColor;
|
|
98
110
|
|
|
99
111
|
function hourChange(evt) {
|
|
100
|
-
const num =
|
|
112
|
+
const num =
|
|
113
|
+
evt.currentTarget.value > 12
|
|
114
|
+
? 12
|
|
115
|
+
: parseFloat(evt.currentTarget.value) || 0;
|
|
101
116
|
onChange({ hour: num, minute, period });
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
function minuteChange(evt) {
|
|
105
120
|
console.log('minute change', evt.currentTarget.value);
|
|
106
|
-
const num =
|
|
121
|
+
const num =
|
|
122
|
+
evt.currentTarget.value > 59
|
|
123
|
+
? 59
|
|
124
|
+
: parseFloat(evt.currentTarget.value) || 0;
|
|
107
125
|
onChange({ hour, minute: num, period });
|
|
108
126
|
}
|
|
109
127
|
|
|
110
128
|
function periodChange(evt) {
|
|
111
|
-
const p = period === 'AM' ? 'PM' : 'AM'
|
|
129
|
+
const p = period === 'AM' ? 'PM' : 'AM';
|
|
112
130
|
onChange({ hour, minute, period: p });
|
|
113
131
|
}
|
|
114
132
|
|
|
115
133
|
return (
|
|
116
134
|
<Form {...props}>
|
|
117
|
-
<Label {...props} errMsg={errMsg}
|
|
135
|
+
<Label {...props} errMsg={errMsg}>
|
|
118
136
|
{label}
|
|
119
137
|
</Label>
|
|
120
138
|
<div>
|
|
121
|
-
<TextBox
|
|
122
|
-
{...props}
|
|
123
|
-
>
|
|
139
|
+
<TextBox {...props}>
|
|
124
140
|
<Input value={hour} onChange={hourChange} />
|
|
125
141
|
:
|
|
126
142
|
<Input value={minute} onChange={minuteChange} />
|
|
127
|
-
<Button onClick={periodChange}
|
|
143
|
+
<Button onClick={periodChange}>{period}</Button>
|
|
128
144
|
</TextBox>
|
|
129
145
|
<div className='err-text'>{errMsg}</div>
|
|
130
146
|
</div>
|
|
131
147
|
</Form>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
148
|
+
);
|
|
149
|
+
};
|
|
134
150
|
|
|
135
151
|
TimeInput.propTypes = {
|
|
136
152
|
/**
|
|
@@ -165,7 +181,7 @@ TimeInput.propTypes = {
|
|
|
165
181
|
* Error Message
|
|
166
182
|
*/
|
|
167
183
|
errMsg: PropTypes.string,
|
|
168
|
-
}
|
|
184
|
+
};
|
|
169
185
|
|
|
170
186
|
TimeInput.defaultProps = {
|
|
171
187
|
label: '',
|
|
@@ -176,5 +192,4 @@ TimeInput.defaultProps = {
|
|
|
176
192
|
labelInline: false,
|
|
177
193
|
isValid: true,
|
|
178
194
|
errMsg: '',
|
|
179
|
-
}
|
|
180
|
-
|
|
195
|
+
};
|