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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/HiCell/CellNumeric.js +1 -1
  3. package/HiDatePicker/HiDatePicker.js +11 -2
  4. package/HiDatePicker/HiDateRangePicker.js +49 -8
  5. package/HiDatePicker/HiDateRangeSelector.js +39 -30
  6. package/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
  7. package/HiForm/HiFormControl.js +26 -11
  8. package/HiForm/HiFormLabel.js +3 -1
  9. package/HiForm/HiInput.js +20 -1
  10. package/HiForm/HiUpload.js +290 -45
  11. package/HiForm/HiUploadField.js +19 -51
  12. package/HiForm/HiUploadInput.js +18 -7
  13. package/HiSelectNew/HiDynamicSelect.js +3 -3
  14. package/HiSelectNew/HiNestedSelect.js +9 -9
  15. package/HiSelectNew/HiNestedSelectContent.js +9 -9
  16. package/HiSelectNew/HiSelect.js +22 -23
  17. package/HiSelectNew/HiSelectContent.js +7 -7
  18. package/HiSelectableList/HiSelectableListItem.js +3 -7
  19. package/README.md +1 -1
  20. package/es/HiCell/CellNumeric.js +1 -1
  21. package/es/HiDatePicker/HiDatePicker.js +11 -2
  22. package/es/HiDatePicker/HiDateRangePicker.js +42 -8
  23. package/es/HiDatePicker/HiDateRangeSelector.js +38 -27
  24. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
  25. package/es/HiForm/HiFormControl.js +27 -11
  26. package/es/HiForm/HiFormLabel.js +3 -1
  27. package/es/HiForm/HiInput.js +19 -1
  28. package/es/HiForm/HiUpload.js +276 -35
  29. package/es/HiForm/HiUploadField.js +19 -43
  30. package/es/HiForm/HiUploadInput.js +16 -7
  31. package/es/HiSelectNew/HiSelect.js +15 -16
  32. package/es/HiSelectableList/HiSelectableListItem.js +3 -7
  33. package/es/utils/helpers.js +6 -5
  34. package/index.es.js +1 -1
  35. package/index.js +1 -1
  36. package/package.json +3 -2
  37. package/umd/hipay-material-ui.development.js +29594 -21713
  38. package/umd/hipay-material-ui.production.min.js +2 -2
  39. package/utils/helpers.js +6 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,61 @@
1
+ # [2.0.0-beta.60](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.60) (2019-01-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
7
+ * **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
8
+ * **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
9
+ * **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
10
+ * **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
11
+ * **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
12
+ * **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
13
+ * **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
14
+ * **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
15
+ * **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
16
+ * **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
17
+ * **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
18
+ * **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
19
+ * **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
20
+ * **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
21
+ * **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
22
+
23
+
24
+ ### Features
25
+
26
+ * **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
27
+ * **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
28
+ * **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
29
+ * **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
30
+ * **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
31
+ * **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
32
+ * **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
33
+ * **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
34
+ * **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
35
+ * **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
36
+ * **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
37
+ * **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
38
+ * **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
39
+ * **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
40
+ * **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
41
+ * **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
42
+
43
+
44
+ ### Performance Improvements
45
+
46
+ * **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
47
+
48
+
49
+ ### BREAKING CHANGES
50
+
51
+ * **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
52
+ * **HiUploadField:** Components names changes
53
+ * **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
54
+ CellImage & CellText)
55
+ * **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
56
+
57
+
58
+
1
59
  <a name="2.0.0-beta.59"></a>
2
60
  # [2.0.0-beta.59](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.59) (2018-12-27)
3
61
 
