@hipay/hipay-material-ui 2.0.0-beta.58 → 2.0.0-beta.60

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/HiCell/CellNumeric.js +1 -1
  3. package/HiColoredLabel/HiColoredLabel.js +16 -4
  4. package/HiDatePicker/HiDatePicker.js +11 -2
  5. package/HiDatePicker/HiDateRangePicker.js +49 -8
  6. package/HiDatePicker/HiDateRangeSelector.js +39 -30
  7. package/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
  8. package/HiForm/HiFormControl.js +26 -11
  9. package/HiForm/HiFormLabel.js +3 -1
  10. package/HiForm/HiInput.js +33 -1
  11. package/HiForm/HiUpload.js +290 -45
  12. package/HiForm/HiUploadField.js +19 -51
  13. package/HiForm/HiUploadInput.js +18 -7
  14. package/HiSelect/HiSuggestSelect.js +3 -3
  15. package/HiSelectNew/HiDynamicSelect.js +3 -3
  16. package/HiSelectNew/HiNestedSelect.js +29 -15
  17. package/HiSelectNew/HiNestedSelectContent.js +29 -15
  18. package/HiSelectNew/HiSelect.js +23 -12
  19. package/HiSelectNew/HiSelectContent.js +23 -11
  20. package/HiSelectNew/HiSelectInput.js +4 -4
  21. package/HiSelectableList/HiSelectableListItem.js +8 -10
  22. package/README.md +1 -1
  23. package/es/HiCell/CellNumeric.js +1 -1
  24. package/es/HiColoredLabel/HiColoredLabel.js +21 -4
  25. package/es/HiDatePicker/HiDatePicker.js +11 -2
  26. package/es/HiDatePicker/HiDateRangePicker.js +42 -8
  27. package/es/HiDatePicker/HiDateRangeSelector.js +38 -27
  28. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
  29. package/es/HiForm/HiFormControl.js +27 -11
  30. package/es/HiForm/HiFormLabel.js +3 -1
  31. package/es/HiForm/HiInput.js +32 -1
  32. package/es/HiForm/HiUpload.js +276 -35
  33. package/es/HiForm/HiUploadField.js +19 -43
  34. package/es/HiForm/HiUploadInput.js +16 -7
  35. package/es/HiSelect/HiSuggestSelect.js +3 -3
  36. package/es/HiSelectNew/HiNestedSelect.js +17 -7
  37. package/es/HiSelectNew/HiNestedSelectContent.js +16 -6
  38. package/es/HiSelectNew/HiSelect.js +15 -3
  39. package/es/HiSelectNew/HiSelectContent.js +11 -2
  40. package/es/HiSelectNew/HiSelectInput.js +4 -3
  41. package/es/HiSelectableList/HiSelectableListItem.js +8 -10
  42. package/es/utils/helpers.js +6 -5
  43. package/index.es.js +1 -1
  44. package/index.js +1 -1
  45. package/package.json +3 -2
  46. package/umd/hipay-material-ui.development.js +4632 -1923
  47. package/umd/hipay-material-ui.production.min.js +2 -2
  48. package/utils/helpers.js +6 -4
