@sis-cc/dotstatsuite-visions 7.15.0 → 7.16.0

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.
@@ -0,0 +1,432 @@
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, { useState } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import * as R from 'ramda';
6
+ import { Grid, Typography } from '@material-ui/core';
7
+ import { makeStyles } from '@material-ui/styles';
8
+ import Input from './Input';
9
+ import Button from '../Button';
10
+ import Select from '../Select';
11
+ import PermsissionsTabs from './PermsissionsTabs';
12
+
13
+ var useStyles = makeStyles(function (theme) {
14
+ return {
15
+ paper: {
16
+ backgroundColor: theme.palette.background.paper,
17
+ padding: theme.spacing(2)
18
+ },
19
+ label: {
20
+ color: theme.palette.primary.main
21
+ },
22
+ textarea: {
23
+ width: '100%',
24
+ padding: theme.spacing(1)
25
+ },
26
+ submitButton: {
27
+ margin: theme.spacing(1)
28
+ },
29
+ contentLabel: {
30
+ fontSize: '14px'
31
+ }
32
+ };
33
+ });
34
+
35
+ var UserRightForm = function UserRightForm(_ref) {
36
+ var labels = _ref.labels,
37
+ artefactTypes = _ref.artefactTypes,
38
+ dataSpaces = _ref.dataSpaces,
39
+ permissionTabs = _ref.permissionTabs,
40
+ apply = _ref.apply,
41
+ onCancel = _ref.onCancel,
42
+ user = _ref.user,
43
+ artefactID = _ref.artefactID,
44
+ artefactType = _ref.artefactType,
45
+ artefactVersion = _ref.artefactVersion,
46
+ maintenanceAgencyID = _ref.maintenanceAgencyID,
47
+ dataspace = _ref.dataspace;
48
+
49
+ var classes = useStyles();
50
+
51
+ var _useState = useState(R.propOr('*', 'value')(user)),
52
+ userValue = _useState[0],
53
+ setUserValue = _useState[1];
54
+
55
+ var _useState2 = useState(R.propOr('*', 'value')(dataspace)),
56
+ dataspaceValue = _useState2[0],
57
+ setDataspaceValue = _useState2[1];
58
+
59
+ var _useState3 = useState(R.propOr('*', 'value')(artefactType)),
60
+ artefactTypeValue = _useState3[0],
61
+ setArtefactTypeValue = _useState3[1];
62
+
63
+ var _useState4 = useState(R.propOr('*', 'value')(maintenanceAgencyID)),
64
+ maintenanceAgencyIDValue = _useState4[0],
65
+ setMaintenanceAgencyIDValue = _useState4[1];
66
+
67
+ var _useState5 = useState(R.propOr('*', 'value')(artefactID)),
68
+ artefactIDValue = _useState5[0],
69
+ setArtefactIDValue = _useState5[1];
70
+
71
+ var _useState6 = useState(R.propOr('*', 'value')(artefactVersion)),
72
+ artefactVersionValue = _useState6[0],
73
+ setArtefactVersionValue = _useState6[1];
74
+
75
+ var initialSelectedPermissions = R.pipe(R.pathOr([], ['options', 'data']), R.filter(R.prop('isSelected')), R.reduce(function (acc, _ref2) {
76
+ var id = _ref2.id;
77
+ return R.assoc(id, id, acc);
78
+ }, {}))(permissionTabs);
79
+
80
+ var _useState7 = useState(initialSelectedPermissions),
81
+ selectedPermissions = _useState7[0],
82
+ setSelectedPermissions = _useState7[1];
83
+
84
+ var onCheckPermission = function onCheckPermission(id) {
85
+ if (R.has(id, selectedPermissions)) {
86
+ setSelectedPermissions(R.dissoc(id, selectedPermissions));
87
+ } else {
88
+ setSelectedPermissions(R.assoc(id, id, selectedPermissions));
89
+ }
90
+ };
91
+ var permissionsIdsIndexedByGroups = R.reduce(function (acc, group) {
92
+ return R.assoc(group.id, group.options, acc);
93
+ }, {}, R.pathOr([], ['permissions', 'data'], permissionTabs));
94
+ var selectedPermissionsGroups = R.pipe(R.pathOr([], ['permissions', 'data']), R.filter(function (group) {
95
+ return group.options && R.all(function (id) {
96
+ return R.has(id, selectedPermissions);
97
+ }, group.options || []);
98
+ }), R.reduce(function (acc, _ref3) {
99
+ var id = _ref3.id;
100
+ return R.assoc(id, id, acc);
101
+ }, {}))(permissionTabs);
102
+
103
+ var onCheckPermissionGroup = function onCheckPermissionGroup(id) {
104
+ if (R.has(id, selectedPermissionsGroups)) {
105
+ setSelectedPermissions(R.omit(permissionsIdsIndexedByGroups[id], selectedPermissions));
106
+ } else {
107
+ setSelectedPermissions(_extends({}, selectedPermissions, R.indexBy(R.identity, permissionsIdsIndexedByGroups[id])));
108
+ }
109
+ };
110
+ var evolvedPermissions = R.pipe(R.over(R.lensPath(['options', 'data']), R.map(function (opt) {
111
+ return R.assoc('isSelected', R.has(opt.id, selectedPermissions), opt);
112
+ })), R.over(R.lensPath(['permissions', 'data']), R.map(function (opt) {
113
+ return R.assoc('isSelected', R.has(opt.id, selectedPermissionsGroups), opt);
114
+ })))(permissionTabs);
115
+
116
+ var onChangeDataspace = function onChangeDataspace(value) {
117
+ return setDataspaceValue(value);
118
+ };
119
+ var onChangeArtefactType = function onChangeArtefactType(value) {
120
+ return setArtefactTypeValue(value);
121
+ };
122
+
123
+ var handleCancel = function handleCancel() {
124
+ if (R.is(Function)(onCancel)) return onCancel();
125
+ };
126
+ var handleSubmit = function handleSubmit() {
127
+ if (R.is(Function)(apply)) return apply({
128
+ user: userValue,
129
+ dataspace: dataspaceValue,
130
+ artefactType: artefactTypeValue,
131
+ maintenanceAgencyID: maintenanceAgencyIDValue,
132
+ artefactID: artefactIDValue,
133
+ artefactVersion: artefactVersionValue,
134
+ checkedPermissions: R.values(selectedPermissions)
135
+ });
136
+ };
137
+
138
+ var isErrorDataspace = R.pipe(R.find(R.propEq('value', dataspaceValue)), R.isNil)(dataSpaces);
139
+ var isErrorArtefactType = R.pipe(R.find(R.propEq('value', artefactTypeValue)), R.isNil)(artefactTypes);
140
+ var isValidPermissions = !R.isEmpty(selectedPermissions) && !R.equals(selectedPermissions, initialSelectedPermissions);
141
+ var isValidFields = R.all(function (value) {
142
+ return !R.isEmpty(value) && !R.isNil(value);
143
+ }, [userValue, maintenanceAgencyIDValue, artefactIDValue, artefactVersionValue, dataspaceValue, artefactTypeValue]);
144
+
145
+ return React.createElement(
146
+ Grid,
147
+ { container: true, className: classes.paper, 'data-testid': 'permission-test-id' },
148
+ React.createElement(
149
+ Grid,
150
+ { item: true, container: true, xs: 12, md: 12, justifyContent: 'space-between' },
151
+ React.createElement(
152
+ Grid,
153
+ { item: true, container: true, xs: 12, sm: 12, md: 5, 'flex-direction': 'column' },
154
+ React.createElement(
155
+ Grid,
156
+ { item: true, container: true, xs: 12, alignItems: 'center' },
157
+ React.createElement(
158
+ Grid,
159
+ { item: true, xs: 12, md: 4 },
160
+ React.createElement(
161
+ Typography,
162
+ { variant: 'h6', className: classes.contentLabel },
163
+ R.prop('user')(labels)
164
+ )
165
+ ),
166
+ React.createElement(
167
+ Grid,
168
+ { item: true, xs: 12, md: 8 },
169
+ React.createElement(Input, {
170
+ variant: 'outlined',
171
+ name: 'User',
172
+ type: 'text',
173
+ fullWidth: true,
174
+ value: userValue,
175
+ onChange: function onChange(e) {
176
+ return setUserValue(e.target.value);
177
+ },
178
+ isControlled: true,
179
+ textFieldProps: { disabled: R.propOr(false, 'disabled')(user) }
180
+ })
181
+ )
182
+ ),
183
+ React.createElement(
184
+ Grid,
185
+ { item: true, container: true, xs: 12, alignItems: 'center' },
186
+ React.createElement(
187
+ Grid,
188
+ { item: true, xs: 12, md: 4 },
189
+ React.createElement(
190
+ Typography,
191
+ { variant: 'h6', className: classes.contentLabel, style: { paddingTop: 8 } },
192
+ R.prop('dataspace')(labels)
193
+ )
194
+ ),
195
+ React.createElement(
196
+ Grid,
197
+ { item: true, xs: 12, md: 8 },
198
+ React.createElement(Select, {
199
+ value: R.defaultTo('*', dataspaceValue),
200
+ items: dataSpaces,
201
+ onChange: onChangeDataspace,
202
+ textFieldProps: {
203
+ disabled: R.propOr(false, 'disabled')(dataspace),
204
+ error: isErrorDataspace
205
+ }
206
+ })
207
+ )
208
+ ),
209
+ React.createElement(
210
+ Grid,
211
+ { item: true, container: true, xs: 12, alignItems: 'center' },
212
+ React.createElement(
213
+ Grid,
214
+ { item: true, xs: 12, md: 4 },
215
+ React.createElement(
216
+ Typography,
217
+ { variant: 'h6', className: classes.contentLabel, style: { paddingTop: 8 } },
218
+ R.prop('artefactType')(labels)
219
+ )
220
+ ),
221
+ React.createElement(
222
+ Grid,
223
+ { item: true, xs: 12, md: 8 },
224
+ React.createElement(Select, {
225
+ value: R.defaultTo('*', artefactTypeValue),
226
+ items: artefactTypes,
227
+ onChange: onChangeArtefactType,
228
+ textFieldProps: {
229
+ disabled: R.propOr(false, 'disabled')(artefactType),
230
+ error: isErrorArtefactType
231
+ }
232
+ })
233
+ )
234
+ )
235
+ ),
236
+ React.createElement(
237
+ Grid,
238
+ { item: true, container: true, xs: 12, sm: 12, md: 5, 'flex-direction': 'column' },
239
+ React.createElement(
240
+ Grid,
241
+ { item: true, container: true, xs: 12, alignItems: 'center' },
242
+ React.createElement(
243
+ Grid,
244
+ { item: true, xs: 12, md: 4 },
245
+ React.createElement(
246
+ Typography,
247
+ { variant: 'h6', className: classes.contentLabel, style: { paddingTop: 8 } },
248
+ R.prop('maintenanceAgencyID')(labels)
249
+ )
250
+ ),
251
+ React.createElement(
252
+ Grid,
253
+ { item: true, xs: 12, md: 8 },
254
+ React.createElement(Input, {
255
+ variant: 'outlined',
256
+ name: 'title',
257
+ type: 'text',
258
+ fullWidth: true,
259
+ value: maintenanceAgencyIDValue,
260
+ onChange: function onChange(e) {
261
+ return setMaintenanceAgencyIDValue(e.target.value);
262
+ },
263
+ isControlled: true,
264
+ textFieldProps: {
265
+ disabled: R.propOr(false, 'disabled')(maintenanceAgencyID)
266
+ }
267
+ })
268
+ )
269
+ ),
270
+ React.createElement(
271
+ Grid,
272
+ { item: true, container: true, xs: 12, alignItems: 'center' },
273
+ React.createElement(
274
+ Grid,
275
+ { item: true, xs: 12, md: 4 },
276
+ React.createElement(
277
+ Typography,
278
+ { variant: 'h6', className: classes.contentLabel, style: { paddingTop: 8 } },
279
+ R.prop('artefactID')(labels)
280
+ )
281
+ ),
282
+ React.createElement(
283
+ Grid,
284
+ { item: true, xs: 12, md: 8 },
285
+ React.createElement(Input, {
286
+ variant: 'outlined',
287
+ name: 'title',
288
+ type: 'text',
289
+ fullWidth: true,
290
+ value: artefactIDValue,
291
+ onChange: function onChange(e) {
292
+ return setArtefactIDValue(e.target.value);
293
+ },
294
+ isControlled: true,
295
+ textFieldProps: { disabled: R.propOr(false, 'disabled')(artefactID) }
296
+ })
297
+ )
298
+ ),
299
+ React.createElement(
300
+ Grid,
301
+ { item: true, container: true, xs: 12, alignItems: 'center' },
302
+ React.createElement(
303
+ Grid,
304
+ { item: true, xs: 12, md: 4 },
305
+ React.createElement(
306
+ Typography,
307
+ { variant: 'h6', className: classes.contentLabel, style: { paddingTop: 8 } },
308
+ R.prop('artefactVersion')(labels)
309
+ )
310
+ ),
311
+ React.createElement(
312
+ Grid,
313
+ { item: true, xs: 12, md: 8 },
314
+ React.createElement(Input, {
315
+ variant: 'outlined',
316
+ name: 'title',
317
+ type: 'text',
318
+ fullWidth: true,
319
+ value: artefactVersionValue,
320
+ onChange: function onChange(e) {
321
+ return setArtefactVersionValue(e.target.value);
322
+ },
323
+ isControlled: true,
324
+ textFieldProps: {
325
+ disabled: R.propOr(false, 'disabled')(artefactVersion)
326
+ }
327
+ })
328
+ )
329
+ )
330
+ )
331
+ ),
332
+ React.createElement(
333
+ Grid,
334
+ { item: true, container: true },
335
+ React.createElement(PermsissionsTabs, {
336
+ data: evolvedPermissions,
337
+ labels: labels,
338
+ onCheckPermission: onCheckPermission,
339
+ onCheckPermissionGroup: onCheckPermissionGroup
340
+ })
341
+ ),
342
+ React.createElement(
343
+ Grid,
344
+ { item: true, container: true, justifyContent: 'flex-end', alignItems: 'center' },
345
+ React.createElement(
346
+ Grid,
347
+ { item: true },
348
+ React.createElement(
349
+ Button,
350
+ {
351
+ 'aria-label': R.prop('cancel')(labels),
352
+ type: 'submit',
353
+ disabled: false,
354
+ variant: 'contained',
355
+ color: 'default',
356
+ alternative: 'siscc',
357
+ onClick: handleCancel,
358
+ size: 'medium',
359
+ className: classes.submitButton
360
+ },
361
+ R.prop('cancel')(labels)
362
+ )
363
+ ),
364
+ React.createElement(
365
+ Grid,
366
+ { item: true },
367
+ React.createElement(
368
+ Button,
369
+ {
370
+ 'aria-label': R.prop('submit')(labels),
371
+ type: 'submit',
372
+ disabled: !isValidPermissions || !isValidFields || isErrorArtefactType || isErrorDataspace,
373
+ variant: 'contained',
374
+ color: 'primary',
375
+ alternative: 'siscc',
376
+ onClick: handleSubmit,
377
+ size: 'medium',
378
+ className: classes.submitButton
379
+ },
380
+ R.prop('submit')(labels)
381
+ )
382
+ )
383
+ )
384
+ );
385
+ };
386
+ UserRightForm.propTypes = process.env.NODE_ENV !== "production" ? {
387
+ apply: PropTypes.func,
388
+ onCancel: PropTypes.func,
389
+ artefactTypes: PropTypes.arrayOf(PropTypes.shape({
390
+ value: PropTypes.string,
391
+ label: PropTypes.string
392
+ })),
393
+ dataSpaces: PropTypes.arrayOf(PropTypes.shape({
394
+ value: PropTypes.string,
395
+ label: PropTypes.string
396
+ })),
397
+ permissionTabs: PropTypes.object,
398
+ user: PropTypes.shape({
399
+ value: PropTypes.string,
400
+ disabled: PropTypes.bool
401
+ }),
402
+ dataspace: PropTypes.shape({
403
+ value: PropTypes.string,
404
+ disabled: PropTypes.bool
405
+ }),
406
+ artefactType: PropTypes.shape({
407
+ value: PropTypes.string,
408
+ disabled: PropTypes.bool
409
+ }),
410
+ maintenanceAgencyID: PropTypes.shape({
411
+ value: PropTypes.string,
412
+ disabled: PropTypes.bool
413
+ }),
414
+ artefactID: PropTypes.shape({
415
+ value: PropTypes.string,
416
+ disabled: PropTypes.bool
417
+ }),
418
+ artefactVersion: PropTypes.shape({
419
+ value: PropTypes.string,
420
+ disabled: PropTypes.bool
421
+ }),
422
+ labels: PropTypes.shape({
423
+ title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
424
+ user: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
425
+ dataspace: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
426
+ artefactType: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
427
+ maintenanceAgencyID: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
428
+ artefactID: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
429
+ artefactVersion: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
430
+ })
431
+ } : {};
432
+ export default UserRightForm;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * A modified version of the vanilla Material UI button with selected props
3
+ *
4
+ * Permission allows to add or edit permission
5
+ * @memberOf VISIONS
6
+ * @name Permission
7
+ * @tag component
8
+ * @api public
9
+ *
10
+ * Permission.propTypes = {
11
+ * apply: PropTypes.func,
12
+ * onCancel: PropTypes.func,
13
+ * artefactTypes: PropTypes.arrayOf(
14
+ * PropTypes.shape({
15
+ * value: PropTypes.string,
16
+ * label: PropTypes.string,
17
+ * }),
18
+ * ),
19
+ * dataSpaces: PropTypes.arrayOf(
20
+ * PropTypes.shape({
21
+ * value: PropTypes.string,
22
+ * label: PropTypes.string,
23
+ * }),
24
+ * ),
25
+ * permissionTabs: PropTypes.object,
26
+ * user: PropTypes.shape({
27
+ * value: PropTypes.string,
28
+ * disabled: PropTypes.bool,
29
+ * }),
30
+ * dataspace: PropTypes.shape({
31
+ * value: PropTypes.string,
32
+ * disabled: PropTypes.bool,
33
+ * }),
34
+ * artefactType: PropTypes.shape({
35
+ * value: PropTypes.string,
36
+ * disabled: PropTypes.bool,
37
+ * }),
38
+ * maintenanceAgencyID: PropTypes.shape({
39
+ * value: PropTypes.string,
40
+ * disabled: PropTypes.bool,
41
+ * }),
42
+ * artefactID: PropTypes.shape({
43
+ * value: PropTypes.string,
44
+ * disabled: PropTypes.bool,
45
+ * }),
46
+ * artefactVersion: PropTypes.shape({
47
+ * value: PropTypes.string,
48
+ * disabled: PropTypes.bool,
49
+ * }),
50
+ * labels: PropTypes.shape({
51
+ * title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
52
+ * user: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
53
+ * dataspace: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
54
+ * artefactType: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
55
+ * maintenanceAgencyID: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
56
+ * artefactID: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
57
+ * artefactVersion: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
58
+ * }),
59
+ * };
60
+ * @demoReady
61
+ **/
62
+ export { default } from './UserRightForm';
package/es/index.js CHANGED
@@ -39,6 +39,7 @@ export { default as TablePreview } from './TablePreview';
39
39
  export { default as Tag } from './Tag';