@@ -63,7 +63,7 @@ function (_React$PureComponent) {
63
63
  var title = '';
64
64
 
65
65
  if (currency) {
66
- displayedValue = (0, _helpers.formatCurrencyAmount)(value, view, locale, currency);
66
+ displayedValue = (0, _helpers.formatCurrencyAmount)(value, view, locale, currency, precision);
67
67
  title = (0, _helpers.formatCurrencyAmount)(value, 'l', locale, currency);
68
68
  } else {
69
69
  displayedValue = (0, _helpers.formatNumber)(value, view, locale, precision);
@@ -232,7 +232,8 @@ function (_React$Component) {
232
232
  value: function renderYearPickerOverlay(propsOverlay) {
233
233
  var yearPickerProps = {
234
234
  value: this.state.currentMonth,
235
- onChange: this.handleCurrentMonthChange
235
+ onChange: this.handleCurrentMonthChange,
236
+ disableFutureDays: this.props.disableFutureDays
236
237
  };
237
238
  return _react.default.createElement(_YearPickerOverlay.default, (0, _extends2.default)({
238
239
  key: 'year-picker-overlay'
@@ -299,7 +300,10 @@ function (_React$Component) {
299
300
  var inputProps = (0, _extends2.default)({}, onReset && {
300
301
  onReset: this.handleReset
301
302
  }, props, {
302
- onChange: this.handleInputChange
303
+ onChange: this.handleInputChange,
304
+ HiInputProps: {
305
+ onSubmit: this.props.onSubmit
306
+ }
303
307
  });
304
308
  return _react.default.createElement("div", {
305
309
  className: classes.root
@@ -397,6 +401,11 @@ HiDatePicker.propTypes = process.env.NODE_ENV !== "production" ? {
397
401
  */
398
402
  onReset: _propTypes.default.func,
399
403
 
404
+ /**
405
+ * Callback lorsque l'utilisateur tape sur "Entrée"
406
+ */
407
+ onSubmit: _propTypes.default.func,
408
+
400
409
  /**
401
410
  * Traductions
402
411
  */
@@ -225,6 +225,36 @@ function (_React$Component) {
225
225
  });
226
226
  };
227
227
 
228
+ _this.handleKeyDown = function (name) {
229
+ return function (event) {
230
+ if (event.key === 'Tab' && !event.shiftKey) {
231
+ var nodeName = document.activeElement.nodeName;
232
+
233
+ if (_this.props[name] && nodeName === 'INPUT' && document.activeElement.nextSibling.children.length > 0) {
234
+ document.activeElement.nextSibling.focus();
235
+ } else if (name === 'from') {
236
+ _this.handleDayPickerBlur('from');
237
+
238
+ _this.handleDayPickerFocus('to');
239
+
240
+ _this.toInput.handleInputFocus();
241
+
242
+ setTimeout(function () {
243
+ document.getElementById("".concat(_this.props.id, "-to")).focus();
244
+ }, 1);
245
+ } else if (name === 'to') {
246
+ _this.handleDayPickerBlur('to');
247
+
248
+ _this.toInput.handleInputBlur(event);
249
+
250
+ setTimeout(function () {
251
+ document.activeElement.blur();
252
+ }, 1);
253
+ }
254
+ }
255
+ };
256
+ };
257
+
228
258
  _this.openPanel = function (panel) {
229
259
  _this.setState({
230
260
  openedPanel: panel
@@ -310,7 +340,7 @@ function (_React$Component) {
310
340
  var yearPickerProps = {
311
341
  value: _this.state.currentMonth,
312
342
  onChange: _this.handleCurrentMonthChange,
313
- disabledFutureDays: _this.props.disableFutureDays
343
+ disableFutureDays: _this.props.disableFutureDays
314
344
  };
315
345
  return _react.default.createElement(_YearPickerOverlay.default, (0, _extends2.default)({
316
346
  key: "".concat(name, "-year-picker-overlay")
@@ -452,7 +482,10 @@ function (_React$Component) {
452
482
  }, {
453
483
  id: "".concat(id, "-from"),
454
484
  onChange: this.handleInputChange('from'),
455
- disabled: disabled
485
+ disabled: disabled,
486
+ HiInputProps: {
487
+ onSubmit: this.props.onSubmit
488
+ }
456
489
  });
457
490
  var toInputProps = (0, _extends2.default)({}, onReset && {
458
491
  onReset: function onReset() {
@@ -465,7 +498,10 @@ function (_React$Component) {
465
498
  }, {
466
499
  id: "".concat(id, "-to"),
467
500
  onChange: this.handleInputChange('to'),
468
- disabled: disabled
501
+ disabled: disabled,
502
+ HiInputProps: {
503
+ onSubmit: this.props.onSubmit
504
+ }
469
505
  });
470
506
  var toClass = (0, _classnames.default)(classes.toInput, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.absolute, staticPosition === true && this.state.focusedInput === 'from'), (0, _defineProperty2.default)(_classNames, classes.right4, staticPosition === true && this.state.focusedInput === 'from'), _classNames));
471
507
 
@@ -475,8 +511,8 @@ function (_React$Component) {
475
511
  className: classes.fromInput,
476
512
  onFocus: function onFocus() {
477
513
  return _this2.handleDayPickerFocus('from');
478
- } // onBlur={() => this.handleDayPickerBlur('from')}
479
-
514
+ },
515
+ onKeyDown: this.handleKeyDown('from')
480
516
  }, _react.default.createElement("div", null, _react.default.createElement(_DayPickerInput.default, {
481
517
  key: this.state.keyFrom,
482
518
  ref: function ref(el) {
@@ -502,7 +538,8 @@ function (_React$Component) {
502
538
  },
503
539
  onBlur: function onBlur() {
504
540
  return _this2.handleDayPickerBlur('to');
505
- }
541
+ },
542
+ onKeyDown: this.handleKeyDown('to')
506
543
  }, _react.default.createElement(_DayPickerInput.default, {
507
544
  key: this.state.keyTo,
508
545
  ref: function ref(el) {
@@ -516,8 +553,7 @@ function (_React$Component) {
516
553
  inputProps: toInputProps,
517
554
  format: enableTime ? "".concat(format, " HH:mm") : format,
518
555
  formatDate: _moment.default.formatDate,
519
- parseDate: _moment.default.parseDate // onDayChange={(day) => this.handleDayChange('to', day)}
520
- ,
556
+ parseDate: _moment.default.parseDate,
521
557
  placeholder: ''
522
558
  })));
523
559
 
@@ -671,6 +707,11 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
671
707
  */
672
708
  onReset: _propTypes.default.func,
673
709
 
710
+ /**
711
+ * Callback lorsque l'utilisateur tape sur "Entrée"
712
+ */
713
+ onSubmit: _propTypes.default.func,
714
+
674
715
  /**
675
716
  * Si true, le calendrier sera dans une div static plutot que dans une popper absolute
676
717
  */
@@ -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 _moment = _interopRequireDefault(require("moment"));
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
- _moment.default.updateLocale('en', {
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, _moment.default)().subtract(15, 'day').startOf('day');
113
- to = (0, _moment.default)().endOf('day');
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, _moment.default)().startOf('day');
120
- to = (0, _moment.default)().endOf('day');
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, _moment.default)().subtract(1, 'day').startOf('day');
127
- to = (0, _moment.default)().subtract(1, 'day').endOf('day');
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, _moment.default)().startOf('week');
134
- to = (0, _moment.default)();
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, _moment.default)().subtract(1, 'week').startOf('week');
141
- to = (0, _moment.default)().subtract(1, 'week').endOf('week');
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, _moment.default)().startOf('month');
148
- to = (0, _moment.default)();
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, _moment.default)().subtract(1, 'month').startOf('month');
155
- to = (0, _moment.default)().subtract(1, 'month').endOf('month');
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, _moment.default)().startOf('quarter');
162
- to = (0, _moment.default)();
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, _moment.default)().subtract(1, 'quarter').startOf('quarter');
169
- to = (0, _moment.default)().subtract(1, 'quarter').endOf('quarter');
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, _moment.default)().startOf('year');
176
- to = (0, _moment.default)();
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
 
@@ -250,9 +248,9 @@ function (_React$Component) {
250
248
  });
251
249
 
252
250
  if (selectedOption) {
253
- _this.props.onChange('from', selectedOption.from.toDate());
251
+ _this.props.onChange('from', new Date(selectedOption.from.format('YYYY-MM-DD HH:mm:ss')));
254
252
 
255
- _this.props.onChange('to', selectedOption.to.toDate());
253
+ _this.props.onChange('to', new Date(selectedOption.to.format('YYYY-MM-DD HH:mm:ss')));
256
254
 
257
255
  _this.props.onChange('fromError', false);
258
256
 
@@ -265,9 +263,8 @@ function (_React$Component) {
265
263
  };
266
264
  };
267
265
 
268
- _this.handleSelectChange = _this.handleSelectChange.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
269
266
  _this.options = props.availableOptionKeys.map(function (key) {
270
- return buildDateRangeOptionByKey(key, props.translations, props.format);
267
+ return buildDateRangeOptionByKey(key, props.translations, props.format, props.timezoneName);
271
268
  });
272
269
  _this.state = {
273
270
  selectedPreset: props.defaultPreset,
@@ -357,7 +354,8 @@ function (_React$Component) {
357
354
  classes: {
358
355
  root: classes.dateSelect
359
356
  },
360
- staticPosition: staticPosition
357
+ staticPosition: staticPosition,
358
+ onSubmit: this.props.onSubmit
361
359
  }, selectProps))), _react.default.createElement(_Grid.default, {
362
360
  item: true,
363
361
  xs: 12,
@@ -411,6 +409,7 @@ HiDateRangeSelector.defaultProps = {
411
409
  format: 'YYYY-DD-MM',
412
410
  minimumDate: new Date(2013, 4, 1),
413
411
  // by default 1 May 2013
412
+ timezoneName: 'Europe/Paris',
414
413
  translations: {
415
414
  today: 'Today',
416
415
  hour: 'Hour',
@@ -529,6 +528,11 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
529
528
  */
530
529
  onChange: _propTypes.default.func.isRequired,
531
530
 
531
+ /**
532
+ * Callback lorsque l'utilisateur tape sur "Entrée"
533
+ */
534
+ onSubmit: _propTypes.default.func,
535
+
532
536
  /**
533
537
  * true si champs obligatoire
534
538
  */
@@ -549,6 +553,11 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
549
553
  */
550
554
  staticPosition: _propTypes.default.bool,
551
555
 
556
+ /**
557
+ * Timezone de l'utilisateur
558
+ */
559
+ timezoneName: _propTypes.default.string,
560
+
552
561
  /**
553
562
  * Date de fin sélectionnée
554
563
  */
@@ -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 = props.minimumDate.getFullYear();
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
  }
@@ -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
- top: '-5px',
67
- height: 24,
68
- width: 24,
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
- right: 13
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)({}, classes.iconButtonInfoActive, helperOpen)),
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)
@@ -45,7 +45,9 @@ var styles = function styles(theme) {
45
45
  },
46
46
  '&$error': {
47
47
  color: theme.palette.negative.main
48
- }
48
+ },
49
+ display: 'flex',
50
+ alignItems: 'center'
49
51
  }),
50
52
  optional: {
51
53
  fontSize: 11,
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.props.onKeyDown,
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
  */