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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/HiAlertModal/HiAlertModal.js +56 -13
  3. package/HiColoredLabel/HiColoredLabel.js +1 -1
  4. package/HiDatePicker/Caption.js +8 -1
  5. package/HiDatePicker/HiDatePicker.js +9 -3
  6. package/HiDatePicker/HiDateRangePicker.js +9 -3
  7. package/HiDatePicker/HiDateRangeSelector.js +54 -4
  8. package/HiDatePicker/NavBar.js +8 -1
  9. package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
  10. package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
  11. package/HiDatePicker/Overlays/YearPickerOverlay.js +2 -2
  12. package/HiDatePicker/hiLocaleUtils.js +144 -0
  13. package/HiDatePicker/stylesheet.js +31 -6
  14. package/HiForm/HiFormControl.js +4 -4
  15. package/HiForm/HiInput.js +19 -7
  16. package/HiForm/HiUploadField.js +2 -1
  17. package/HiNotice/HiKPI.js +3 -3
  18. package/HiNotice/HiKPINotice.js +12 -9
  19. package/HiPin/HiPin.js +1 -1
  20. package/HiSelect/HiSelect.js +6 -5
  21. package/HiSelect/HiSuggestSelect.js +21 -2
  22. package/HiSelect/SelectInput.js +5 -1
  23. package/HiSelectNew/HiSelect.js +163 -59
  24. package/HiSelectNew/HiSelectInput.js +8 -1
  25. package/HiSelectableList/HiSelectableList.js +4 -30
  26. package/HiSelectableList/HiSelectableListItem.js +19 -12
  27. package/README.md +9 -10
  28. package/es/HiAlertModal/HiAlertModal.js +55 -13
  29. package/es/HiColoredLabel/HiColoredLabel.js +1 -1
  30. package/es/HiDatePicker/Caption.js +7 -1
  31. package/es/HiDatePicker/HiDatePicker.js +8 -3
  32. package/es/HiDatePicker/HiDateRangePicker.js +8 -3
  33. package/es/HiDatePicker/HiDateRangeSelector.js +48 -4
  34. package/es/HiDatePicker/NavBar.js +7 -1
  35. package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
  36. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
  37. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +2 -2
  38. package/es/HiDatePicker/hiLocaleUtils.js +131 -0
  39. package/es/HiDatePicker/stylesheet.js +30 -6
  40. package/es/HiForm/HiFormControl.js +4 -4
  41. package/es/HiForm/HiInput.js +19 -7
  42. package/es/HiForm/HiUploadField.js +2 -1
  43. package/es/HiNotice/HiKPI.js +3 -3
  44. package/es/HiNotice/HiKPINotice.js +10 -9
  45. package/es/HiPin/HiPin.js +1 -1
  46. package/es/HiSelect/HiSelect.js +6 -5
  47. package/es/HiSelect/HiSuggestSelect.js +21 -2
  48. package/es/HiSelect/SelectInput.js +5 -1
  49. package/es/HiSelectNew/HiSelect.js +166 -56
  50. package/es/HiSelectNew/HiSelectInput.js +7 -1
  51. package/es/HiSelectableList/HiSelectableList.js +5 -25
  52. package/es/HiSelectableList/HiSelectableListItem.js +23 -16
  53. package/es/index.js +2 -1
  54. package/index.es.js +2 -1
  55. package/index.js +10 -2
  56. package/package.json +1 -1
  57. package/umd/hipay-material-ui.development.js +6207 -1359
  58. package/umd/hipay-material-ui.production.min.js +2 -2
@@ -27,7 +27,7 @@ var _react = _interopRequireDefault(require("react"));
27
27
 
28
28
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
29
 
30
- var _CustomOverlayLayout = _interopRequireDefault(require("./CustomOverlayLayout"));
30
+ var _CustomOverlayLayoutWithoutFooter = _interopRequireDefault(require("./CustomOverlayLayoutWithoutFooter"));
31
31
 
32
32
  var _ListPicker = _interopRequireDefault(require("../ListPicker"));
33
33
 
@@ -43,7 +43,7 @@ function (_React$Component) {
43
43
  _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MonthPickerOverlay).call(this));
44
44
  _this.months = [];
45
45
  _this.handleMonthClick = _this.handleMonthClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
