groundfloor-react-ui 1.0.16 → 1.0.19
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/Button/PrimaryButton.js +15 -8
- package/components/Button/SecondaryButton.js +11 -9
- package/components/Inputs/CheckBoxInput.js +34 -18
- package/components/Inputs/DateSelect.js +22 -17
- package/components/Inputs/DropdownSelect.js +31 -20
- package/components/Inputs/NumericInput.js +66 -63
- package/components/Inputs/PasswordInput.js +36 -27
- package/components/Inputs/TextInput.js +43 -28
- package/components/Inputs/TimeInput.js +95 -94
- package/components/Modal/ModalComp.js +6 -1
- package/components/constants/defaultStyle.js +0 -1
- package/dist/index.es.js +223 -216
- package/dist/index.js +213 -206
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ const TextBox = styled.div`
|
|
|
8
8
|
font-size: 21px;
|
|
9
9
|
border: 1px solid
|
|
10
10
|
${({ theme, isValid }) =>
|
|
11
|
-
|
|
11
|
+
isValid ? defaultThemeColor.border : theme.variant['error']};
|
|
12
12
|
border-radius: 4px;
|
|
13
13
|
padding: 5px;
|
|
14
14
|
display: inline-block;
|
|
@@ -21,7 +21,7 @@ const TextBox = styled.div`
|
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
23
|
TextBox.defaultProps = {
|
|
24
|
-
|
|
24
|
+
theme: defaultThemeColor,
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const Input = styled.input`
|
|
@@ -32,11 +32,12 @@ const Input = styled.input`
|
|
|
32
32
|
padding: 0;
|
|
33
33
|
font-size: 21px;
|
|
34
34
|
width: 24px;
|
|
35
|
+
text-align:center;
|
|
35
36
|
background-color: ${({ theme }) => theme.bgColor};
|
|
36
37
|
`;
|
|
37
38
|
|
|
38
39
|
Input.defaultProps = {
|
|
39
|
-
|
|
40
|
+
theme: defaultThemeColor,
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
const requiredAsterisk = css`
|
|
@@ -49,7 +50,7 @@ const requiredAsterisk = css`
|
|
|
49
50
|
const Label = styled.label`
|
|
50
51
|
display: block;
|
|
51
52
|
margin-bottom: ${({ labelInline, errMsg }) =>
|
|
52
|
-
|
|
53
|
+
labelInline && errMsg ? '18px' : '7px'};
|
|
53
54
|
margin-right: ${({ labelInline }) => (labelInline ? '7px' : '')};
|
|
54
55
|
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
55
56
|
${({ required }) => (required ? requiredAsterisk : null)}
|
|
@@ -57,7 +58,7 @@ const Label = styled.label`
|
|
|
57
58
|
`;
|
|
58
59
|
|
|
59
60
|
Label.defaultProps = {
|
|
60
|
-
|
|
61
|
+
theme: defaultThemeColor,
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const inline = css`
|
|
@@ -79,7 +80,7 @@ const Form = styled.div`
|
|
|
79
80
|
`;
|
|
80
81
|
|
|
81
82
|
Form.defaultProps = {
|
|
82
|
-
|
|
83
|
+
theme: defaultThemeColor,
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
const Button = styled.button`
|
|
@@ -94,102 +95,102 @@ const Button = styled.button`
|
|
|
94
95
|
`;
|
|
95
96
|
|
|
96
97
|
Button.defaultProps = {
|
|
97
|
-
|
|
98
|
+
theme: defaultThemeColor,
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export const TimeInput = ({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
label,
|
|
103
|
+
errMsg,
|
|
104
|
+
hour,
|
|
105
|
+
minute,
|
|
106
|
+
period,
|
|
107
|
+
onChange,
|
|
108
|
+
...props
|
|
108
109
|
}) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
110
|
+
const theme = useTheme() || defaultThemeColor;
|
|
111
|
+
|
|
112
|
+
function hourChange(evt) {
|
|
113
|
+
const num =
|
|
114
|
+
evt.currentTarget.value > 12
|
|
115
|
+
? 12
|
|
116
|
+
: parseFloat(evt.currentTarget.value) || 0;
|
|
117
|
+
onChange({ hour: num, minute, period });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function minuteChange(evt) {
|
|
121
|
+
console.log('minute change', evt.currentTarget.value);
|
|
122
|
+
const num =
|
|
123
|
+
evt.currentTarget.value > 59
|
|
124
|
+
? 59
|
|
125
|
+
: parseFloat(evt.currentTarget.value) || 0;
|
|
126
|
+
onChange({ hour, minute: num, period });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function periodChange(evt) {
|
|
130
|
+
const p = period === 'AM' ? 'PM' : 'AM';
|
|
131
|
+
onChange({ hour, minute, period: p });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Form {...props}>
|
|
136
|
+
<Label {...props} errMsg={errMsg}>
|
|
137
|
+
{label}
|
|
138
|
+
</Label>
|
|
139
|
+
<div>
|
|
140
|
+
<TextBox {...props}>
|
|
141
|
+
<Input value={hour} onChange={hourChange} />
|
|
142
|
+
:
|
|
143
|
+
<Input value={minute} onChange={minuteChange} />
|
|
144
|
+
<Button onClick={periodChange}>{period}</Button>
|
|
145
|
+
</TextBox>
|
|
146
|
+
<div className='err-text'>{errMsg}</div>
|
|
147
|
+
</div>
|
|
148
|
+
</Form>
|
|
149
|
+
);
|
|
149
150
|
};
|
|
150
151
|
|
|
151
152
|
TimeInput.propTypes = {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Label of Input
|
|
155
|
+
*/
|
|
156
|
+
label: PropTypes.string,
|
|
157
|
+
/**
|
|
158
|
+
* Hour value
|
|
159
|
+
*/
|
|
160
|
+
hour: PropTypes.number.isRequired,
|
|
161
|
+
/**
|
|
162
|
+
* Minute value
|
|
163
|
+
*/
|
|
164
|
+
minute: PropTypes.number.isRequired,
|
|
165
|
+
/**
|
|
166
|
+
* AM or PM ?
|
|
167
|
+
*/
|
|
168
|
+
period: PropTypes.string.isRequired,
|
|
169
|
+
/**
|
|
170
|
+
* Is the input required?
|
|
171
|
+
*/
|
|
172
|
+
required: PropTypes.bool,
|
|
173
|
+
/**
|
|
174
|
+
* Should label be inline?
|
|
175
|
+
*/
|
|
176
|
+
labelInline: PropTypes.bool,
|
|
177
|
+
/**
|
|
178
|
+
* Is the input correct?
|
|
179
|
+
*/
|
|
180
|
+
isValid: PropTypes.bool,
|
|
181
|
+
/**
|
|
182
|
+
* Error Message
|
|
183
|
+
*/
|
|
184
|
+
errMsg: PropTypes.string,
|
|
184
185
|
};
|
|
185
186
|
|
|
186
187
|
TimeInput.defaultProps = {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
label: '',
|
|
189
|
+
hour: 0,
|
|
190
|
+
minute: 0,
|
|
191
|
+
period: 'AM',
|
|
192
|
+
required: false,
|
|
193
|
+
labelInline: false,
|
|
194
|
+
isValid: true,
|
|
195
|
+
errMsg: '',
|
|
195
196
|
};
|
|
@@ -77,7 +77,12 @@ const CommonDiv = styled.div`
|
|
|
77
77
|
padding: 2rem 3rem 0rem 3rem;
|
|
78
78
|
`;
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
try {
|
|
81
|
+
Modal.setAppElement('#root')
|
|
82
|
+
|
|
83
|
+
} catch (error) {
|
|
84
|
+
Modal.setAppElement('#__next')
|
|
85
|
+
}
|
|
81
86
|
|
|
82
87
|
export const ModalComp = ({
|
|
83
88
|
modalIsOpen,
|