@@ -22,13 +22,11 @@ export const styles = theme => ({
22
22
  marginTop: 2
23
23
  },
24
24
  iconButton: {
25
- position: 'absolute',
26
- right: 5,
27
25
  cursor: 'pointer',
28
26
  zIndex: 1,
29
- top: '-5px',
30
- height: 24,
31
- width: 24,
27
+ height: 20,
28
+ width: 20,
29
+ marginLeft: 3,
32
30
  '&$iconButtonError': {
33
31
  color: theme.palette.negative.main
34
32
  },
@@ -37,11 +35,18 @@ export const styles = theme => ({
37
35
  },
38
36
  '&$iconButtonInfoActive': {
39
37
  color: theme.palette.primary.main
38
+ },
39
+ '&$iconFullWidth': {
40
+ position: 'absolute',
41
+ right: 5,
42
+ marginLeft: 0,
43
+ bottom: 0
40
44
  }
41
45
  },
42
46
  iconButtonError: {},
43
47
  iconButtonInfo: {},
44
48
  iconButtonInfoActive: {},
49
+ iconFullWidth: {},
45
50
  errorDiv: _objectSpread({}, theme.typography.b3, {
46
51
  backgroundColor: theme.palette.negative.main,
47
52
  color: '#FFFFFF',
@@ -60,8 +65,15 @@ export const styles = theme => ({
60
65
  borderTop: '4px solid #000',
61
66
  position: 'absolute',
62
67
  bottom: -4,
63
- right: 13
68
+ '&$arrowNotFullWidth': {
69
+ left: 8
70
+ },
71
+ '&$arrowFullWidth': {
72
+ right: 13
73
+ }
64
74
  },
75
+ arrowNotFullWidth: {},
76
+ arrowFullWidth: {},
65
77
  errorDivArrowDown: {
66
78
  borderTopColor: theme.palette.negative.main
67
79
  },
@@ -81,7 +93,8 @@ export const styles = theme => ({
81
93
  borderTopColor: '#ffffff'
82
94
  },
83
95
  icon: {
84
- position: 'absolute'
96
+ position: 'absolute',
97
+ fontSize: 19
85
98
  }
86
99
  });
87
100
  /**
@@ -176,7 +189,7 @@ class HiFormControl extends React.PureComponent {
176
189
  }, others), error && errorText && helperOpen && React.createElement("div", {
177
190
  className: classes.errorDiv
178
191
  }, React.createElement("div", {
179
- className: classNames(classes.arrowDown, classes.errorDivArrowDown)
192
+ className: classNames(classes.arrowDown, classes.errorDivArrowDown, fullWidth ? [classes.arrowFullWidth] : [classes.arrowNotFullWidth])
180
193
  }), React.createElement("span", {
181
194
  // eslint-disable-next-line react/no-danger
182
195
  dangerouslySetInnerHTML: {
@@ -185,7 +198,7 @@ class HiFormControl extends React.PureComponent {
185
198
  })), helperIcon && helperText && !error && helperOpen && React.createElement("div", {
186
199
  className: classes.helperDiv
187
200
  }, React.createElement("div", {
188
- className: classNames(classes.arrowDown, classes.helperDivArrowDown)
201
+ className: classNames(classes.arrowDown, classes.helperDivArrowDown, fullWidth ? [classes.arrowFullWidth] : [classes.arrowNotFullWidth])
189
202
  }), React.createElement("span", {
190
203
  // eslint-disable-next-line react/no-danger
191
204
  dangerouslySetInnerHTML: {
@@ -198,13 +211,16 @@ class HiFormControl extends React.PureComponent {
198
211
  disabled: disabled,
199
212
  focused: !disabled && (focused || hovered)
200
213
  }, InputLabelProps), error && errorText && React.createElement(HiIconButton, {
201
- className: classNames(classes.iconButton, classes.iconButtonError),
214
+ className: classNames(classes.iconButton, classes.iconButtonError, {
215
+ [classes.iconFullWidth]: fullWidth
216
+ }),
202
217
  onClick: this.handleHelperClick
203
218
  }, React.createElement(Warning, {
204
219
  className: classNames(classes.icon)
205
220
  })), helperIcon && helperText && !error && React.createElement(HiIconButton, {
206
221
  className: classNames(classes.iconButton, classes.iconButtonInfo, {
207
- [classes.iconButtonInfoActive]: helperOpen
222
+ [classes.iconButtonInfoActive]: helperOpen,
223
+ [classes.iconFullWidth]: fullWidth
208
224
  }),
209
225
  onClick: this.handleHelperClick
210
226
  }, React.createElement(Info, {
@@ -19,7 +19,9 @@ export const styles = theme => ({
19
19
  },
20
20
  '&$error': {
21
21
  color: theme.palette.negative.main
22
- }
22
+ },
23
+ display: 'flex',
24
+ alignItems: 'center'
23
25
  }),
24
26
  optional: {
25
27
  fontSize: 11,
@@ -2,6 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
5
+ import keycode from 'keycode/index';
5
6
  import Input from '@material-ui/core/Input';
6
7
  import HiIcon from '../HiIcon';
7
8
  import HiIconButton from '../HiIconButton';
@@ -127,6 +128,25 @@ var _ref = React.createElement(HiIcon, {
127
128
  class HiInput extends React.PureComponent {
128
129
  constructor() {
129
130
  super();
131
+
132
+ this.handleKeyDown = event => {
133
+ const key = keycode(event);
134
+
135
+ if (this.props.onKeyDown) {
136
+ this.props.onKeyDown(event);
137
+ }
138
+
139
+ if (key === 'enter' && this.props.onSubmit) {
140
+ this.props.onSubmit(event);
141
+ }
142
+ };
143
+
144
+ this.handleClick = () => {
145
+ if (this.props.onClick) {
146
+ this.props.onClick();
147
+ }
148
+ };
149
+
130
150
  this.state = {
131
151
  focused: false
132
152
  };
@@ -346,7 +366,8 @@ class HiInput extends React.PureComponent {
346
366
  value: value,
347
367
  placeholder: placeholder,
348
368
  onFocus: this.handleFocus,
349
- onKeyDown: this.props.onKeyDown,
369
+ onKeyDown: this.handleKeyDown,
370
+ onClick: this.handleClick,
350
371
  onBlur: this.handleBlur,
351
372
  inputRef: this.getInputElement,
352
373
  disabled: disabled,
@@ -466,6 +487,11 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
466
487
  */
467
488
  onChange: PropTypes.func,
468
489
 
490
+ /**
491
+ * Fonction de callback appelée au click dans l'input
492
+ */
493
+ onClick: PropTypes.func,
494
+
469
495
  /**
470
496
  * Fonction de callback appelée au focus du champs
471
497
  */
@@ -506,6 +532,11 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
506
532
  */
507
533
  onRightIconClick: PropTypes.func,
508
534
 
535
+ /**
536
+ * Fonction de callback appelée lorsque l'utilisateur tape sur "Entrée"
537
+ */
538
+ onSubmit: PropTypes.func,
539
+
509
540
  /**
510
541
  * Passe une ref callback au composant div parent
511
542
  */
@@ -1,14 +1,15 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classNames from 'classnames';
6
+ import keycode from 'keycode/index';
6
7
  import withStyles from '../styles/withStyles';
7
8
  import HiUploadInput from './HiUploadInput';
8
9
  import HiIcon from '../HiIcon';
9
10
  export const styles = theme => ({
10
11
  flexContainer: {
11
- display: ' flex',
12
+ display: 'flex',
12
13
  alignItems: 'center'
13
14
  },
14
15
  statusIcon: {
@@ -22,8 +23,10 @@ export const styles = theme => ({
22
23
  color: `${theme.palette.middle.main} !important`,
23
24
  fontSize: '80px'
24
25
  },
26
+ dragOver: {},
25
27
  inputContainer: {
26
- flex: '1'
28
+ flex: '1',
29
+ width: 'calc(100% - 88px)'
27
30
  },
28
31
  empty: {
29
32
  border: `1px solid ${theme.palette.input.bottomLine}`,
@@ -37,39 +40,249 @@ export const styles = theme => ({
37
40
  error: {
38
41
  border: `1px solid ${theme.palette.negative.main}`,
39
42
  color: `${theme.palette.negative.main} !important`
40
- }
43
+ },
44
+ fileButton: {
45
+ marginRight: 8,
46
+ '&$focusable': {
47
+ cursor: 'pointer',
48
+ '&:hover, &:focus, &$dragOver': {
49
+ border: `1px solid ${theme.palette.primary.main}`,
50
+ color: `${theme.palette.primary.main} !important`
51
+ }
52
+ }
53
+ },
54
+ focusable: {}
41
55
  });
42
56
 
43
57
  class HiUpload extends React.PureComponent {
58
+ constructor() {
59
+ super();
60
+
61
+ this.handleDrop = event => {
62
+ if (event.path[0].id === this.uploadIconRef.props.id) {
63
+ event.preventDefault();
64
+ event.stopPropagation();
65
+
66
+ if (this.state.droppable) {
67
+ const index = this.getNextInputIndex();
68
+ const param = this.handleFile(event.dataTransfer.files, index);
69
+ this.setState({
70
+ dragOver: false
71
+ });
72
+ this.props.onChange(param, 0);
73
+ } else {
74
+ this.setState({
75
+ dragOver: false
76
+ });
77
+ }
78
+ }
79
+ };
80
+
81
+ this.handleDragEnter = event => {
82
+ event.preventDefault();
83
+ event.stopPropagation();
84
+
85
+ if (event.path[0].id === this.uploadIconRef.props.id) {
86
+ if (event.dataTransfer.items.length !== 1) {
87
+ event.dataTransfer.dropEffect = 'none';
88
+ this.props.onChange({
89
+ errorMessage: this.props.translations.errorDragEnter,
90
+ value: null
91
+ }, 0);
92
+ this.setState({
93
+ dragOver: true
94
+ });
95
+ } else {
96
+ this.setState({
97
+ droppable: true,
98
+ dragOver: true
99
+ });
100
+ }
101
+ }
102
+ };
103
+
104
+ this.handleDragLeave = event => {
105
+ event.preventDefault();
106
+ event.stopPropagation();
107
+
108
+ if (event.path[0].id === this.uploadIconRef.props.id && event.relatedTarget.parentElement !== this.uploadFieldRef) {
109
+ this.props.onChange({
110
+ errorMessage: '',
111
+ value: null
112
+ }, 0);
113
+ this.setState({
114
+ droppable: false,
115
+ dragOver: false
116
+ });
117
+ }
118
+ };
119
+
120
+ this.handleChange = event => {
121
+ const index = this.getNextInputIndex();
122
+ const param = this.handleFile(event.target.files, index);
123
+ this.props.onChange(param, index);
124
+ };
125
+
126
+ this.handleEmptyField = event => {
127
+ event.target.value = '';
128
+ };
129
+
130
+ this.handleKeyPress = event => {
131
+ const key = keycode(event);
132
+
133
+ if (key === 'enter' || key === 'space') {
134
+ event.preventDefault();
135
+ this.uploadInput.click();
136
+ }
137
+ };
138
+
139
+ this.handleFile = (files, index) => {
140
+ let error = false;
141
+ let errorMessage = '';
142
+ let file = null;
143
+
144
+ if (files.length === 1) {
145
+ file = files[0];
146
+
147
+ if (this.props.inputs[index] && file.size > this.props.inputs[index].maxSize) {
148
+ errorMessage += this.props.translations.errorSize.replace('maxSize', this.props.inputs[index].maxSize / 1000000);
149
+ error = true;
150
+ }
151
+
152
+ if (this.props.inputs[index] && this.props.inputs[index].acceptedTypes && this.props.inputs[index].acceptedTypes.length !== 0 && this.props.inputs[index].acceptedTypes.indexOf(file.type) === -1) {
153
+ errorMessage += this.props.translations.errorType;
154
+ error = true;
155
+ }
156
+ } else {
157
+ errorMessage = this.props.translations.errorDropMultiple;
158
+ }
159
+
160
+ return {
161
+ errorMessage,
162
+ error,
163
+ value: file
164
+ };
165
+ };
166
+
167
+ this.createInputs = others => {
168
+ const {
169
+ inputs,
170
+ values
171
+ } = this.props;
172
+ let files = inputs; // unlimited number of files
173
+
174
+ if (inputs.length === 0) {
175
+ files = values;
176
+ }
177
+
178
+ const inputComponents = [];
179
+
180
+ for (let i = 0; i < files.length; i += 1) {
181
+ if (files.length > 1 || values[i] && values[i].value) {
182
+ inputComponents.push(React.createElement(HiUploadInput, _extends({
183
+ maxSize: inputs[i] ? inputs[i].maxSize : undefined,
184
+ acceptedTypes: inputs[i] ? inputs[i].acceptedTypes : undefined,
185
+ placeholder: inputs[i] ? inputs[i].placeholder : undefined,
186
+ value: values[i] ? values[i].value : null,
187
+ error: values[i] ? values[i].error : null,
188
+ errorMessage: values[i] ? values[i].errorMessage : null,
189
+ onSeeFile: this.handleSeeFile,
190
+ onDeleteFile: this.props.onDeleteFile,
191
+ onChange: this.props.onChange,
192
+ index: i,
193
+ key: inputs[i] ? inputs[i].id : `doc-${i}`
194
+ }, others)));
195
+ }
196
+ }
197
+
198
+ return inputComponents;
199
+ };
200
+
201
+ this.uploadFieldRef = void 0;
202
+ this.state = {
203
+ dragOver: false,
204
+ droppable: false
205
+ };
206
+ } // When component mounts, we add eventListeners to handle the file drag and drop
207
+
208
+
209
+ componentDidMount() {
210
+ this.uploadFieldRef.addEventListener('dragenter', this.handleDragEnter, false);
211
+ this.uploadFieldRef.addEventListener('dragleave', this.handleDragLeave, false);
212
+ this.uploadFieldRef.addEventListener('dragover', event => {
213
+ event.preventDefault();
214
+ }, false);
215
+ this.uploadFieldRef.addEventListener('drop', this.handleDrop, false);
216
+ }
217
+
218
+ componentWillUnmount() {
219
+ this.uploadFieldRef.removeEventListener('dragenter', this.handleDragEnter, false);
220
+ this.uploadFieldRef.removeEventListener('dragleave', this.handleDragLeave, false);
221
+ this.uploadFieldRef.removeEventListener('dragover', event => {
222
+ event.preventDefault();
223
+ }, false);
224
+ this.uploadFieldRef.removeEventListener('drop', this.handleDrop, false);
225
+ }
226
+
227
+ getNextInputIndex() {
228
+ let index = 0; // Add an input at the end
229
+
230
+ if (!this.props.inputs.length) {
231
+ index = this.props.values.length + 1;
232
+ } else {
233
+ // First empty input
234
+ for (let i = 0; i < this.props.values.length; i += 1) {
235
+ if (!this.props.values[i] || this.props.values[i].error || !this.props.values[i].value) {
236
+ index = i;
237
+ break;
238
+ }
239
+ }
240
+ }
241
+
242
+ return index;
243
+ } // Action when files are dropped on the field
244
+
245
+
44
246
  render() {
45
247
  const _this$props = this.props,
46
248
  {
249
+ id,
47
250
  inputs,
48
251
  classes,
49
- values
252
+ values,
253
+ focused
50
254
  } = _this$props,
51
- others = _objectWithoutProperties(_this$props, ["inputs", "classes", "values"]);
255
+ others = _objectWithoutProperties(_this$props, ["id", "inputs", "classes", "values", "focused"]);
52
256
 
257
+ const {
258
+ dragOver,
259
+ droppable
260
+ } = this.state;
53
261
  let complete = true;
54
262
  let empty = true;
55
- let error = false;
263
+ let error = false; // For unlimited inputs: always grey
56
264
 
57
- for (let i = 0, len = values.length; i < len; i += 1) {
58
- const value = values[i];
265
+ if (!inputs.length) {
266
+ complete = false;
267
+ } else if (values.length === 0 || inputs.length > 0 && inputs.length !== values.length) {
268
+ complete = false;
269
+ } else {
270
+ for (let i = 0, len = values.length; i < len; i += 1) {
271
+ const value = values[i];
59
272
 
60
- if (value !== undefined) {
61
- complete = value.value === null || value.error ? false : complete;
62
- empty = value.value !== null && !value.error ? false : empty;
63
- error = value.error || error;
64
- } else {
65
- complete = false;
273
+ if (value !== undefined) {
274
+ complete = value.value === null || value.error ? false : complete;
275
+ empty = value.value !== null && !value.error ? false : empty;
276
+ error = value.error || error;
277
+ } else {
278
+ complete = false;
279
+ }
66
280
  }
67
281
  }
68
282
 
69
283
  const statusClass = classNames(classes.statusIcon, {
70
284
  [classes.empty]: empty,
71
- [classes.complete]: complete,
72
- [classes.error]: error
285
+ [classes.complete]: complete
73
286
  });
74
287
  let icon;
75
288
 
@@ -81,27 +294,49 @@ class HiUpload extends React.PureComponent {
81
294
  icon = 'file_upload';
82
295
  }
83
296
 
297
+ let focusable = true;
298
+
299
+ if (complete && values.length > 1) {
300
+ focusable = false;
301
+ }
302
+
303
+ const iconClass = classNames(statusClass, classes.fileButton, {
304
+ [classes.dragOver]: dragOver,
305
+ [classes.droppable]: droppable,
306
+ [classes.focused]: focused,
307
+ [classes.error]: error && !focused,
308
+ [classes.focusable]: focusable
309
+ });
84
310
  return React.createElement("div", {
85
311
  className: classes.flexContainer
86
- }, React.createElement(HiIcon, {
87
- className: statusClass,
312
+ }, React.createElement("label", {
313
+ htmlFor: "flat-button-file",
314
+ ref: label => {
315
+ this.uploadFieldRef = label;
316
+ },
317
+ tabIndex: "-1"
318
+ }, React.createElement("input", {
319
+ hidden: true,
320
+ id: "flat-button-file",
321
+ type: !complete || values.length === 1 ? 'file' : 'hidden',
322
+ onChange: this.handleChange,
323
+ onClick: focusable ? this.handleEmptyField : undefined,
324
+ ref: el => {
325
+ this.uploadInput = el;
326
+ }
327
+ }), React.createElement(HiIcon, {
328
+ ref: uploadIcon => {
329
+ this.uploadIconRef = uploadIcon;
330
+ },
331
+ id: `iconUpload-${id}`,
332
+ className: iconClass,
88
333
  icon: icon,
89
- size: 32
90
- }), React.createElement("div", {
334
+ size: 32,
335
+ tabIndex: focusable ? '0' : '-1',
336
+ onKeyPress: this.handleKeyPress
337
+ })), React.createElement("div", {
91
338
  className: classes.inputContainer
92
- }, inputs.map((item, index) => React.createElement(HiUploadInput, _extends({
93
- maxSize: item.maxSize,
94
- acceptedTypes: item.acceptedTypes,
95
- placeholder: item.placeholder,
96
- value: values[index] ? values[index].value : null,
97
- error: values[index] ? values[index].error : null,
98
- errorMessage: values[index] ? values[index].errorMessage : null,
99
- onSeeFile: this.handleSeeFile,
100
- onDeleteFile: this.props.onDeleteFile,
101
- onChange: this.props.onChange,
102
- index: index,
103
- key: item.id
104
- }, others)))));
339
+ }, this.createInputs(others)));
105
340
  }
106
341
 
107
342
  }
@@ -127,8 +362,14 @@ HiUpload.propTypes = process.env.NODE_ENV !== "production" ? {
127
362
  */
128
363
  helperText: PropTypes.string,
129
364
 
365
+ /**
366
+ * id du composant
367
+ */
368
+ id: PropTypes.string.isRequired,
369
+
130
370
  /**
131
371
  * Array containing each of the inputs the component has to show (represented by an object).
372
+ * If empty => unlimited number of files accepted
132
373
  */
133
374
  inputs: PropTypes.array.isRequired,
134
375
 
@@ -148,7 +389,7 @@ HiUpload.propTypes = process.env.NODE_ENV !== "production" ? {
148
389
  onSeeFile: PropTypes.func,
149
390
 
150
391
  /**
151
- * Valeurs des inputs
392
+ * True if can upload an unlimited number of files
152
393
  */
153
394
  values: PropTypes.array
154
395
  } : {};
@@ -2,43 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import withStyles from '../styles/withStyles';
6
5
  import HiFormControl from './HiFormControl';
7
6
  import HiUpload from './HiUpload';
8
- export const styles = theme => ({
9
- flexContainer: {
10
- display: ' flex',
11
- alignItems: 'center'
12
- },
13
- statusIcon: {
14
- height: '80px',
15
- width: '80px',
16
- marginRight: '8px',
17
- padding: '24px',
18
- borderRadius: '2px',
19
- backgroundColor: theme.palette.local.background2,
20
- border: `1px solid ${theme.palette.middle.main}`,
21
- color: `${theme.palette.middle.main} !important`,
22
- fontSize: '80px'
23
- },
24
- inputContainer: {
25
- flex: '1',
26
- width: 'calc(100% - 88px)'
27
- },
28
- empty: {
29
- border: `1px solid ${theme.palette.input.bottomLine}`,
30
- color: `${theme.palette.neutral.main} !important`
31
- },
32
- complete: {
33
- border: `1px solid ${theme.palette.positive.main}`,
34
- color: `${theme.palette.positive.main} !important`,
35
- fontSize: '32px'
36
- },
37
- error: {
38
- border: `1px solid ${theme.palette.negative.main}`,
39
- color: `${theme.palette.negative.main} !important`
40
- }
41
- });
42
7
 
43
8
  class HiUploadField extends React.PureComponent {
44
9
  render() {
@@ -48,9 +13,10 @@ class HiUploadField extends React.PureComponent {
48
13
  label,
49
14
  helperIcon,
50
15
  helperText,
51
- values
16
+ values,
17
+ fullWidth
52
18
  } = _this$props,
53
- others = _objectWithoutProperties(_this$props, ["className", "label", "helperIcon", "helperText", "values"]);
19
+ others = _objectWithoutProperties(_this$props, ["className", "label", "helperIcon", "helperText", "values", "fullWidth"]);
54
20
 
55
21
  let empty = true;
56
22
  let error = false;
@@ -72,7 +38,8 @@ class HiUploadField extends React.PureComponent {
72
38
  errorText: errorText,
73
39
  error: error,
74
40
  helperIcon: helperIcon,
75
- helperText: helperText
41
+ helperText: helperText,
42
+ fullWidth: fullWidth
76
43
  }, React.createElement(HiUpload, _extends({
77
44
  values: values
78
45
  }, others)));
@@ -82,7 +49,9 @@ class HiUploadField extends React.PureComponent {
82
49
 
83
50
  HiUploadField.defaultProps = {
84
51
  helperText: '',
85
- helperIcon: false
52
+ helperIcon: false,
53
+ seeFile: true,
54
+ fullWidth: false
86
55
  };
87
56
  HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
88
57
  /**
@@ -95,6 +64,11 @@ HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
95
64
  */
96
65
  className: PropTypes.string,
97
66
 
67
+ /**
68
+ * Si "true", applique l'attribut css correspondant
69
+ */
70
+ fullWidth: PropTypes.bool,
71
+
98
72
  /**
99
73
  * Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
100
74
  */
@@ -130,12 +104,14 @@ HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
130
104
  */
131
105
  onSeeFile: PropTypes.func,
132
106
 
107
+ /**
108
+ * set to false to hide the eye button
109
+ */
110
+ seeFile: PropTypes.bool,
111
+
133
112
  /**
134
113
  * Valeurs des inputs
135
114
  */
136
115
  values: PropTypes.array
137
116
  } : {};
138
- export default withStyles(styles, {
139
- hiComponent: true,
140
- name: 'HmuiHiUploadField'
141
- })(HiUploadField);
117
+ export default HiUploadField;