@hipay/hipay-material-ui 2.0.0-beta.54 → 2.0.0-beta.56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/HiBreadcrumb/HiBreadcrumb.js +14 -4
  3. package/HiBreadcrumb/HiStep.js +4 -1
  4. package/HiBreadcrumb/HiStepContent.js +0 -1
  5. package/HiBreadcrumb/HiStepLabel.js +12 -4
  6. package/HiBreadcrumb/HiStepper.js +1 -1
  7. package/HiButton/HiButton.js +7 -1
  8. package/HiCell/CellIcon.js +4 -4
  9. package/HiCell/CellImage.js +28 -4
  10. package/HiCell/CellNumeric.js +1 -2
  11. package/HiCell/CellRate.js +6 -3
  12. package/HiCell/CellSentinel.js +7 -10
  13. package/HiCell/CellSentinelScore.js +4 -4
  14. package/HiCell/CellTextStyled.js +99 -0
  15. package/HiCell/index.js +9 -1
  16. package/HiChip/HiChip.js +1 -0
  17. package/HiDatePicker/Caption.js +8 -9
  18. package/HiDatePicker/HiDateRangePicker.js +37 -19
  19. package/HiDatePicker/HiDateRangeSelector.js +24 -22
  20. package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
  21. package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  22. package/HiDatePicker/Overlays/Overlay.js +15 -8
  23. package/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  24. package/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  25. package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  26. package/HiDatePicker/Overlays/YearPickerOverlay.js +2 -4
  27. package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  28. package/HiDatePicker/stylesheet.js +3 -2
  29. package/HiDotsStepper/HiDot.js +108 -0
  30. package/HiDotsStepper/HiDotsStepper.js +121 -0
  31. package/HiExpansionPanel/HiExpansionPanel.js +1 -1
  32. package/HiForm/HiAddressField.js +176 -0
  33. package/HiForm/HiSlider.js +352 -0
  34. package/HiForm/HiUpload.js +204 -0
  35. package/HiForm/HiUploadField.js +182 -0
  36. package/HiForm/HiUploadInput.js +459 -0
  37. package/HiForm/index.js +16 -0
  38. package/HiMap/HiMap.js +345 -0
  39. package/HiMap/HiMapExpand.js +210 -0
  40. package/HiMap/index.js +23 -0
  41. package/HiNotice/HiKPI.js +238 -0
  42. package/HiNotice/HiKPINotice.js +93 -0
  43. package/HiNotice/index.js +23 -0
  44. package/HiPdfReader/HiPdfReader.js +269 -0
  45. package/HiPdfReader/index.js +15 -0
  46. package/HiRadio/HiRadio.js +74 -0
  47. package/HiRadio/index.js +15 -0
  48. package/HiSelect/HiSelect.js +73 -84
  49. package/HiSelect/HiSuggestSelect.js +32 -5
  50. package/HiSelect/SelectInput.js +5 -0
  51. package/HiSelectNew/HiNestedSelectContent.js +5 -1
  52. package/HiSelectNew/HiSelect.js +174 -137
  53. package/HiSelectNew/HiSelectContent.js +0 -8
  54. package/HiSelectNew/HiSelectInput.js +8 -9
  55. package/HiSelectableList/HiSelectableList.js +32 -4
  56. package/HiSelectableList/HiSelectableListItem.js +62 -24
  57. package/HiTable/HiCellBuilder.js +42 -32
  58. package/HiTable/HiTableHeader.js +28 -21
  59. package/HiTable/constants.js +3 -1
  60. package/README.md +249 -98
  61. package/es/HiBreadcrumb/HiBreadcrumb.js +14 -4
  62. package/es/HiBreadcrumb/HiStep.js +4 -1
  63. package/es/HiBreadcrumb/HiStepContent.js +0 -1
  64. package/es/HiBreadcrumb/HiStepLabel.js +13 -4
  65. package/es/HiBreadcrumb/HiStepper.js +1 -1
  66. package/es/HiButton/HiButton.js +7 -0
  67. package/es/HiCell/CellIcon.js +5 -5
  68. package/es/HiCell/CellImage.js +25 -2
  69. package/es/HiCell/CellNumeric.js +1 -2
  70. package/es/HiCell/CellRate.js +6 -3
  71. package/es/HiCell/CellSentinel.js +7 -10
  72. package/es/HiCell/CellSentinelScore.js +4 -4
  73. package/es/HiCell/CellTextStyled.js +84 -0
  74. package/es/HiCell/index.js +2 -1
  75. package/es/HiChip/HiChip.js +1 -0
  76. package/es/HiDatePicker/Caption.js +7 -9
  77. package/es/HiDatePicker/HiDateRangePicker.js +41 -25
  78. package/es/HiDatePicker/HiDateRangeSelector.js +24 -22
  79. package/es/HiDatePicker/ListPicker.js +1 -1
  80. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
  81. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +2 -2
  82. package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  83. package/es/HiDatePicker/Overlays/Overlay.js +16 -9
  84. package/es/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  85. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  86. package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  87. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +2 -4
  88. package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  89. package/es/HiDatePicker/stylesheet.js +3 -2
  90. package/es/HiDotsStepper/HiDot.js +66 -0
  91. package/es/HiDotsStepper/HiDotsStepper.js +73 -0
  92. package/es/HiExpansionPanel/HiExpansionPanel.js +1 -1
  93. package/es/HiForm/HiAddressField.js +134 -0
  94. package/es/HiForm/HiSlider.js +302 -0
  95. package/es/HiForm/HiUpload.js +158 -0
  96. package/es/HiForm/HiUploadField.js +140 -0
  97. package/es/HiForm/HiUploadInput.js +411 -0
  98. package/es/HiForm/index.js +2 -0
  99. package/es/HiMap/HiMap.js +290 -0
  100. package/es/HiMap/HiMapExpand.js +162 -0
  101. package/es/HiMap/index.js +2 -0
  102. package/es/HiNotice/HiKPI.js +196 -0
  103. package/es/HiNotice/HiKPINotice.js +77 -0
  104. package/es/HiNotice/index.js +2 -0
  105. package/es/HiPdfReader/HiPdfReader.js +214 -0
  106. package/es/HiPdfReader/index.js +1 -0
  107. package/es/HiRadio/HiRadio.js +55 -0
  108. package/es/HiRadio/index.js +1 -0
  109. package/es/HiSelect/HiSelect.js +68 -78
  110. package/es/HiSelect/HiSuggestSelect.js +27 -6
  111. package/es/HiSelect/SelectInput.js +5 -0
  112. package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
  113. package/es/HiSelectNew/HiSelect.js +156 -120
  114. package/es/HiSelectNew/HiSelectContent.js +0 -7
  115. package/es/HiSelectNew/HiSelectInput.js +8 -9
  116. package/es/HiSelectableList/HiSelectableList.js +28 -6
  117. package/es/HiSelectableList/HiSelectableListItem.js +71 -24
  118. package/es/HiTable/HiCellBuilder.js +140 -136
  119. package/es/HiTable/HiTableHeader.js +26 -18
  120. package/es/HiTable/constants.js +1 -0
  121. package/es/index.js +7 -0
  122. package/es/utils/helpers.js +1 -1
  123. package/index.es.js +8 -1
  124. package/index.js +57 -1
  125. package/package.json +6 -3
  126. package/umd/hipay-material-ui.development.js +42114 -35120
  127. package/umd/hipay-material-ui.production.min.js +2 -2
  128. package/utils/helpers.js +1 -1