46
- _this.months = props.localeUtils ? props.localeUtils.getMonths() : props.children.props.localeUtils.getMonths();
46
+ _this.months = props.localeUtils ? props.localeUtils.getMonths(props.children.props.locale) : props.children.props.localeUtils.getMonths(props.children.props.locale);
47
47
  return _this;
48
48
  }
49
49
 
@@ -66,8 +66,8 @@ function (_React$Component) {
66
66
  translations = _this$props.translations,
67
67
  props = (0, _objectWithoutProperties2.default)(_this$props, ["value", "translations"]);
68
68
  var now = new Date();
69
- var currentMonth = props.localeUtils ? props.localeUtils.getMonths()[now.getMonth()] : props.children.props.localeUtils.getMonths()[now.getMonth()];
70
- return _react.default.createElement(_CustomOverlayLayout.default, (0, _extends2.default)({
69
+ var currentMonth = props.localeUtils ? props.localeUtils.getMonths(props.children.props.locale)[now.getMonth()] : props.children.props.localeUtils.getMonths(props.children.props.locale)[now.getMonth()];
70
+ return _react.default.createElement(_CustomOverlayLayoutWithoutFooter.default, (0, _extends2.default)({
71
71
  headerElement: translations.month
72
72
  }, props), _react.default.createElement(_ListPicker.default, {
73
73
  itemList: this.months,
@@ -27,7 +27,7 @@ var _react = _interopRequireDefault(require("react"));
27
27
 
28
28
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
29
 
30
- var _CustomOverlayLayout = _interopRequireDefault(require("./CustomOverlayLayout"));
30
+ var _CustomOverlayLayoutWithoutFooter = _interopRequireDefault(require("./CustomOverlayLayoutWithoutFooter"));
31
31
 
32
32
  var _ListPicker = _interopRequireDefault(require("../ListPicker"));
33
33
 
@@ -81,7 +81,7 @@ function (_React$Component) {
81
81
  value = _this$props.value,
82
82
  translations = _this$props.translations,
83
83
  props = (0, _objectWithoutProperties2.default)(_this$props, ["value", "translations"]);
84
- return _react.default.createElement(_CustomOverlayLayout.default, (0, _extends2.default)({
84
+ return _react.default.createElement(_CustomOverlayLayoutWithoutFooter.default, (0, _extends2.default)({
85
85
  headerElement: translations.year
86
86
  }, props), _react.default.createElement(_ListPicker.default, {
87
87
  itemList: this.years,
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var WEEKDAYS_LONG = {
8
+ en_US: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
9
+ fr_FR: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi']
10
+ };
11
+ var WEEKDAYS_SHORT = {
12
+ en_US: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
13
+ fr_FR: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa']
14
+ };
15
+ var MONTHS = {
16
+ en_US: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
17
+ fr_FR: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre']
18
+ };
19
+ var FIRST_DAY = {
20
+ en_US: 0,
21
+ fr_FR: 1 // Use Monday as first day of the week
22
+
23
+ };
24
+ /**
25
+ * Format Date as day
26
+ *
27
+ * @param Date d
28
+ * @param string locale
29
+ *
30
+ * @returns string
31
+ */
32
+
33
+ function formatDay(d) {
34
+ var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en_US';
35
+ var loc = this.formatLocale(locale);
36
+ return "".concat(WEEKDAYS_LONG[loc][d.getDay()], ", ").concat(d.getDate(), " ").concat(MONTHS[loc][d.getMonth()], " ").concat(d.getFullYear());
37
+ }
38
+ /**
39
+ * Format Date as month title
40
+ *
41
+ * @param Date d
42
+ * @param string locale
43
+ *
44
+ * @returns string
45
+ */
46
+
47
+
48
+ function formatMonthTitle(d) {
49
+ var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en_US';
50
+ var loc = this.formatLocale(locale);
51
+ return "".concat(MONTHS[loc][d.getMonth()], " ").concat(d.getFullYear());
52
+ }
53
+ /**
54
+ * Get the short version of a week day
55
+ *
56
+ * @param int i
57
+ * @param string locale
58
+ *
59
+ * @returns string
60
+ */
61
+
62
+
63
+ function formatWeekdayShort(i) {
64
+ var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en_US';
65
+ var loc = this.formatLocale(locale);
66
+ return WEEKDAYS_SHORT[loc][i];
67
+ }
68
+ /**
69
+ * Get the long version of a week day
70
+ *
71
+ * @param int i
72
+ * @param string locale
73
+ *
74
+ * @returns string
75
+ */
76
+
77
+
78
+ function formatWeekdayLong(i) {
79
+ var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en_US';
80
+ var loc = this.formatLocale(locale);
81
+ return WEEKDAYS_LONG[loc][i];
82
+ }
83
+ /**
84
+ * Get first day of the week
85
+ * @param string locale
86
+ *
87
+ * @returns integer
88
+ */
89
+
90
+
91
+ function getFirstDayOfWeek() {
92
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en_US';
93
+ var loc = this.formatLocale(locale);
94
+ return FIRST_DAY[loc];
95
+ }
96
+ /**
97
+ * Get List of Months
98
+ *
99
+ * @param string locale
100
+ *
101
+ * @returns array
102
+ */
103
+
104
+
105
+ function getMonths() {
106
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en_US';
107
+ var loc = this.formatLocale(locale);
108
+ return MONTHS[loc];
109
+ }
110
+ /**
111
+ * Format locale
112
+ *
113
+ * @param string locale
114
+ *
115
+ * @return string
116
+ */
117
+
118
+
119
+ function formatLocale(locale) {
120
+ var loc = locale.split('-');
121
+
122
+ if (loc.length !== 2) {
123
+ loc = locale.split('_');
124
+
125
+ if (loc.length !== 2) {
126
+ return false;
127
+ }
128
+ }
129
+
130
+ loc[1] = loc[1].toUpperCase();
131
+ return loc.join('_');
132
+ }
133
+
134
+ var HiLocaleUtils = {
135
+ formatDay: formatDay,
136
+ formatMonthTitle: formatMonthTitle,
137
+ formatWeekdayShort: formatWeekdayShort,
138
+ formatWeekdayLong: formatWeekdayLong,
139
+ getFirstDayOfWeek: getFirstDayOfWeek,
140
+ getMonths: getMonths,
141
+ formatLocale: formatLocale
142
+ };
143
+ var _default = HiLocaleUtils;
144
+ exports.default = _default;
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
+ var _colorManipulator = require("../styles/colorManipulator");
13
+
12
14
  var _default = function _default(theme) {
13
15
  return {
14
16
  root: {
@@ -151,31 +153,54 @@ var _default = function _default(theme) {
151
153
  footer: {
152
154
  marginTop: 12,
153
155
  borderTop: '1px solid',
154
- borderTopColor: theme.palette.divider
156
+ borderTopColor: theme.palette.divider,
157
+ padding: '5px',
158
+ width: '100%'
155
159
  },
156
160
  // The today button (only with todayButton prop)
157
161
  todayButton: (0, _extends2.default)({
158
- width: '100%',
162
+ display: 'table',
163
+ minWidth: 230,
164
+ margin: '0 auto',
159
165
  border: 'none',
160
166
  backgroundImage: 'none',
161
167
  backgroundColor: 'transparent',
162
168
  boxShadow: 'none',
163
169
  cursor: 'pointer',
164
- height: 40
170
+ height: 30
165
171
  }, theme.typography.body2, {
166
172
  color: theme.palette.neutral.main,
167
173
  fontWeight: theme.typography.fontWeightMedium,
168
- textTransform: 'uppercase'
174
+ textTransform: 'uppercase',
175
+ '&:hover': {
176
+ backgroundColor: (0, _colorManipulator.fade)(theme.palette.neutral.dark, theme.palette.action.hoverOpacity),
177
+ // Reset on touch devices, it doesn't add specificity
178
+ '@media (hover: none)': {
179
+ backgroundColor: 'transparent'
180
+ }
181
+ },
182
+ borderRadius: 4
169
183
  }),
170
184
 
171
185
  /* default modifiers */
172
186
  // Added to the day's cell for the current day
173
187
  today: {
174
188
  // color: theme.palette.primary.light,
175
- boxShadow: 'inset 0 0 0 2px #8b9898',
189
+ position: 'relative',
176
190
  borderRadius: '50%',
177
191
  color: "".concat(theme.palette.neutral.dark, " !important"),
178
- fontWeight: theme.typography.fontWeightMedium
192
+ fontWeight: theme.typography.fontWeightMedium,
193
+ '&:before': {
194
+ content: '""',
195
+ position: 'absolute',
196
+ top: 0,
197
+ left: 0,
198
+ display: 'inline-block',
199
+ width: '100%',
200
+ height: '100%',
201
+ borderRadius: '50%',
202
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.neutral.main)
203
+ }
179
204
  },
180
205
  // Added to the day's cell outside the current month
181
206
  outside: {
@@ -64,6 +64,8 @@ var styles = function styles(theme) {
64
64
  cursor: 'pointer',
65
65
  zIndex: 1,
66
66
  top: '-5px',
67
+ height: 24,
68
+ width: 24,
67
69
  '&$iconButtonError': {
68
70
  color: theme.palette.negative.main
69
71
  },
@@ -250,14 +252,12 @@ function (_React$PureComponent) {
250
252
  focused: !disabled && (focused || hovered)
251
253
  }, InputLabelProps), error && errorText && _react.default.createElement(_HiIconButton.default, {
252
254
  className: (0, _classnames.default)(classes.iconButton, classes.iconButtonError),
253
- onClick: this.handleHelperClick,
254
- onKeyDown: this.handleKeyDown
255
+ onClick: this.handleHelperClick
255
256
  }, _react.default.createElement(_Warning.default, {
256
257
  className: (0, _classnames.default)(classes.icon)
257
258
  })), helperIcon && helperText && !error && _react.default.createElement(_HiIconButton.default, {
258
259
  className: (0, _classnames.default)(classes.iconButton, classes.iconButtonInfo, (0, _defineProperty2.default)({}, classes.iconButtonInfoActive, helperOpen)),
259
- onClick: this.handleHelperClick,
260
- onKeyDown: this.handleKeyDown
260
+ onClick: this.handleHelperClick
261
261
  }, _react.default.createElement(_Info.default, {
262
262
  className: (0, _classnames.default)(classes.icon)
263
263
  }))), _react.default.createElement("div", {
package/HiForm/HiInput.js CHANGED
@@ -121,10 +121,10 @@ var styles = function styles(theme) {
121
121
  padding: 0
122
122
  }),
123
123
  inputText: {
124
- height: 39
124
+ height: 40
125
125
  },
126
126
  inputTextArea: {
127
- minHeight: 39,
127
+ minHeight: 40,
128
128
  paddingTop: 8
129
129
  },
130
130
  iconPointer: {
@@ -132,7 +132,7 @@ var styles = function styles(theme) {
132
132
  cursor: 'pointer'
133
133
  },
134
134
  eraseButton: {
135
- height: 39,
135
+ height: 40,
136
136
  width: 40,
137
137
  display: 'inline-block'
138
138
  },
@@ -215,10 +215,15 @@ function (_React$PureComponent) {
215
215
  // Si on click sur un élément de HiInput, on garde le focus
216
216
  // Par exemple sur l'icone reset
217
217
  if (event.relatedTarget && this.overlayNode && this.overlayNode.contains(event.relatedTarget)) {
218
- if (this.endAdornmentNode.contains(event.relatedTarget) && this.props.onBlur) {
218
+ // If blur came from erase icon => stay focused and don't call onBlur props
219
+ if (this.eraseIconNode && this.eraseIconNode.contains(event.relatedTarget)) {
220
+ event.preventDefault();
221
+ event.stopPropagation();
222
+ } else if (this.endAdornmentNode.contains(event.relatedTarget) && this.props.onBlur) {
219
223
  this.props.onBlur(event);
220
224
  }
221
225
 
226
+ event.preventDefault();
222
227
  event.stopPropagation();
223
228
  } else {
224
229
  this.setState({
@@ -240,9 +245,13 @@ function (_React$PureComponent) {
240
245
  this.setState({
241
246
  focused: true
242
247
  });
243
- }
248
+ } // If focus came from erase icon => stay focused and don't call onFocus props
249
+
244
250
 
245
- if (this.props.onFocus) {
251
+ if (this.eraseIconNode && this.eraseIconNode.contains(event.relatedTarget)) {
252
+ event.preventDefault();
253
+ event.stopPropagation();
254
+ } else if (this.props.onFocus) {
246
255
  this.props.onFocus(event);
247
256
  }
248
257
  }
@@ -342,7 +351,10 @@ function (_React$PureComponent) {
342
351
  label: classes.eraseButtonLabel
343
352
  },
344
353
  onClick: this.handleReset,
345
- onBlur: this.handleBlur
354
+ onBlur: this.handleBlur,
355
+ buttonRef: function buttonRef(el) {
356
+ _this2.eraseIconNode = el;
357
+ }
346
358
  }, _ref);
347
359
 
348
360
  var endAdornment = endAdornmentProps;
@@ -49,7 +49,8 @@ var styles = function styles(theme) {
49
49
  fontSize: '80px'
50
50
  },
51
51
  inputContainer: {
52
- flex: '1'
52
+ flex: '1',
53
+ width: 'calc(100% - 88px)'
53
54
  },
54
55
  empty: {
55
56
  border: "1px solid ".concat(theme.palette.input.bottomLine),
package/HiNotice/HiKPI.js CHANGED
@@ -175,7 +175,7 @@ HiKPI.propTypes = process.env.NODE_ENV !== "production" ? {
175
175
  active: _propTypes.default.bool,
176
176
 
177
177
  /**
178
- * KPI id
178
+ * Corps du KPI
179
179
  */
180
180
  body: _propTypes.default.any.isRequired,
181
181
 
@@ -200,9 +200,9 @@ HiKPI.propTypes = process.env.NODE_ENV !== "production" ? {
200
200
  disable: _propTypes.default.bool,
201
201
 
202
202
  /**
203
- * Corps du KPI
203
+ * KPI id
204
204
  */
205
- id: _propTypes.default.number.isRequired,
205
+ id: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
206
206
 
207
207
  /**
208
208
  * Corps minifié du KPI si nécessaire
@@ -30,15 +30,16 @@ var styles = function styles() {
30
30
  var HiKPINotice = function HiKPINotice(_ref) {
31
31
  var classes = _ref.classes,
32
32
  kpis = _ref.kpis,
33
- activeKpis = _ref.activeKpis,
33
+ activeKpi = _ref.activeKpi,
34
34
  minify = _ref.minify,
35
35
  onClickOnKPI = _ref.onClickOnKPI;
36
36
  return _react.default.createElement("div", {
37
37
  className: classes.container
38
- }, kpis.map(function (kpi) {
38
+ }, Object.keys(kpis).map(function (key) {
39
+ var kpi = kpis[key];
39
40
  return _react.default.createElement(_HiKPI.default, {
40
- key: kpi.id,
41
- id: kpi.id,
41
+ key: key,
42
+ id: key,
42
43
  type: kpi.type,
43
44
  color: kpi.color,
44
45
  title: kpi.title,
@@ -46,8 +47,10 @@ var HiKPINotice = function HiKPINotice(_ref) {
46
47
  bodyMinify: kpi.bodyMinify,
47
48
  subtitle: kpi.subtitle,
48
49
  tooltip: kpi.tooltip,
49
- onClick: onClickOnKPI,
50
- active: !!activeKpis.includes(kpi.id),
50
+ onClick: function onClick() {
51
+ return onClickOnKPI(key);
52
+ },
53
+ active: activeKpi === key,
51
54
  minify: minify,
52
55
  disable: kpi.disable
53
56
  });
@@ -58,7 +61,7 @@ HiKPINotice.propTypes = process.env.NODE_ENV !== "production" ? {
58
61
  /**
59
62
  * Extension du style appliqué au composant
60
63
  */
61
- activeKpis: _propTypes.default.array,
64
+ activeKpi: _propTypes.default.string,
62
65
 
63
66
  /**
64
67
  * Liste des KPIs
@@ -68,7 +71,7 @@ HiKPINotice.propTypes = process.env.NODE_ENV !== "production" ? {
68
71
  /**
69
72
  * Fonction appelée au clic sur un KPI
70
73
  */
71
- kpis: _propTypes.default.array.isRequired,
74
+ kpis: _propTypes.default.object.isRequired,
72
75
 
73
76
  /**
74
77
  * Liste des KPIS actifs
@@ -81,7 +84,7 @@ HiKPINotice.propTypes = process.env.NODE_ENV !== "production" ? {
81
84
  onClickOnKPI: _propTypes.default.func
82
85
  } : {};
83
86
  HiKPINotice.defaultProps = {
84
- activeKpis: [],
87
+ activeKpi: null,
85
88
  minify: false
86
89
  };
87
90
 
package/HiPin/HiPin.js CHANGED
@@ -23,7 +23,7 @@ var styles = function styles(theme) {
23
23
  return {
24
24
  root: {
25
25
  display: 'inline-block',
26
- padding: '0 9px',
26
+ padding: '1px 9px',
27
27
  height: 16,
28
28
  lineHeight: '16px',
29
29
  minWidth: 25,
@@ -249,17 +249,13 @@ function (_React$PureComponent) {
249
249
  nextItem = (0, _helpers.getNextItemSelectable)(document.activeElement, 'down');
250
250
  } else if (event.key === 'ArrowUp') {
251
251
  nextItem = (0, _helpers.getNextItemSelectable)(document.activeElement, 'up');
252
- } else if (event.key === 'Tab') {
252
+ } else if (event.key === 'Tab' || event.key === 'Escape') {
253
253
  /* if (!this.props.staticPosition) {
254
254
  document.body.style.overflow = 'auto';
255
255
  } */
256
256
  _this.setState({
257
257
  open: false
258
258
  });
259
- } else if (event.key === 'Escape') {
260
- _this.setState({
261
- open: false
262
- });
263
259
  }
264
260
 
265
261
  if (nextItem) {
@@ -272,6 +268,10 @@ function (_React$PureComponent) {
272
268
  _this.focusOnSelectedItem();
273
269
  } else if (event.key === 'Enter' && _this.props.onSubmit) {
274
270
  _this.props.onSubmit(event);
271
+ } else if (event.key === 'Tab' || event.key === 'Escape') {
272
+ _this.setState({
273
+ open: false
274
+ });
275
275
  }
276
276
  };
277
277
 
@@ -750,6 +750,7 @@ function (_React$PureComponent) {
750
750
  onClick: this.handleClick,
751
751
  onFocus: this.handleFocus,
752
752
  onBlur: this.handleBlur,
753
+ onKeyDown: this.handleKeyDown,
753
754
  onMouseEnter: this.props.onMouseEnter,
754
755
  onMouseLeave: this.props.onMouseLeave,
755
756
  refElement: function refElement(el) {
@@ -62,7 +62,8 @@ var styles = function styles(theme) {
62
62
  width: '100% !important',
63
63
  transform: 'none !important',
64
64
  zIndex: '9 !important',
65
- top: '100% !important'
65
+ top: '100% !important',
66
+ textOverflow: 'ellipsis'
66
67
  },
67
68
  paper: {
68
69
  borderRadius: '0px 2px',
@@ -185,10 +186,14 @@ function (_React$PureComponent) {
185
186
  }
186
187
  }, {
187
188
  key: "handleFocus",
188
- value: function handleFocus() {
189
+ value: function handleFocus(event) {
189
190
  this.setState({
190
191
  focused: true
191
192
  });
193
+
194
+ if (this.props.onFocusInput) {
195
+ this.props.onFocusInput(event);
196
+ }
192
197
  }
193
198
  }, {
194
199
  key: "handleBlur",
@@ -201,6 +206,10 @@ function (_React$PureComponent) {
201
206
  focused: false
202
207
  });
203
208
  }
209
+
210
+ if (this.props.onBlurInput) {
211
+ this.props.onBlurInput(event);
212
+ }
204
213
  }
205
214
  }, {
206
215
  key: "render",
@@ -320,6 +329,16 @@ HiSuggestSelect.propTypes = process.env.NODE_ENV !== "production" ? {
320
329
  */
321
330
  loading: _propTypes.default.bool,
322
331
 
332
+ /**
333
+ * Fonction de callback appelée lorsqu'on blur le champ de recherche
334
+ */
335
+ onBlurInput: _propTypes.default.func,
336
+
337
+ /**
338
+ * Fonction de callback appelée lorsqu'on focus le champs de recherche
339
+ */
340
+ onFocusInput: _propTypes.default.func,
341
+
323
342
  /**
324
343
  * Fonction de callback appelée lorsqu'on écrit dans le champ
325
344
  */
@@ -45,7 +45,10 @@ var styles = function styles(theme) {
45
45
  maxWidth: 500,
46
46
  display: 'flex',
47
47
  justifyContent: 'center',
48
- padding: 8,
48
+ paddingTop: 7,
49
+ paddingBottom: 9,
50
+ paddingRight: 8,
51
+ paddingLeft: 8,
49
52
  cursor: 'pointer'
50
53
  },
51
54
  underline: {
@@ -226,6 +229,7 @@ function (_React$PureComponent) {
226
229
  className: iconClass,
227
230
  icon: "arrow_drop_down"
228
231
  })) : _react.default.createElement(_ButtonBase.default, {
232
+ component: "div",
229
233
  id: id,
230
234
  classes: {
231
235
  root: rootClass