@hipay/hipay-material-ui 2.0.0-beta.59 → 2.0.0-beta.61
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/CHANGELOG.md +118 -0
- package/HiCell/CellNumeric.js +1 -1
- package/HiDatePicker/HiDatePicker.js +48 -14
- package/HiDatePicker/HiDateRangePicker.js +119 -64
- package/HiDatePicker/HiDateRangeSelector.js +70 -47
- package/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
- package/HiDatePicker/stylesheet.js +32 -17
- package/HiForm/HiFormControl.js +26 -11
- package/HiForm/HiFormLabel.js +3 -1
- package/HiForm/HiInput.js +20 -1
- package/HiForm/HiUpload.js +290 -45
- package/HiForm/HiUploadField.js +19 -51
- package/HiForm/HiUploadInput.js +18 -7
- package/HiSelectNew/HiSelect.js +15 -16
- package/HiSelectableList/HiSelectableList.js +9 -0
- package/HiSelectableList/HiSelectableListItem.js +3 -7
- package/README.md +1 -1
- package/es/HiCell/CellNumeric.js +1 -1
- package/es/HiDatePicker/HiDatePicker.js +41 -12
- package/es/HiDatePicker/HiDateRangePicker.js +79 -28
- package/es/HiDatePicker/HiDateRangeSelector.js +59 -37
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
- package/es/HiDatePicker/stylesheet.js +32 -17
- package/es/HiForm/HiFormControl.js +27 -11
- package/es/HiForm/HiFormLabel.js +3 -1
- package/es/HiForm/HiInput.js +19 -1
- package/es/HiForm/HiUpload.js +276 -35
- package/es/HiForm/HiUploadField.js +19 -43
- package/es/HiForm/HiUploadInput.js +16 -7
- package/es/HiSelectNew/HiSelect.js +15 -16
- package/es/HiSelectableList/HiSelectableList.js +9 -0
- package/es/HiSelectableList/HiSelectableListItem.js +3 -7
- package/es/styles/createPalette.js +1 -1
- package/es/utils/helpers.js +15 -6
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
- package/styles/createPalette.js +1 -1
- package/umd/hipay-material-ui.development.js +6301 -383
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/utils/helpers.js +15 -5
|
@@ -27,13 +27,11 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
27
27
|
|
|
28
28
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
29
29
|
|
|
30
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
31
|
-
|
|
32
30
|
var _react = _interopRequireDefault(require("react"));
|
|
33
31
|
|
|
34
32
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
33
|
|
|
36
|
-
var
|
|
34
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
37
35
|
|
|
38
36
|
var _reactDom = require("react-dom");
|
|
39
37
|
|
|
@@ -93,14 +91,14 @@ function yearAndQuarter(format, date, t) {
|
|
|
93
91
|
return indexY < indexM ? date.format("".concat(split[indexY]).concat(s, "[").concat(t.short_quarter, "]Q")) : date.format("[".concat(t.short_quarter, "]Q").concat(s).concat(split[indexY]));
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
function buildDateRangeOptionByKey(key, t, format) {
|
|
94
|
+
function buildDateRangeOptionByKey(key, t, format, timezoneName) {
|
|
97
95
|
var from;
|
|
98
96
|
var label;
|
|
99
97
|
var info;
|
|
100
98
|
var to;
|
|
101
99
|
var type;
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
_momentTimezone.default.updateLocale('en', {
|
|
104
102
|
week: {
|
|
105
103
|
dow: 1
|
|
106
104
|
}
|
|
@@ -109,71 +107,71 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
|
109
107
|
switch (key) {
|
|
110
108
|
case 'custom':
|
|
111
109
|
label = t.custom_period;
|
|
112
|
-
from = (0,
|
|
113
|
-
to = (0,
|
|
110
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(15, 'day').startOf('day');
|
|
111
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).endOf('day');
|
|
114
112
|
type = 'primary-highlight';
|
|
115
113
|
break;
|
|
116
114
|
|
|
117
115
|
case 'cd':
|
|
118
116
|
label = t.today;
|
|
119
|
-
from = (0,
|
|
120
|
-
to = (0,
|
|
117
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('day');
|
|
118
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).endOf('day');
|
|
121
119
|
info = "".concat(from.format(format));
|
|
122
120
|
break;
|
|
123
121
|
|
|
124
122
|
case 'pd':
|
|
125
123
|
label = t.yesterday;
|
|
126
|
-
from = (0,
|
|
127
|
-
to = (0,
|
|
124
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'day').startOf('day');
|
|
125
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'day').endOf('day');
|
|
128
126
|
info = "".concat(from.format(format));
|
|
129
127
|
break;
|
|
130
128
|
|
|
131
129
|
case 'cw':
|
|
132
130
|
label = t.current_week;
|
|
133
|
-
from = (0,
|
|
134
|
-
to = (0,
|
|
131
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('week');
|
|
132
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
|
135
133
|
info = "".concat(t.short_week).concat(from.format('w'), ", \n ").concat(from.format(format), " ").concat(t.to_now);
|
|
136
134
|
break;
|
|
137
135
|
|
|
138
136
|
case 'pw':
|
|
139
137
|
label = t.previous_week;
|
|
140
|
-
from = (0,
|
|
141
|
-
to = (0,
|
|
138
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'week').startOf('week');
|
|
139
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'week').endOf('week');
|
|
142
140
|
info = "".concat(t.short_week).concat(from.format('w'), ", ").concat(from.format(format), " ").concat(t.to, " ").concat(to.format(format));
|
|
143
141
|
break;
|
|
144
142
|
|
|
145
143
|
case 'cm':
|
|
146
144
|
label = t.current_month;
|
|
147
|
-
from = (0,
|
|
148
|
-
to = (0,
|
|
145
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('month');
|
|
146
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
|
149
147
|
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
|
150
148
|
break;
|
|
151
149
|
|
|
152
150
|
case 'pm':
|
|
153
151
|
label = t.previous_month;
|
|
154
|
-
from = (0,
|
|
155
|
-
to = (0,
|
|
152
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'month').startOf('month');
|
|
153
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'month').endOf('month');
|
|
156
154
|
info = "".concat(yearAndMonth(format, from), ", ").concat(from.daysInMonth(), " ").concat(t.days);
|
|
157
155
|
break;
|
|
158
156
|
|
|
159
157
|
case 'cq':
|
|
160
158
|
label = t.current_quarter;
|
|
161
|
-
from = (0,
|
|
162
|
-
to = (0,
|
|
159
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('quarter');
|
|
160
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
|
163
161
|
info = "".concat(yearAndQuarter(format, from, t), ", ").concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
|
164
162
|
break;
|
|
165
163
|
|
|
166
164
|
case 'pq':
|
|
167
165
|
label = t.previous_quarter;
|
|
168
|
-
from = (0,
|
|
169
|
-
to = (0,
|
|
166
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'quarter').startOf('quarter');
|
|
167
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'quarter').endOf('quarter');
|
|
170
168
|
info = "".concat(yearAndQuarter(format, from, t), ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
|
171
169
|
break;
|
|
172
170
|
|
|
173
171
|
case 'cy':
|
|
174
172
|
label = t.current_year;
|
|
175
|
-
from = (0,
|
|
176
|
-
to = (0,
|
|
173
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('year');
|
|
174
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
|
177
175
|
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
|
178
176
|
break;
|
|
179
177
|
|
|
@@ -245,29 +243,12 @@ function (_React$Component) {
|
|
|
245
243
|
return _ref = {}, (0, _defineProperty2.default)(_ref, name, value), (0, _defineProperty2.default)(_ref, "key", prevState.key === 1 ? 2 : 1), _ref;
|
|
246
244
|
});
|
|
247
245
|
|
|
248
|
-
|
|
249
|
-
return option.id === value;
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
if (selectedOption) {
|
|
253
|
-
_this.props.onChange('from', selectedOption.from.toDate());
|
|
254
|
-
|
|
255
|
-
_this.props.onChange('to', selectedOption.to.toDate());
|
|
256
|
-
|
|
257
|
-
_this.props.onChange('fromError', false);
|
|
258
|
-
|
|
259
|
-
_this.props.onChange('toError', false);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (_this.props.returnSelectValue === true) {
|
|
263
|
-
_this.props.onChange('period', value);
|
|
264
|
-
}
|
|
246
|
+
_this.updateDates(value);
|
|
265
247
|
};
|
|
266
248
|
};
|
|
267
249
|
|
|
268
|
-
_this.handleSelectChange = _this.handleSelectChange.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
269
250
|
_this.options = props.availableOptionKeys.map(function (key) {
|
|
270
|
-
return buildDateRangeOptionByKey(key, props.translations, props.format);
|
|
251
|
+
return buildDateRangeOptionByKey(key, props.translations, props.format, props.timezoneName);
|
|
271
252
|
});
|
|
272
253
|
_this.state = {
|
|
273
254
|
selectedPreset: props.defaultPreset,
|
|
@@ -285,15 +266,45 @@ function (_React$Component) {
|
|
|
285
266
|
});
|
|
286
267
|
}
|
|
287
268
|
}
|
|
269
|
+
}, {
|
|
270
|
+
key: "componentDidUpdate",
|
|
271
|
+
value: function componentDidUpdate(prevProps) {
|
|
272
|
+
var _this2 = this;
|
|
273
|
+
|
|
274
|
+
if (prevProps.timezoneName !== this.props.timezoneName) {
|
|
275
|
+
this.options = this.props.availableOptionKeys.map(function (key) {
|
|
276
|
+
return buildDateRangeOptionByKey(key, _this2.props.translations, _this2.props.format, _this2.props.timezoneName);
|
|
277
|
+
});
|
|
278
|
+
this.updateDates(this.state.selectedPreset);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
288
281
|
}, {
|
|
289
282
|
key: "componentWillUnmount",
|
|
290
283
|
value: function componentWillUnmount() {
|
|
291
284
|
clearTimeout(this.timeout); // TODO : supprimer ?
|
|
292
285
|
}
|
|
286
|
+
}, {
|
|
287
|
+
key: "updateDates",
|
|
288
|
+
value: function updateDates(value) {
|
|
289
|
+
var selectedOption = this.options.find(function (option) {
|
|
290
|
+
return option.id === value;
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
if (selectedOption) {
|
|
294
|
+
this.props.onChange('from', new Date(selectedOption.from.format('YYYY-MM-DD HH:mm:ss')));
|
|
295
|
+
this.props.onChange('to', new Date(selectedOption.to.format('YYYY-MM-DD HH:mm:ss')));
|
|
296
|
+
this.props.onChange('fromError', false);
|
|
297
|
+
this.props.onChange('toError', false);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (this.props.returnSelectValue === true) {
|
|
301
|
+
this.props.onChange('period', value);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
293
304
|
}, {
|
|
294
305
|
key: "render",
|
|
295
306
|
value: function render() {
|
|
296
|
-
var
|
|
307
|
+
var _this3 = this;
|
|
297
308
|
|
|
298
309
|
var _this$props = this.props,
|
|
299
310
|
disabled = _this$props.disabled,
|
|
@@ -332,7 +343,7 @@ function (_React$Component) {
|
|
|
332
343
|
spacing: 8,
|
|
333
344
|
className: classes.root,
|
|
334
345
|
ref: function ref(container) {
|
|
335
|
-
|
|
346
|
+
_this3.container = container;
|
|
336
347
|
}
|
|
337
348
|
}, _react.default.createElement(_Grid.default, {
|
|
338
349
|
item: true,
|
|
@@ -357,7 +368,8 @@ function (_React$Component) {
|
|
|
357
368
|
classes: {
|
|
358
369
|
root: classes.dateSelect
|
|
359
370
|
},
|
|
360
|
-
staticPosition: staticPosition
|
|
371
|
+
staticPosition: staticPosition,
|
|
372
|
+
onSubmit: this.props.onSubmit
|
|
361
373
|
}, selectProps))), _react.default.createElement(_Grid.default, {
|
|
362
374
|
item: true,
|
|
363
375
|
xs: 12,
|
|
@@ -411,6 +423,7 @@ HiDateRangeSelector.defaultProps = {
|
|
|
411
423
|
format: 'YYYY-DD-MM',
|
|
412
424
|
minimumDate: new Date(2013, 4, 1),
|
|
413
425
|
// by default 1 May 2013
|
|
426
|
+
timezoneName: 'Europe/Paris',
|
|
414
427
|
translations: {
|
|
415
428
|
today: 'Today',
|
|
416
429
|
hour: 'Hour',
|
|
@@ -529,6 +542,11 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
529
542
|
*/
|
|
530
543
|
onChange: _propTypes.default.func.isRequired,
|
|
531
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Callback lorsque l'utilisateur tape sur "Entrée"
|
|
547
|
+
*/
|
|
548
|
+
onSubmit: _propTypes.default.func,
|
|
549
|
+
|
|
532
550
|
/**
|
|
533
551
|
* true si champs obligatoire
|
|
534
552
|
*/
|
|
@@ -549,6 +567,11 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
549
567
|
*/
|
|
550
568
|
staticPosition: _propTypes.default.bool,
|
|
551
569
|
|
|
570
|
+
/**
|
|
571
|
+
* Timezone de l'utilisateur
|
|
572
|
+
*/
|
|
573
|
+
timezoneName: _propTypes.default.string,
|
|
574
|
+
|
|
552
575
|
/**
|
|
553
576
|
* Date de fin sélectionnée
|
|
554
577
|
*/
|
|
@@ -43,8 +43,15 @@ function (_React$Component) {
|
|
|
43
43
|
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(YearPickerOverlay).call(this, props));
|
|
44
44
|
_this.years = [];
|
|
45
45
|
_this.handleYearClick = _this.handleYearClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
46
|
+
var minDate = props.minimumDate;
|
|
47
|
+
|
|
48
|
+
if (!minDate) {
|
|
49
|
+
var today = new Date();
|
|
50
|
+
minDate = new Date(today.getFullYear() - 5, today.getMonth(), today.getDate()); // by default 5 years from now
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
var currentYear = new Date().getFullYear();
|
|
47
|
-
var minimumYear =
|
|
54
|
+
var minimumYear = minDate.getFullYear();
|
|
48
55
|
_this.years = [currentYear]; // get years from minimum date to now
|
|
49
56
|
|
|
50
57
|
if (!props.disablePastDays && currentYear > minimumYear) {
|
|
@@ -95,8 +102,6 @@ function (_React$Component) {
|
|
|
95
102
|
}(_react.default.Component);
|
|
96
103
|
|
|
97
104
|
YearPickerOverlay.defaultProps = {
|
|
98
|
-
minimumDate: new Date(2013, 4, 1),
|
|
99
|
-
// by default 1 May 2013
|
|
100
105
|
translations: {
|
|
101
106
|
year: 'Year'
|
|
102
107
|
}
|
|
@@ -184,23 +184,22 @@ var _default = function _default(theme) {
|
|
|
184
184
|
|
|
185
185
|
/* default modifiers */
|
|
186
186
|
// Added to the day's cell for the current day
|
|
187
|
-
today: {
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
'
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
187
|
+
today: {// color: theme.palette.primary.light,
|
|
188
|
+
// position: 'relative',
|
|
189
|
+
// borderRadius: '50%',
|
|
190
|
+
// color: `${theme.palette.neutral.dark} !important`,
|
|
191
|
+
// fontWeight: theme.typography.fontWeightMedium,
|
|
192
|
+
// '&:before': {
|
|
193
|
+
// content: '""',
|
|
194
|
+
// position: 'absolute',
|
|
195
|
+
// top: 0,
|
|
196
|
+
// left: 0,
|
|
197
|
+
// display: 'inline-block',
|
|
198
|
+
// width: '100%',
|
|
199
|
+
// height: '100%',
|
|
200
|
+
// borderRadius: '50%',
|
|
201
|
+
// boxShadow: `inset 0 0 0 2px ${theme.palette.neutral.main}`,
|
|
202
|
+
// },
|
|
204
203
|
},
|
|
205
204
|
// Added to the day's cell outside the current month
|
|
206
205
|
outside: {
|
|
@@ -228,6 +227,22 @@ var _default = function _default(theme) {
|
|
|
228
227
|
color: theme.palette.primary.contrastText,
|
|
229
228
|
borderRadius: '0%',
|
|
230
229
|
border: 'none'
|
|
230
|
+
},
|
|
231
|
+
currentDay: {
|
|
232
|
+
position: 'relative',
|
|
233
|
+
color: "".concat(theme.palette.neutral.dark, " !important"),
|
|
234
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
235
|
+
'&:before': {
|
|
236
|
+
content: '""',
|
|
237
|
+
position: 'absolute',
|
|
238
|
+
top: 0,
|
|
239
|
+
left: 0,
|
|
240
|
+
display: 'inline-block',
|
|
241
|
+
width: '100%',
|
|
242
|
+
height: '100%',
|
|
243
|
+
borderRadius: '50%',
|
|
244
|
+
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.neutral.main)
|
|
245
|
+
}
|
|
231
246
|
}
|
|
232
247
|
};
|
|
233
248
|
};
|
package/HiForm/HiFormControl.js
CHANGED
|
@@ -59,13 +59,11 @@ var styles = function styles(theme) {
|
|
|
59
59
|
marginTop: 2
|
|
60
60
|
},
|
|
61
61
|
iconButton: {
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
right: 5,
|
|
64
62
|
cursor: 'pointer',
|
|
65
63
|
zIndex: 1,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
height: 20,
|
|
65
|
+
width: 20,
|
|
66
|
+
marginLeft: 3,
|
|
69
67
|
'&$iconButtonError': {
|
|
70
68
|
color: theme.palette.negative.main
|
|
71
69
|
},
|
|
@@ -74,11 +72,18 @@ var styles = function styles(theme) {
|
|
|
74
72
|
},
|
|
75
73
|
'&$iconButtonInfoActive': {
|
|
76
74
|
color: theme.palette.primary.main
|
|
75
|
+
},
|
|
76
|
+
'&$iconFullWidth': {
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
right: 5,
|
|
79
|
+
marginLeft: 0,
|
|
80
|
+
bottom: 0
|
|
77
81
|
}
|
|
78
82
|
},
|
|
79
83
|
iconButtonError: {},
|
|
80
84
|
iconButtonInfo: {},
|
|
81
85
|
iconButtonInfoActive: {},
|
|
86
|
+
iconFullWidth: {},
|
|
82
87
|
errorDiv: (0, _extends2.default)({}, theme.typography.b3, {
|
|
83
88
|
backgroundColor: theme.palette.negative.main,
|
|
84
89
|
color: '#FFFFFF',
|
|
@@ -97,8 +102,15 @@ var styles = function styles(theme) {
|
|
|
97
102
|
borderTop: '4px solid #000',
|
|
98
103
|
position: 'absolute',
|
|
99
104
|
bottom: -4,
|
|
100
|
-
|
|
105
|
+
'&$arrowNotFullWidth': {
|
|
106
|
+
left: 8
|
|
107
|
+
},
|
|
108
|
+
'&$arrowFullWidth': {
|
|
109
|
+
right: 13
|
|
110
|
+
}
|
|
101
111
|
},
|
|
112
|
+
arrowNotFullWidth: {},
|
|
113
|
+
arrowFullWidth: {},
|
|
102
114
|
errorDivArrowDown: {
|
|
103
115
|
borderTopColor: theme.palette.negative.main
|
|
104
116
|
},
|
|
@@ -118,7 +130,8 @@ var styles = function styles(theme) {
|
|
|
118
130
|
borderTopColor: '#ffffff'
|
|
119
131
|
},
|
|
120
132
|
icon: {
|
|
121
|
-
position: 'absolute'
|
|
133
|
+
position: 'absolute',
|
|
134
|
+
fontSize: 19
|
|
122
135
|
}
|
|
123
136
|
};
|
|
124
137
|
};
|
|
@@ -197,6 +210,8 @@ function (_React$PureComponent) {
|
|
|
197
210
|
(0, _createClass2.default)(HiFormControl, [{
|
|
198
211
|
key: "render",
|
|
199
212
|
value: function render() {
|
|
213
|
+
var _classNames2;
|
|
214
|
+
|
|
200
215
|
var _this$props = this.props,
|
|
201
216
|
children = _this$props.children,
|
|
202
217
|
classes = _this$props.classes,
|
|
@@ -229,7 +244,7 @@ function (_React$PureComponent) {
|
|
|
229
244
|
}, others), error && errorText && helperOpen && _react.default.createElement("div", {
|
|
230
245
|
className: classes.errorDiv
|
|
231
246
|
}, _react.default.createElement("div", {
|
|
232
|
-
className: (0, _classnames.default)(classes.arrowDown, classes.errorDivArrowDown)
|
|
247
|
+
className: (0, _classnames.default)(classes.arrowDown, classes.errorDivArrowDown, fullWidth ? [classes.arrowFullWidth] : [classes.arrowNotFullWidth])
|
|
233
248
|
}), _react.default.createElement("span", {
|
|
234
249
|
// eslint-disable-next-line react/no-danger
|
|
235
250
|
dangerouslySetInnerHTML: {
|
|
@@ -238,7 +253,7 @@ function (_React$PureComponent) {
|
|
|
238
253
|
})), helperIcon && helperText && !error && helperOpen && _react.default.createElement("div", {
|
|
239
254
|
className: classes.helperDiv
|
|
240
255
|
}, _react.default.createElement("div", {
|
|
241
|
-
className: (0, _classnames.default)(classes.arrowDown, classes.helperDivArrowDown)
|
|
256
|
+
className: (0, _classnames.default)(classes.arrowDown, classes.helperDivArrowDown, fullWidth ? [classes.arrowFullWidth] : [classes.arrowNotFullWidth])
|
|
242
257
|
}), _react.default.createElement("span", {
|
|
243
258
|
// eslint-disable-next-line react/no-danger
|
|
244
259
|
dangerouslySetInnerHTML: {
|
|
@@ -251,12 +266,12 @@ function (_React$PureComponent) {
|
|
|
251
266
|
disabled: disabled,
|
|
252
267
|
focused: !disabled && (focused || hovered)
|
|
253
268
|
}, InputLabelProps), error && errorText && _react.default.createElement(_HiIconButton.default, {
|
|
254
|
-
className: (0, _classnames.default)(classes.iconButton, classes.iconButtonError),
|
|
269
|
+
className: (0, _classnames.default)(classes.iconButton, classes.iconButtonError, (0, _defineProperty2.default)({}, classes.iconFullWidth, fullWidth)),
|
|
255
270
|
onClick: this.handleHelperClick
|
|
256
271
|
}, _react.default.createElement(_Warning.default, {
|
|
257
272
|
className: (0, _classnames.default)(classes.icon)
|
|
258
273
|
})), helperIcon && helperText && !error && _react.default.createElement(_HiIconButton.default, {
|
|
259
|
-
className: (0, _classnames.default)(classes.iconButton, classes.iconButtonInfo, (0, _defineProperty2.default)(
|
|
274
|
+
className: (0, _classnames.default)(classes.iconButton, classes.iconButtonInfo, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, classes.iconButtonInfoActive, helperOpen), (0, _defineProperty2.default)(_classNames2, classes.iconFullWidth, fullWidth), _classNames2)),
|
|
260
275
|
onClick: this.handleHelperClick
|
|
261
276
|
}, _react.default.createElement(_Info.default, {
|
|
262
277
|
className: (0, _classnames.default)(classes.icon)
|
package/HiForm/HiFormLabel.js
CHANGED
package/HiForm/HiInput.js
CHANGED
|
@@ -29,6 +29,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
29
29
|
|
|
30
30
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
31
|
|
|
32
|
+
var _index = _interopRequireDefault(require("keycode/index"));
|
|
33
|
+
|
|
32
34
|
var _Input = _interopRequireDefault(require("@material-ui/core/Input"));
|
|
33
35
|
|
|
34
36
|
var _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
|
@@ -170,6 +172,18 @@ function (_React$PureComponent) {
|
|
|
170
172
|
(0, _classCallCheck2.default)(this, HiInput);
|
|
171
173
|
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiInput).call(this));
|
|
172
174
|
|
|
175
|
+
_this.handleKeyDown = function (event) {
|
|
176
|
+
var key = (0, _index.default)(event);
|
|
177
|
+
|
|
178
|
+
if (_this.props.onKeyDown) {
|
|
179
|
+
_this.props.onKeyDown(event);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (key === 'enter' && _this.props.onSubmit) {
|
|
183
|
+
_this.props.onSubmit(event);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
173
187
|
_this.handleClick = function () {
|
|
174
188
|
if (_this.props.onClick) {
|
|
175
189
|
_this.props.onClick();
|
|
@@ -387,7 +401,7 @@ function (_React$PureComponent) {
|
|
|
387
401
|
value: value,
|
|
388
402
|
placeholder: placeholder,
|
|
389
403
|
onFocus: this.handleFocus,
|
|
390
|
-
onKeyDown: this.
|
|
404
|
+
onKeyDown: this.handleKeyDown,
|
|
391
405
|
onClick: this.handleClick,
|
|
392
406
|
onBlur: this.handleBlur,
|
|
393
407
|
inputRef: this.getInputElement,
|
|
@@ -562,6 +576,11 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
562
576
|
*/
|
|
563
577
|
onRightIconClick: _propTypes.default.func,
|
|
564
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Fonction de callback appelée lorsque l'utilisateur tape sur "Entrée"
|
|
581
|
+
*/
|
|
582
|
+
onSubmit: _propTypes.default.func,
|
|
583
|
+
|
|
565
584
|
/**
|
|
566
585
|
* Passe une ref callback au composant div parent
|
|
567
586
|
*/
|