@@ -0,0 +1,302 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread";
2
+ import React from 'react';
3
+ import withStyles from '../styles/withStyles';
4
+ import HiFormControl from './HiFormControl';
5
+ import PropTypes from 'prop-types';
6
+ import HiIcon from '../HiIcon/HiIcon';
7
+ import classNames from 'classnames';
8
+ export const styles = theme => ({
9
+ barContainer: {
10
+ width: '100%',
11
+ position: 'relative',
12
+ margin: '0 7px'
13
+ },
14
+ barHidden: {
15
+ width: '100%',
16
+ opacity: 0,
17
+ position: 'absolute',
18
+ top: '7px',
19
+ zIndex: '2',
20
+ cursor: 'pointer'
21
+ },
22
+ mainContainer: _objectSpread({}, theme.typography.body1, {
23
+ display: 'flex',
24
+ flexWrap: 'nowrap',
25
+ alignItems: 'center'
26
+ }),
27
+ topContainer: {
28
+ display: 'flex',
29
+ flexWrap: 'nowrap',
30
+ height: '18px'
31
+ },
32
+ bottomContainer: {
33
+ display: 'flex',
34
+ flexWrap: 'nowrap',
35
+ height: '18px'
36
+ },
37
+ barValue: {
38
+ display: 'flex',
39
+ width: '100%',
40
+ height: '4px',
41
+ borderRadius: '2px',
42
+ backgroundColor: theme.palette.primary.main,
43
+ position: 'absolute',
44
+ zIndex: '2'
45
+ },
46
+ arrow: {
47
+ position: 'absolute',
48
+ zIndex: '1',
49
+ transform: 'rotate(-90deg) translate(0%,-50%)',
50
+ transition: 'transform 300ms cubic-bezier(0.4, 0, 0.2, 1)',
51
+ transitionProperty: 'transform color',
52
+ fontSize: 20,
53
+ cursor: 'pointer'
54
+ },
55
+ leftLabel: {
56
+ color: theme.palette.primary.main,
57
+ left: '0px',
58
+ position: 'absolute',
59
+ fontSize: '11px',
60
+ alignSelf: 'flex-end'
61
+ },
62
+ rightLabel: {
63
+ color: '#737373',
64
+ right: '0px',
65
+ position: 'absolute',
66
+ fontSize: '11px',
67
+ alignSelf: 'flex-end'
68
+ },
69
+ textValue: {
70
+ position: 'absolute',
71
+ zIndex: '2'
72
+ },
73
+ trackAfter: {
74
+ backgroundColor: 'gray',
75
+ opacity: 0.24
76
+ },
77
+ focused: {
78
+ fontSize: 24,
79
+ color: theme.palette.primary.dark
80
+ }
81
+ });
82
+ /**
83
+ * HiSlider component
84
+ */
85
+
86
+ class HiSlider extends React.Component {
87
+ constructor(props) {
88
+ super(props);
89
+
90
+ this.handleChange = event => {
91
+ this.props.onChange(parseFloat(event.target.value));
92
+ this.textValueWidth = this.textValue.offsetWidth;
93
+ };
94
+
95
+ this.handleFocus = isFocused => () => {
96
+ this.setState({
97
+ focused: isFocused
98
+ });
99
+ };
100
+
101
+ this.state = {
102
+ focused: false
103
+ };
104
+ }
105
+ /**
106
+ * Measures several components once they are mounted.
107
+ * If the value and a label (left or right) are hovered,
108
+ * we hide this label.
109
+ */
110
+
111
+
112
+ componentDidMount() {
113
+ this.leftLabelWidth = this.leftLabel.offsetWidth;
114
+ this.rightLabelWidth = this.rightLabel.offsetWidth;
115
+ this.textValueWidth = this.textValue.offsetWidth;
116
+ this.barContainerWidth = this.barContainer.offsetWidth;
117
+ const {
118
+ hoveringLeft,
119
+ hoveringRight
120
+ } = this.getHovering();
121
+
122
+ if (hoveringLeft || hoveringRight) {
123
+ this.forceUpdate();
124
+ }
125
+ }
126
+ /**
127
+ * Calculates if the labels are hovered.
128
+ */
129
+
130
+
131
+ getHovering() {
132
+ const ratio = (this.props.value - this.props.min) / (this.props.max - this.props.min);
133
+ const hoveringLeft = this.leftLabelWidth - (ratio * this.barContainerWidth - ratio * this.textValueWidth) > 0;
134
+ const hoveringRight = this.barContainerWidth - ratio * this.barContainerWidth - this.rightLabelWidth - (1 - ratio) * this.textValueWidth < 0;
135
+ return {
136
+ hoveringLeft,
137
+ hoveringRight
138
+ };
139
+ }
140
+
141
+ render() {
142
+ const {
143
+ classes,
144
+ className,
145
+ min,
146
+ max,
147
+ leftLabel,
148
+ rightLabel,
149
+ step,
150
+ suffix,
151
+ id,
152
+ label,
153
+ value,
154
+ theme
155
+ } = this.props;
156
+ const {
157
+ focused
158
+ } = this.state;
159
+ const ratio = (value - min) / (max - min);
160
+ const percentage = ratio * 100;
161
+ const {
162
+ hoveringLeft,
163
+ hoveringRight
164
+ } = this.getHovering();
165
+ const barColor = focused ? theme.palette.primary.dark : theme.palette.primary.main;
166
+ return (// HiFormControl pour l'affichage du label
167
+ React.createElement(HiFormControl, {
168
+ id: id,
169
+ label: label,
170
+ className: className,
171
+ onFocus: this.handleFocus(true),
172
+ onBlur: this.handleFocus(false)
173
+ }, React.createElement("div", {
174
+ className: classes.mainContainer
175
+ }, React.createElement("div", null, min, suffix), React.createElement("div", {
176
+ className: classes.barContainer,
177
+ ref: div => {
178
+ this.barContainer = div;
179
+ }
180
+ }, React.createElement("div", {
181
+ className: classes.topContainer
182
+ }, !hoveringLeft && React.createElement("div", {
183
+ className: classes.leftLabel,
184
+ ref: div => {
185
+ this.leftLabel = div;
186
+ }
187
+ }, leftLabel), React.createElement("div", {
188
+ className: classes.textValue,
189
+ style: {
190
+ left: `${percentage}%`,
191
+ transform: `translate(-${percentage}%)`
192
+ },
193
+ ref: div => {
194
+ this.textValue = div;
195
+ }
196
+ }, value, suffix), !hoveringRight && React.createElement("div", {
197
+ className: classes.rightLabel,
198
+ ref: div => {
199
+ this.rightLabel = div;
200
+ }
201
+ }, rightLabel)), React.createElement("div", {
202
+ className: classes.barValue,
203
+ style: {
204
+ background: `linear-gradient(to right, ${barColor}, ${barColor} ${percentage}%, #E0E0E0 ${percentage}%, #E0E0E0)`
205
+ }
206
+ }), React.createElement("input", {
207
+ type: 'range',
208
+ min: min,
209
+ max: max,
210
+ value: value,
211
+ onChange: this.handleChange,
212
+ className: classes.barHidden,
213
+ step: step
214
+ }), React.createElement("div", {
215
+ className: classes.bottomContainer
216
+ }, React.createElement(HiIcon, {
217
+ className: classNames(classes.arrow, {
218
+ [classes.focused]: focused
219
+ }),
220
+ icon: 'play_arrow',
221
+ style: {
222
+ left: `${percentage}%`,
223
+ color: barColor
224
+ }
225
+ }))), React.createElement("div", null, max, suffix)))
226
+ );
227
+ }
228
+
229
+ }
230
+
231
+ HiSlider.propTypes = process.env.NODE_ENV !== "production" ? {
232
+ /**
233
+ * Useful to extend the style applied to components.
234
+ */
235
+ classes: PropTypes.object,
236
+
237
+ /**
238
+ * Classes CSS appliquées.
239
+ */
240
+ className: PropTypes.string,
241
+
242
+ /**
243
+ * Id de l'élément input
244
+ */
245
+ id: PropTypes.string.isRequired,
246
+
247
+ /**
248
+ * Label du champ
249
+ */
250
+ label: PropTypes.string,
251
+
252
+ /**
253
+ * The label to show on the left.
254
+ */
255
+ leftLabel: PropTypes.string,
256
+
257
+ /**
258
+ * The Maximum value for the slider.
259
+ */
260
+ max: PropTypes.number.isRequired,
261
+
262
+ /**
263
+ * The Minimum value for the slider.
264
+ */
265
+ min: PropTypes.number.isRequired,
266
+
267
+ /**
268
+ * Fonction de callback appelée lorsqu'on change la valeur du slider.
269
+ */
270
+ onChange: PropTypes.func,
271
+
272
+ /**
273
+ * The label to show on the right
274
+ */
275
+ rightLabel: PropTypes.string,
276
+
277
+ /**
278
+ * The step between two selectable values.
279
+ */
280
+ step: PropTypes.number,
281
+
282
+ /**
283
+ * The suffix to show after each number.
284
+ */
285
+ suffix: PropTypes.string,
286
+
287
+ /**
288
+ * @ignore
289
+ */
290
+ theme: PropTypes.object,
291
+
292
+ /**
293
+ * The
294
+ * value of the input.
295
+ */
296
+ value: PropTypes.number
297
+ } : {};
298
+ export default withStyles(styles, {
299
+ hiComponent: true,
300
+ name: 'HiSlider',
301
+ withTheme: true
302
+ })(HiSlider);
@@ -0,0 +1,158 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import classNames from 'classnames';
6
+ import withStyles from '../styles/withStyles';
7
+ import HiUploadInput from './HiUploadInput';
8
+ import HiIcon from '../HiIcon';
9
+ export const styles = theme => ({
10
+ flexContainer: {
11
+ display: ' flex',
12
+ alignItems: 'center'
13
+ },
14
+ statusIcon: {
15
+ height: '80px',
16
+ width: '80px',
17
+ marginRight: '8px',
18
+ padding: '24px',
19
+ borderRadius: '2px',
20
+ backgroundColor: theme.palette.local.background2,
21
+ border: `1px solid ${theme.palette.middle.main}`,
22
+ color: `${theme.palette.middle.main} !important`,
23
+ fontSize: '80px'
24
+ },
25
+ inputContainer: {
26
+ flex: '1'
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
+
43
+ class HiUpload extends React.PureComponent {
44
+ render() {
45
+ const _this$props = this.props,
46
+ {
47
+ inputs,
48
+ classes,
49
+ values
50
+ } = _this$props,
51
+ others = _objectWithoutProperties(_this$props, ["inputs", "classes", "values"]);
52
+
53
+ let complete = true;
54
+ let empty = true;
55
+ let error = false;
56
+
57
+ for (let i = 0, len = values.length; i < len; i += 1) {
58
+ const value = values[i];
59
+
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;
66
+ }
67
+ }
68
+
69
+ const statusClass = classNames(classes.statusIcon, {
70
+ [classes.empty]: empty,
71
+ [classes.complete]: complete,
72
+ [classes.error]: error
73
+ });
74
+ let icon;
75
+
76
+ if (error) {
77
+ icon = 'warning';
78
+ } else if (complete) {
79
+ icon = 'check_circle';
80
+ } else {
81
+ icon = 'file_upload';
82
+ }
83
+
84
+ return React.createElement("div", {
85
+ className: classes.flexContainer
86
+ }, React.createElement(HiIcon, {
87
+ className: statusClass,
88
+ icon: icon,
89
+ size: 32
90
+ }), React.createElement("div", {
91
+ 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)))));
105
+ }
106
+
107
+ }
108
+
109
+ HiUpload.propTypes = process.env.NODE_ENV !== "production" ? {
110
+ /**
111
+ * Useful to extend the style applied to components.
112
+ */
113
+ classes: PropTypes.object,
114
+
115
+ /**
116
+ * Classes CSS appliquées.
117
+ */
118
+ className: PropTypes.string,
119
+
120
+ /**
121
+ * Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
122
+ */
123
+ helperIcon: PropTypes.bool,
124
+
125
+ /**
126
+ * Texte de l'aide
127
+ */
128
+ helperText: PropTypes.string,
129
+
130
+ /**
131
+ * Array containing each of the inputs the component has to show (represented by an object).
132
+ */
133
+ inputs: PropTypes.array.isRequired,
134
+
135
+ /**
136
+ * The method given to change the file.
137
+ */
138
+ onChange: PropTypes.func,
139
+
140
+ /**
141
+ * The method to delete a file.
142
+ */
143
+ onDeleteFile: PropTypes.func,
144
+
145
+ /**
146
+ * The method given to see the file.
147
+ */
148
+ onSeeFile: PropTypes.func,
149
+
150
+ /**
151
+ * Valeurs des inputs
152
+ */
153
+ values: PropTypes.array
154
+ } : {};
155
+ export default withStyles(styles, {
156
+ hiComponent: true,
157
+ name: 'HmuiHiUpload'
158
+ })(HiUpload);
@@ -0,0 +1,140 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import withStyles from '../styles/withStyles';
6
+ import HiFormControl from './HiFormControl';
7
+ 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
+ },
27
+ empty: {
28
+ border: `1px solid ${theme.palette.input.bottomLine}`,
29
+ color: `${theme.palette.neutral.main} !important`
30
+ },
31
+ complete: {
32
+ border: `1px solid ${theme.palette.positive.main}`,
33
+ color: `${theme.palette.positive.main} !important`,
34
+ fontSize: '32px'
35
+ },
36
+ error: {
37
+ border: `1px solid ${theme.palette.negative.main}`,
38
+ color: `${theme.palette.negative.main} !important`
39
+ }
40
+ });
41
+
42
+ class HiUploadField extends React.PureComponent {
43
+ render() {
44
+ const _this$props = this.props,
45
+ {
46
+ className,
47
+ label,
48
+ helperIcon,
49
+ helperText,
50
+ values
51
+ } = _this$props,
52
+ others = _objectWithoutProperties(_this$props, ["className", "label", "helperIcon", "helperText", "values"]);
53
+
54
+ let empty = true;
55
+ let error = false;
56
+ let errorText = '';
57
+
58
+ for (let i = 0, len = values.length; i < len; i += 1) {
59
+ const value = values[i];
60
+
61
+ if (value !== undefined) {
62
+ empty = value.value !== null && !value.error ? false : empty;
63
+ error = value.error || error;
64
+ errorText = errorText || value.errorMessage;
65
+ }
66
+ }
67
+
68
+ return React.createElement(HiFormControl, {
69
+ label: label,
70
+ className: className,
71
+ errorText: errorText,
72
+ error: error,
73
+ helperIcon: helperIcon,
74
+ helperText: helperText
75
+ }, React.createElement(HiUpload, _extends({
76
+ values: values
77
+ }, others)));
78
+ }
79
+
80
+ }
81
+
82
+ HiUploadField.defaultProps = {
83
+ helperText: '',
84
+ helperIcon: false
85
+ };
86
+ HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
87
+ /**
88
+ * Useful to extend the style applied to components.
89
+ */
90
+ classes: PropTypes.object,
91
+
92
+ /**
93
+ * Classes CSS appliquées.
94
+ */
95
+ className: PropTypes.string,
96
+
97
+ /**
98
+ * Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
99
+ */
100
+ helperIcon: PropTypes.bool,
101
+
102
+ /**
103
+ * Texte de l'aide
104
+ */
105
+ helperText: PropTypes.string,
106
+
107
+ /**
108
+ * Array containing each of the inputs the component has to show (represented by an object).
109
+ */
110
+ inputs: PropTypes.array.isRequired,
111
+
112
+ /**
113
+ * The label of the global input.
114
+ */
115
+ label: PropTypes.string,
116
+
117
+ /**
118
+ * The method given to change the file.
119
+ */
120
+ onChange: PropTypes.func,
121
+
122
+ /**
123
+ * The method to delete a file.
124
+ */
125
+ onDeleteFile: PropTypes.func,
126
+
127
+ /**
128
+ * The method given to see the file.
129
+ */
130
+ onSeeFile: PropTypes.func,
131
+
132
+ /**
133
+ * Valeurs des inputs
134
+ */
135
+ values: PropTypes.array
136
+ } : {};
137
+ export default withStyles(styles, {
138
+ hiComponent: true,
139
+ name: 'HmuiHiUploadField'
140
+ })(HiUploadField);