40
40
  export { default as ToggleButton } from './ToggleButton';
41
41
  export { default as Tooltip } from './Tooltip';
42
+ export { default as UserRightForm } from './UserRightForm';
42
43
  export { default as VerticalButton } from './VerticalButton';
43
44
  export { default as AuthDialog } from './AuthDialog';
44
45
  export { sisccTheme, innerPalette, T4_BREAKPOINTS } from './theme';
@@ -75,7 +75,6 @@ var ChartsConfig = function ChartsConfig(_ref) {
75
75
  properties = _ref.properties;
76
76
 
77
77
  var classes = (0, _styles.useStyles)();
78
-
79
78
  return _react2.default.createElement(
80
79
  _Grid2.default,
81
80
  { 'data-testid': 'charts-config-test-id', spacing: 2, container: true, className: classes.root },
@@ -88,7 +88,10 @@ var useStyles = exports.useStyles = (0, _styles.makeStyles)(function (theme) {
88
88
  paddingRight: 0
89
89
  }, _ref.select = {
90
90
  padding: theme.spacing(0.5, 4, 0.5, 2),
91
- backgroundColor: theme.palette.common.white
91
+ backgroundColor: theme.palette.common.white,
92
+ '&:focus': {
93
+ backgroundColor: theme.palette.common.white
94
+ }
92
95
  }, _ref.spaceButton = {
93
96
  margin: theme.spacing(0, 1, 0, 0)
94
97
  }, _ref;
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+ exports.MyInput = undefined;
5
+
6
+ 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; };
7
+
8
+ var _react = require('react');
9
+
10
+ var _react2 = _interopRequireDefault(_react);
11
+
12
+ var _propTypes = require('prop-types');
13
+
14
+ var _propTypes2 = _interopRequireDefault(_propTypes);
15
+
16
+ var _ramda = require('ramda');
17
+
18
+ var R = _interopRequireWildcard(_ramda);
19
+
20
+ var _classnames = require('classnames');
21
+
22
+ var _classnames2 = _interopRequireDefault(_classnames);
23
+
24
+ var _styles = require('@material-ui/core/styles');
25
+
26
+ var _TextField = require('@material-ui/core/TextField');
27
+
28
+ var _TextField2 = _interopRequireDefault(_TextField);
29
+
30
+ var _InputAdornment = require('@material-ui/core/InputAdornment');
31
+
32
+ var _InputAdornment2 = _interopRequireDefault(_InputAdornment);
33
+
34
+ var _IconButton = require('@material-ui/core/IconButton');
35
+
36
+ var _IconButton2 = _interopRequireDefault(_IconButton);
37
+
38
+ var _Done = require('@material-ui/icons/Done');
39
+
40
+ var _Done2 = _interopRequireDefault(_Done);
41
+
42
+ var _withInput = require('../Input/with-input');
43
+
44
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
45
+
46
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
+
48
+ var useStyles = (0, _styles.makeStyles)(function () {
49
+ return {
50
+ visibility: {
51
+ visibility: 'hidden'
52
+ }
53
+ };
54
+ });
55
+
56
+ var LefttIcon = function LefttIcon(_ref) {
57
+ var Icon = _ref.Icon;
58
+ return _react2.default.createElement(Icon, null);
59
+ };
60
+
61
+ LefttIcon.propTypes = process.env.NODE_ENV !== "production" ? {
62
+ Icon: _propTypes2.default.object
63
+ } : {};
64
+
65
+ var RightIcon = function RightIcon(_ref2) {
66
+ var onSubmit = _ref2.onSubmit,
67
+ _ref2$Icon = _ref2.Icon,
68
+ Icon = _ref2$Icon === undefined ? _Done2.default : _ref2$Icon;
69
+ return _react2.default.createElement(
70
+ _IconButton2.default,
71
+ { color: 'primary', onClick: function onClick() {
72
+ return onSubmit();
73
+ } },
74
+ _react2.default.createElement(Icon, null)
75
+ );
76
+ };
77
+
78
+ RightIcon.propTypes = process.env.NODE_ENV !== "production" ? {
79
+ Icon: _propTypes2.default.object,
80
+ onSubmit: _propTypes2.default.func,
81
+ classes: _propTypes2.default.object
82
+ } : {};
83
+
84
+ var MyInput = exports.MyInput = function MyInput(_ref3) {
85
+ var _cx;
86
+
87
+ var id = _ref3.id,
88
+ label = _ref3.label,
89
+ name = _ref3.name,
90
+ placeholder = _ref3.placeholder,
91
+ leftIcon = _ref3.leftIcon,
92
+ rightIcon = _ref3.rightIcon,
93
+ value = _ref3.value,
94
+ type = _ref3.type,
95
+ onChange = _ref3.onChange,
96
+ onSubmit = _ref3.onSubmit,
97
+ fullWidth = _ref3.fullWidth,
98
+ withValidationIcon = _ref3.withValidationIcon,
99
+ textFieldProps = _ref3.textFieldProps,
100
+ inputProps = _ref3.inputProps,
101
+ endAdornment = _ref3.endAdornment;
102
+
103
+ var classes = useStyles();
104
+ var startAdornment = R.isNil(leftIcon) ? null : _react2.default.createElement(
105
+ _InputAdornment2.default,
106
+ { position: 'start' },
107
+ _react2.default.createElement(LefttIcon, { Icon: leftIcon })
108
+ );
109
+ var endMyadornment = R.or(withValidationIcon, !R.isNil(rightIcon)) ? _react2.default.createElement(
110
+ _InputAdornment2.default,
111
+ { position: 'end', className: (0, _classnames2.default)((_cx = {}, _cx[classes.visibility] = R.isEmpty(value), _cx)) },
112
+ _react2.default.createElement(RightIcon, { onSubmit: onSubmit, Icon: rightIcon })
113
+ ) : null;
114
+
115
+ var onEnterLabel = function onEnterLabel(event) {
116
+ if (event.key === 'Enter') {
117
+ event.preventDefault();
118
+ if (R.is(Function, onSubmit)) {
119
+ onSubmit();
120
+ }
121
+ }
122
+ };
123
+
124
+ return _react2.default.createElement(_TextField2.default, _extends({
125
+ 'data-testid': 'input-test-id',
126
+ margin: 'dense',
127
+ fullWidth: fullWidth,
128
+ id: id,
129
+ name: name,
130
+ type: type,
131
+ label: label,
132
+ value: value,
133
+ variant: 'outlined',
134
+ placeholder: placeholder,
135
+ onChange: onChange,
136
+ onKeyPress: onEnterLabel,
137
+ InputProps: {
138
+ startAdornment: startAdornment,
139
+ endAdornment: R.isNil(endAdornment) ? endMyadornment : endAdornment
140
+ },
141
+ inputProps: inputProps
142
+ }, textFieldProps));
143
+ };
144
+
145
+ MyInput.propTypes = process.env.NODE_ENV !== "production" ? {
146
+ id: _propTypes2.default.string,
147
+ name: _propTypes2.default.string,
148
+ label: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
149
+ placeholder: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
150
+ leftIcon: _propTypes2.default.object,
151
+ rightIcon: _propTypes2.default.object,
152
+ value: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
153
+ type: _propTypes2.default.string,
154
+ onChange: _propTypes2.default.func,
155
+ onSubmit: _propTypes2.default.func,
156
+ fullWidth: _propTypes2.default.bool,
157
+ withValidationIcon: _propTypes2.default.bool,
158
+ textFieldProps: _propTypes2.default.object,
159
+ inputProps: _propTypes2.default.object,
160
+ endAdornment: _propTypes2.default.node
161
+ } : {};
162
+
163
+ exports.default = (0, _withInput.withInput)(MyInput);