@sis-cc/dotstatsuite-visions 7.16.0 → 7.17.1
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/es/ChartsConfig/Axis.js +4 -4
- package/es/ChartsConfig/styles.js +6 -0
- package/es/Contact/Contact.js +327 -0
- package/es/Contact/Input.js +129 -0
- package/es/Contact/Mode.js +132 -0
- package/es/Contact/index.js +36 -0
- package/es/DataHeader/DataHeader.js +0 -3
- package/es/Share/Form.js +3 -2
- package/es/index.js +1 -0
- package/lib/ChartsConfig/Axis.js +4 -4
- package/lib/ChartsConfig/styles.js +6 -0
- package/lib/Contact/Contact.js +357 -0
- package/lib/Contact/Input.js +163 -0
- package/lib/Contact/Mode.js +169 -0
- package/lib/Contact/index.js +16 -0
- package/lib/DataHeader/DataHeader.js +0 -4
- package/lib/Share/Form.js +4 -2
- package/lib/index.js +10 -1
- package/package.json +3 -2
package/es/ChartsConfig/Axis.js
CHANGED
|
@@ -27,7 +27,7 @@ var AxisConfig = function AxisConfig(_ref) {
|
|
|
27
27
|
{ container: true, spacing: 1, className: classes.inputContainer },
|
|
28
28
|
isActive(min) && React.createElement(
|
|
29
29
|
Grid,
|
|
30
|
-
{ item: true, xs: 12, sm: 12, md: 6, lg:
|
|
30
|
+
{ item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
|
|
31
31
|
React.createElement(Input, _extends({}, min, {
|
|
32
32
|
value: R.when(R.isNil, R.always(''))(min.value),
|
|
33
33
|
type: 'number',
|
|
@@ -40,7 +40,7 @@ var AxisConfig = function AxisConfig(_ref) {
|
|
|
40
40
|
),
|
|
41
41
|
isActive(max) && React.createElement(
|
|
42
42
|
Grid,
|
|
43
|
-
{ item: true, xs: 12, sm: 12, md: 6, lg:
|
|
43
|
+
{ item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
|
|
44
44
|
React.createElement(Input, _extends({}, max, {
|
|
45
45
|
value: R.when(R.isNil, R.always(''))(max.value),
|
|
46
46
|
type: 'number',
|
|
@@ -53,7 +53,7 @@ var AxisConfig = function AxisConfig(_ref) {
|
|
|
53
53
|
),
|
|
54
54
|
isActive(pivot) && React.createElement(
|
|
55
55
|
Grid,
|
|
56
|
-
{ item: true, xs: 12, sm: 12, md: 6, lg:
|
|
56
|
+
{ item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
|
|
57
57
|
React.createElement(Input, _extends({}, pivot, {
|
|
58
58
|
value: R.when(R.isNil, R.always(''))(pivot.value),
|
|
59
59
|
type: 'number',
|
|
@@ -66,7 +66,7 @@ var AxisConfig = function AxisConfig(_ref) {
|
|
|
66
66
|
),
|
|
67
67
|
isActive(step) && React.createElement(
|
|
68
68
|
Grid,
|
|
69
|
-
{ item: true, xs: 12, sm: 12, md: 6, lg:
|
|
69
|
+
{ item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
|
|
70
70
|
React.createElement(Input, _extends({}, step, {
|
|
71
71
|
value: R.when(R.isNil, R.always(''))(step.value),
|
|
72
72
|
type: 'number',
|
|
@@ -34,6 +34,12 @@ export var useStyles = makeStyles(function (theme) {
|
|
|
34
34
|
paddingTop: '0px !important', // spacing items
|
|
35
35
|
paddingBottom: '0px !important' // spacing items
|
|
36
36
|
},
|
|
37
|
+
ellipsis: {
|
|
38
|
+
whiteSpace: 'nowrap',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
textOverflow: 'ellipsis',
|
|
41
|
+
flexFlow: 'nowrap'
|
|
42
|
+
},
|
|
37
43
|
marginDense: {
|
|
38
44
|
marginBottom: '0px !important'
|
|
39
45
|
},
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import * as R from 'ramda';
|
|
5
|
+
import { Grid, Paper, TextareaAutosize, Checkbox, FormControlLabel, Typography } from '@material-ui/core';
|
|
6
|
+
import { validate as getIsValidEmail } from 'isemail';
|
|
7
|
+
import { makeStyles } from '@material-ui/styles';
|
|
8
|
+
import Mode from './Mode';
|
|
9
|
+
import Input from './Input';
|
|
10
|
+
import { Button } from '../';
|
|
11
|
+
|
|
12
|
+
var useStyles = makeStyles(function (theme) {
|
|
13
|
+
return {
|
|
14
|
+
paper: {
|
|
15
|
+
backgroundColor: theme.palette.background.paper,
|
|
16
|
+
padding: theme.spacing(2)
|
|
17
|
+
},
|
|
18
|
+
emailReasonMessage: {
|
|
19
|
+
backgroundColor: R.path(['palette', 'tertiary', 'dark'])(theme) || theme.palette.grey[100],
|
|
20
|
+
padding: theme.spacing(2),
|
|
21
|
+
margin: theme.spacing(2, 0)
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
color: theme.palette.primary.main
|
|
25
|
+
},
|
|
26
|
+
textarea: {
|
|
27
|
+
width: '100%',
|
|
28
|
+
padding: theme.spacing(1)
|
|
29
|
+
},
|
|
30
|
+
textareaError: {
|
|
31
|
+
borderColor: theme.palette.error.main,
|
|
32
|
+
borderWidth: theme.spacing(0.25)
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var Contact = function Contact(_ref) {
|
|
38
|
+
var _cx;
|
|
39
|
+
|
|
40
|
+
var modes = _ref.modes,
|
|
41
|
+
_ref$defaultMode = _ref.defaultMode,
|
|
42
|
+
defaultMode = _ref$defaultMode === undefined ? 'question' : _ref$defaultMode,
|
|
43
|
+
defaultFullName = _ref.defaultFullName,
|
|
44
|
+
defaultEmail = _ref.defaultEmail,
|
|
45
|
+
labels = _ref.labels,
|
|
46
|
+
send = _ref.send,
|
|
47
|
+
isSubmitDisable = _ref.isSubmitDisable,
|
|
48
|
+
children = _ref.children;
|
|
49
|
+
|
|
50
|
+
var classes = useStyles();
|
|
51
|
+
|
|
52
|
+
var _useState = useState(defaultMode),
|
|
53
|
+
mode = _useState[0],
|
|
54
|
+
setMode = _useState[1];
|
|
55
|
+
|
|
56
|
+
var _useState2 = useState(''),
|
|
57
|
+
title = _useState2[0],
|
|
58
|
+
setTitle = _useState2[1];
|
|
59
|
+
|
|
60
|
+
var _useState3 = useState(defaultFullName || ''),
|
|
61
|
+
name = _useState3[0],
|
|
62
|
+
setName = _useState3[1];
|
|
63
|
+
|
|
64
|
+
var _useState4 = useState(''),
|
|
65
|
+
organisation = _useState4[0],
|
|
66
|
+
setOrganisation = _useState4[1];
|
|
67
|
+
|
|
68
|
+
var _useState5 = useState(defaultEmail || ''),
|
|
69
|
+
email = _useState5[0],
|
|
70
|
+
setEmail = _useState5[1];
|
|
71
|
+
|
|
72
|
+
var _useState6 = useState(false),
|
|
73
|
+
emailHasError = _useState6[0],
|
|
74
|
+
setEmailError = _useState6[1];
|
|
75
|
+
|
|
76
|
+
var _useState7 = useState(''),
|
|
77
|
+
details = _useState7[0],
|
|
78
|
+
setDetails = _useState7[1];
|
|
79
|
+
|
|
80
|
+
var _useState8 = useState(true),
|
|
81
|
+
checked = _useState8[0],
|
|
82
|
+
setChecked = _useState8[1];
|
|
83
|
+
|
|
84
|
+
var _useState9 = useState(true),
|
|
85
|
+
isSendDisable = _useState9[0],
|
|
86
|
+
setSendDisable = _useState9[1];
|
|
87
|
+
|
|
88
|
+
var _useState10 = useState(false),
|
|
89
|
+
detailsHasError = _useState10[0],
|
|
90
|
+
setDetailsError = _useState10[1];
|
|
91
|
+
|
|
92
|
+
var checkEmail = function checkEmail(email) {
|
|
93
|
+
if (getIsValidEmail(email)) {
|
|
94
|
+
return setEmailError(false);
|
|
95
|
+
}
|
|
96
|
+
return setEmailError(true);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var checkDetails = function checkDetails(details) {
|
|
100
|
+
if (R.isEmpty(details)) {
|
|
101
|
+
return setDetailsError(true);
|
|
102
|
+
}
|
|
103
|
+
return setDetailsError(false);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
var onSubmit = function onSubmit() {
|
|
107
|
+
if (R.is(Function)(send)) return send({
|
|
108
|
+
mode: mode,
|
|
109
|
+
title: title,
|
|
110
|
+
name: name,
|
|
111
|
+
organisation: organisation,
|
|
112
|
+
email: email,
|
|
113
|
+
details: details,
|
|
114
|
+
checkbox: checked
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
useEffect(function () {
|
|
119
|
+
if (R.isEmpty(email)) return setSendDisable(true);
|
|
120
|
+
if (R.isEmpty(details)) return setSendDisable(true);
|
|
121
|
+
if (emailHasError) return setSendDisable(true);
|
|
122
|
+
if (detailsHasError) return setSendDisable(true);
|
|
123
|
+
return setSendDisable(isSubmitDisable || false);
|
|
124
|
+
}, [emailHasError, detailsHasError, email, details, isSubmitDisable]);
|
|
125
|
+
|
|
126
|
+
return React.createElement(
|
|
127
|
+
Grid,
|
|
128
|
+
{ container: true, className: classes.paper, 'data-testid': 'contact-test-id' },
|
|
129
|
+
React.createElement(
|
|
130
|
+
Grid,
|
|
131
|
+
{ item: true, container: true, xs: 12, md: 12, justifyContent: 'space-between' },
|
|
132
|
+
React.createElement(
|
|
133
|
+
Grid,
|
|
134
|
+
{ item: true, xs: 12, sm: 12, md: 5 },
|
|
135
|
+
React.createElement(Mode, {
|
|
136
|
+
changeMode: setMode,
|
|
137
|
+
modes: modes,
|
|
138
|
+
mode: mode,
|
|
139
|
+
title: R.prop('modeTitle')(labels)
|
|
140
|
+
})
|
|
141
|
+
),
|
|
142
|
+
React.createElement(
|
|
143
|
+
Grid,
|
|
144
|
+
{ item: true, container: true, xs: 12, sm: 12, md: 6, 'flex-direction': 'column' },
|
|
145
|
+
React.createElement(
|
|
146
|
+
Grid,
|
|
147
|
+
{ item: true, xs: 12 },
|
|
148
|
+
React.createElement(Input, {
|
|
149
|
+
variant: 'outlined',
|
|
150
|
+
label: labels.personalTitle,
|
|
151
|
+
name: 'title',
|
|
152
|
+
type: 'text',
|
|
153
|
+
fullWidth: true,
|
|
154
|
+
value: title,
|
|
155
|
+
onChange: function onChange(e) {
|
|
156
|
+
return setTitle(e.target.value);
|
|
157
|
+
},
|
|
158
|
+
isControlled: true
|
|
159
|
+
})
|
|
160
|
+
),
|
|
161
|
+
React.createElement(
|
|
162
|
+
Grid,
|
|
163
|
+
{ item: true, xs: 12 },
|
|
164
|
+
React.createElement(Input, {
|
|
165
|
+
variant: 'outlined',
|
|
166
|
+
isControlled: true,
|
|
167
|
+
label: labels.name,
|
|
168
|
+
name: 'name',
|
|
169
|
+
type: 'text',
|
|
170
|
+
onChange: function onChange(e) {
|
|
171
|
+
return setName(e.target.value);
|
|
172
|
+
},
|
|
173
|
+
value: name,
|
|
174
|
+
fullWidth: true
|
|
175
|
+
})
|
|
176
|
+
),
|
|
177
|
+
React.createElement(
|
|
178
|
+
Grid,
|
|
179
|
+
{ item: true, xs: 12 },
|
|
180
|
+
React.createElement(Input, {
|
|
181
|
+
variant: 'outlined',
|
|
182
|
+
isControlled: true,
|
|
183
|
+
label: labels.organisation,
|
|
184
|
+
type: 'text',
|
|
185
|
+
name: 'organisation',
|
|
186
|
+
onChange: function onChange(e) {
|
|
187
|
+
return setOrganisation(e.target.value);
|
|
188
|
+
},
|
|
189
|
+
value: organisation,
|
|
190
|
+
fullWidth: true
|
|
191
|
+
})
|
|
192
|
+
),
|
|
193
|
+
React.createElement(
|
|
194
|
+
Grid,
|
|
195
|
+
{ item: true, xs: 12 },
|
|
196
|
+
React.createElement(Input, {
|
|
197
|
+
inputProps: {
|
|
198
|
+
'aria-label': R.prop('email')(labels),
|
|
199
|
+
autoComplete: 'email',
|
|
200
|
+
onBlur: function onBlur() {
|
|
201
|
+
return checkEmail(email);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
label: R.prop('email')(labels),
|
|
205
|
+
type: 'email',
|
|
206
|
+
value: email,
|
|
207
|
+
onChange: function onChange(e) {
|
|
208
|
+
return setEmail(e.target.value);
|
|
209
|
+
},
|
|
210
|
+
variant: 'outlined',
|
|
211
|
+
fullWidth: true,
|
|
212
|
+
isControlled: true,
|
|
213
|
+
defaultValue: defaultEmail,
|
|
214
|
+
textFieldProps: { error: emailHasError }
|
|
215
|
+
})
|
|
216
|
+
)
|
|
217
|
+
)
|
|
218
|
+
),
|
|
219
|
+
React.createElement(
|
|
220
|
+
Grid,
|
|
221
|
+
{ item: true, xs: 12, md: 12 },
|
|
222
|
+
React.createElement(
|
|
223
|
+
Paper,
|
|
224
|
+
{ className: classes.emailReasonMessage },
|
|
225
|
+
R.prop('message')(R.find(R.propEq('value', mode))(modes))
|
|
226
|
+
)
|
|
227
|
+
),
|
|
228
|
+
React.createElement(
|
|
229
|
+
Grid,
|
|
230
|
+
{ item: true, xs: 12, md: 12 },
|
|
231
|
+
React.createElement(TextareaAutosize, {
|
|
232
|
+
name: 'details',
|
|
233
|
+
onChange: function onChange(e) {
|
|
234
|
+
return setDetails(e.target.value);
|
|
235
|
+
},
|
|
236
|
+
className: cx(classes.textarea, (_cx = {}, _cx[classes.textareaError] = detailsHasError, _cx)),
|
|
237
|
+
'aria-label': R.prop('details')(labels),
|
|
238
|
+
minRows: 6,
|
|
239
|
+
placeholder: R.prop('details')(labels),
|
|
240
|
+
value: details,
|
|
241
|
+
onBlur: function onBlur() {
|
|
242
|
+
return checkDetails(details);
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
),
|
|
246
|
+
React.createElement(
|
|
247
|
+
Grid,
|
|
248
|
+
{ item: true, container: true, justifyContent: 'space-between' },
|
|
249
|
+
React.createElement(
|
|
250
|
+
Grid,
|
|
251
|
+
{ item: true },
|
|
252
|
+
React.createElement(FormControlLabel, {
|
|
253
|
+
control: React.createElement(Checkbox, { name: 'checkedB', color: 'primary' }),
|
|
254
|
+
label: React.createElement(
|
|
255
|
+
Typography,
|
|
256
|
+
{ variant: 'h6', className: classes.label },
|
|
257
|
+
R.prop('checkbox')(labels)
|
|
258
|
+
),
|
|
259
|
+
checked: checked,
|
|
260
|
+
onChange: function onChange(e) {
|
|
261
|
+
return setChecked(e.target.checked);
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
),
|
|
265
|
+
React.createElement(
|
|
266
|
+
Grid,
|
|
267
|
+
{ item: true },
|
|
268
|
+
React.createElement(
|
|
269
|
+
Typography,
|
|
270
|
+
{ variant: 'h6', className: classes.label, style: { paddingTop: 8 } },
|
|
271
|
+
R.prop('organisationPrivacyPolicy')(labels)
|
|
272
|
+
)
|
|
273
|
+
)
|
|
274
|
+
),
|
|
275
|
+
React.createElement(
|
|
276
|
+
Grid,
|
|
277
|
+
{ item: true, container: true, justifyContent: 'space-between', alignItems: 'center' },
|
|
278
|
+
React.createElement(
|
|
279
|
+
Grid,
|
|
280
|
+
{ item: true },
|
|
281
|
+
children
|
|
282
|
+
),
|
|
283
|
+
React.createElement(
|
|
284
|
+
Grid,
|
|
285
|
+
{ item: true },
|
|
286
|
+
React.createElement(
|
|
287
|
+
Button,
|
|
288
|
+
{
|
|
289
|
+
'aria-label': R.prop('submit')(labels),
|
|
290
|
+
type: 'submit',
|
|
291
|
+
disabled: isSendDisable,
|
|
292
|
+
variant: 'contained',
|
|
293
|
+
color: 'primary',
|
|
294
|
+
alternative: 'siscc',
|
|
295
|
+
onClick: onSubmit,
|
|
296
|
+
size: 'large',
|
|
297
|
+
className: classes.submitButton
|
|
298
|
+
},
|
|
299
|
+
R.prop('submit')(labels)
|
|
300
|
+
)
|
|
301
|
+
)
|
|
302
|
+
)
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
Contact.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
307
|
+
defaultMode: PropTypes.string,
|
|
308
|
+
defaultFullName: PropTypes.string,
|
|
309
|
+
defaultEmail: PropTypes.string,
|
|
310
|
+
lang: PropTypes.string,
|
|
311
|
+
theme: PropTypes.string,
|
|
312
|
+
modes: PropTypes.array,
|
|
313
|
+
send: PropTypes.func,
|
|
314
|
+
isSubmitDisable: PropTypes.bool,
|
|
315
|
+
children: PropTypes.node,
|
|
316
|
+
labels: PropTypes.shape({
|
|
317
|
+
name: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
318
|
+
organisation: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
319
|
+
personalTitle: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
320
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
321
|
+
submit: PropTypes.string,
|
|
322
|
+
email: PropTypes.string,
|
|
323
|
+
details: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
324
|
+
contactForHelp: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
|
|
325
|
+
})
|
|
326
|
+
} : {};
|
|
327
|
+
export default Contact;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import * as R from 'ramda';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
8
|
+
import TextField from '@material-ui/core/TextField';
|
|
9
|
+
import InputAdornment from '@material-ui/core/InputAdornment';
|
|
10
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
11
|
+
import Done from '@material-ui/icons/Done';
|
|
12
|
+
import { withInput } from '../Input/with-input';
|
|
13
|
+
|
|
14
|
+
var useStyles = makeStyles(function () {
|
|
15
|
+
return {
|
|
16
|
+
visibility: {
|
|
17
|
+
visibility: 'hidden'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
var LefttIcon = function LefttIcon(_ref) {
|
|
23
|
+
var Icon = _ref.Icon;
|
|
24
|
+
return React.createElement(Icon, null);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
LefttIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
28
|
+
Icon: PropTypes.object
|
|
29
|
+
} : {};
|
|
30
|
+
|
|
31
|
+
var RightIcon = function RightIcon(_ref2) {
|
|
32
|
+
var onSubmit = _ref2.onSubmit,
|
|
33
|
+
_ref2$Icon = _ref2.Icon,
|
|
34
|
+
Icon = _ref2$Icon === undefined ? Done : _ref2$Icon;
|
|
35
|
+
return React.createElement(
|
|
36
|
+
IconButton,
|
|
37
|
+
{ color: 'primary', onClick: function onClick() {
|
|
38
|
+
return onSubmit();
|
|
39
|
+
} },
|
|
40
|
+
React.createElement(Icon, null)
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
RightIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
45
|
+
Icon: PropTypes.object,
|
|
46
|
+
onSubmit: PropTypes.func,
|
|
47
|
+
classes: PropTypes.object
|
|
48
|
+
} : {};
|
|
49
|
+
|
|
50
|
+
export var MyInput = function MyInput(_ref3) {
|
|
51
|
+
var _cx;
|
|
52
|
+
|
|
53
|
+
var id = _ref3.id,
|
|
54
|
+
label = _ref3.label,
|
|
55
|
+
name = _ref3.name,
|
|
56
|
+
placeholder = _ref3.placeholder,
|
|
57
|
+
leftIcon = _ref3.leftIcon,
|
|
58
|
+
rightIcon = _ref3.rightIcon,
|
|
59
|
+
value = _ref3.value,
|
|
60
|
+
type = _ref3.type,
|
|
61
|
+
onChange = _ref3.onChange,
|
|
62
|
+
onSubmit = _ref3.onSubmit,
|
|
63
|
+
fullWidth = _ref3.fullWidth,
|
|
64
|
+
withValidationIcon = _ref3.withValidationIcon,
|
|
65
|
+
textFieldProps = _ref3.textFieldProps,
|
|
66
|
+
inputProps = _ref3.inputProps,
|
|
67
|
+
endAdornment = _ref3.endAdornment;
|
|
68
|
+
|
|
69
|
+
var classes = useStyles();
|
|
70
|
+
var startAdornment = R.isNil(leftIcon) ? null : React.createElement(
|
|
71
|
+
InputAdornment,
|
|
72
|
+
{ position: 'start' },
|
|
73
|
+
React.createElement(LefttIcon, { Icon: leftIcon })
|
|
74
|
+
);
|
|
75
|
+
var endMyadornment = R.or(withValidationIcon, !R.isNil(rightIcon)) ? React.createElement(
|
|
76
|
+
InputAdornment,
|
|
77
|
+
{ position: 'end', className: cx((_cx = {}, _cx[classes.visibility] = R.isEmpty(value), _cx)) },
|
|
78
|
+
React.createElement(RightIcon, { onSubmit: onSubmit, Icon: rightIcon })
|
|
79
|
+
) : null;
|
|
80
|
+
|
|
81
|
+
var onEnterLabel = function onEnterLabel(event) {
|
|
82
|
+
if (event.key === 'Enter') {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
if (R.is(Function, onSubmit)) {
|
|
85
|
+
onSubmit();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return React.createElement(TextField, _extends({
|
|
91
|
+
'data-testid': 'input-test-id',
|
|
92
|
+
margin: 'dense',
|
|
93
|
+
fullWidth: fullWidth,
|
|
94
|
+
id: id,
|
|
95
|
+
name: name,
|
|
96
|
+
type: type,
|
|
97
|
+
label: label,
|
|
98
|
+
value: value,
|
|
99
|
+
variant: 'outlined',
|
|
100
|
+
placeholder: placeholder,
|
|
101
|
+
onChange: onChange,
|
|
102
|
+
onKeyPress: onEnterLabel,
|
|
103
|
+
InputProps: {
|
|
104
|
+
startAdornment: startAdornment,
|
|
105
|
+
endAdornment: R.isNil(endAdornment) ? endMyadornment : endAdornment
|
|
106
|
+
},
|
|
107
|
+
inputProps: inputProps
|
|
108
|
+
}, textFieldProps));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
MyInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
112
|
+
id: PropTypes.string,
|
|
113
|
+
name: PropTypes.string,
|
|
114
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
115
|
+
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
116
|
+
leftIcon: PropTypes.object,
|
|
117
|
+
rightIcon: PropTypes.object,
|
|
118
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
119
|
+
type: PropTypes.string,
|
|
120
|
+
onChange: PropTypes.func,
|
|
121
|
+
onSubmit: PropTypes.func,
|
|
122
|
+
fullWidth: PropTypes.bool,
|
|
123
|
+
withValidationIcon: PropTypes.bool,
|
|
124
|
+
textFieldProps: PropTypes.object,
|
|
125
|
+
inputProps: PropTypes.object,
|
|
126
|
+
endAdornment: PropTypes.node
|
|
127
|
+
} : {};
|
|
128
|
+
|
|
129
|
+
export default withInput(MyInput);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import * as R from 'ramda';
|
|
6
|
+
import Card from '@material-ui/core/Card';
|
|
7
|
+
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
8
|
+
import CardContent from '@material-ui/core/CardContent';
|
|
9
|
+
import Typography from '@material-ui/core/Typography';
|
|
10
|
+
import RadioGroup from '@material-ui/core/RadioGroup';
|
|
11
|
+
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
12
|
+
import Radio from '@material-ui/core/Radio';
|
|
13
|
+
import { Tooltip, Warning as WarningIcon } from '../';
|
|
14
|
+
|
|
15
|
+
var useStyles = makeStyles(function (theme) {
|
|
16
|
+
return {
|
|
17
|
+
container: {
|
|
18
|
+
backgroundColor: theme.palette.secondary.dark,
|
|
19
|
+
boxShadow: 'none',
|
|
20
|
+
padding: theme.spacing(2),
|
|
21
|
+
width: '100%',
|
|
22
|
+
height: '100%'
|
|
23
|
+
},
|
|
24
|
+
title: _extends({
|
|
25
|
+
padding: 0
|
|
26
|
+
}, R.pathOr({}, ['mixins', 'share', 'title'], theme)),
|
|
27
|
+
content: {
|
|
28
|
+
padding: theme.spacing(1, 0),
|
|
29
|
+
'&:last-child': {
|
|
30
|
+
padding: theme.spacing(1, 0)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
label: theme.typography.body2,
|
|
34
|
+
warning: _extends({
|
|
35
|
+
marginLeft: theme.spacing(0.5),
|
|
36
|
+
width: 'unset',
|
|
37
|
+
fontSize: 'inherit',
|
|
38
|
+
height: '1.3em'
|
|
39
|
+
}, R.pathOr({}, ['mixins', 'share', 'warning'], theme))
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var Warning = function Warning(_ref) {
|
|
44
|
+
var title = _ref.title;
|
|
45
|
+
|
|
46
|
+
var classes = useStyles();
|
|
47
|
+
var theme = useTheme();
|
|
48
|
+
var warningColor = R.path(['palette', 'highlight', 'hl1'], theme) || theme.palette.primary.dark;
|
|
49
|
+
var warningTextColor = theme.palette.getContrastText(warningColor);
|
|
50
|
+
return React.createElement(
|
|
51
|
+
Tooltip,
|
|
52
|
+
{
|
|
53
|
+
className: classes.warning,
|
|
54
|
+
title: title,
|
|
55
|
+
tabIndex: 0,
|
|
56
|
+
variant: 'warning',
|
|
57
|
+
'aria-hidden': false,
|
|
58
|
+
placement: 'bottom',
|
|
59
|
+
PopperProps: {
|
|
60
|
+
modifiers: {
|
|
61
|
+
flip: {
|
|
62
|
+
behavior: ['bottom', 'top', 'left', 'right']
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
React.createElement(WarningIcon, { pathBackgroundColor: warningColor, pathColor: warningTextColor })
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
Warning.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
72
|
+
title: PropTypes.string
|
|
73
|
+
} : {};
|
|
74
|
+
|
|
75
|
+
var Mode = function Mode(_ref2) {
|
|
76
|
+
var changeMode = _ref2.changeMode,
|
|
77
|
+
mode = _ref2.mode,
|
|
78
|
+
_ref2$modes = _ref2.modes,
|
|
79
|
+
modes = _ref2$modes === undefined ? [] : _ref2$modes,
|
|
80
|
+
title = _ref2.title;
|
|
81
|
+
|
|
82
|
+
var classes = useStyles();
|
|
83
|
+
return React.createElement(
|
|
84
|
+
Card,
|
|
85
|
+
{ className: classes.container },
|
|
86
|
+
React.createElement(
|
|
87
|
+
CardContent,
|
|
88
|
+
{ className: classes.content },
|
|
89
|
+
React.createElement(
|
|
90
|
+
Typography,
|
|
91
|
+
{ variant: 'h6', className: classes.title },
|
|
92
|
+
title
|
|
93
|
+
),
|
|
94
|
+
React.createElement(
|
|
95
|
+
RadioGroup,
|
|
96
|
+
{ onChange: function onChange(e) {
|
|
97
|
+
return changeMode(e.target.value);
|
|
98
|
+
}, value: mode },
|
|
99
|
+
R.map(function (_ref3) {
|
|
100
|
+
var label = _ref3.label,
|
|
101
|
+
value = _ref3.value,
|
|
102
|
+
warningMessage = _ref3.warningMessage;
|
|
103
|
+
return React.createElement(FormControlLabel, {
|
|
104
|
+
classes: { label: classes.label },
|
|
105
|
+
key: value,
|
|
106
|
+
control: React.createElement(Radio, { variant: 'outlined', color: 'primary' }),
|
|
107
|
+
label: React.createElement(
|
|
108
|
+
'span',
|
|
109
|
+
null,
|
|
110
|
+
label,
|
|
111
|
+
warningMessage && React.createElement(Warning, { title: warningMessage })
|
|
112
|
+
),
|
|
113
|
+
value: value
|
|
114
|
+
});
|
|
115
|
+
})(modes)
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
Mode.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
122
|
+
changeMode: PropTypes.func,
|
|
123
|
+
mode: PropTypes.string,
|
|
124
|
+
modes: PropTypes.arrayOf(PropTypes.shape({
|
|
125
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
126
|
+
value: PropTypes.string,
|
|
127
|
+
warningMessage: PropTypes.string
|
|
128
|
+
})),
|
|
129
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
|
|
130
|
+
} : {};
|
|
131
|
+
|
|
132
|
+
export default Mode;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contact component is a popup for users to ask and give feedback.
|
|
3
|
+
* isSubmitDisable could be uncontrolled if the value is undefined
|
|
4
|
+
*
|
|
5
|
+
* @memberOf VISIONS
|
|
6
|
+
* @name Contact
|
|
7
|
+
* @tag component
|
|
8
|
+
* @api public
|
|
9
|
+
* @props
|
|
10
|
+
* Contact.propTypes = {
|
|
11
|
+
* defaultMode: PropTypes.string,
|
|
12
|
+
* defaultFullName: PropTypes.string,
|
|
13
|
+
* defaultEmail: PropTypes.string,
|
|
14
|
+
* lang: PropTypes.string,
|
|
15
|
+
* theme: PropTypes.string,
|
|
16
|
+
* modes: PropTypes.array,
|
|
17
|
+
* send: PropTypes.func,
|
|
18
|
+
* isSubmitDisable: PropTypes.bool,
|
|
19
|
+
* children: PropTypes.node,
|
|
20
|
+
* labels: PropTypes.shape({
|
|
21
|
+
* name: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
22
|
+
* organisation: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
23
|
+
* personalTitle: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
24
|
+
* title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
25
|
+
* submit: PropTypes.string,
|
|
26
|
+
* email: PropTypes.string,
|
|
27
|
+
* details: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
28
|
+
* contactForHelp: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
29
|
+
* }),
|
|
30
|
+
* };
|
|
31
|
+
* @theme
|
|
32
|
+
// no custom theme there
|
|
33
|
+
* @demoReady
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
export { default } from './Contact';
|
|
@@ -14,7 +14,6 @@ import Title from './Title';
|
|
|
14
14
|
import Flags from './Flags';
|
|
15
15
|
import TooltipHeader from './TooltipHeader';
|
|
16
16
|
import { getReducedContent } from './utils';
|
|
17
|
-
import { Tooltip, Warning as WarningIcon } from '../';
|
|
18
17
|
|
|
19
18
|
var useStyles = makeStyles(function (theme) {
|
|
20
19
|
return {
|
|
@@ -134,8 +133,6 @@ var DataHeader = function DataHeader(_ref5) {
|
|
|
134
133
|
|
|
135
134
|
var theme = useTheme();
|
|
136
135
|
var iconColor = R.path(['mixins', 'dataHeader', 'icon', 'color'], theme);
|
|
137
|
-
var warningColor = R.path(['palette', 'highlight', 'hl1'], theme) || theme.palette.primary.dark;
|
|
138
|
-
var warningTextColor = theme.palette.getContrastText(warningColor);
|
|
139
136
|
|
|
140
137
|
var subtitleLength = R.length(subtitle);
|
|
141
138
|
|