@hipay/hipay-material-ui 2.0.0-beta.55 → 2.0.0-beta.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. package/CHANGELOG.md +116 -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 +13 -1
  10. package/HiCell/CellRate.js +6 -3
  11. package/HiCell/CellSentinel.js +7 -10
  12. package/HiCell/CellTextStyled.js +29 -1
  13. package/HiColoredLabel/HiColoredLabel.js +1 -1
  14. package/HiDatePicker/Caption.js +16 -10
  15. package/HiDatePicker/HiDatePicker.js +9 -3
  16. package/HiDatePicker/HiDateRangePicker.js +36 -22
  17. package/HiDatePicker/HiDateRangeSelector.js +75 -21
  18. package/HiDatePicker/NavBar.js +8 -1
  19. package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
  20. package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
  21. package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
  22. package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  23. package/HiDatePicker/Overlays/Overlay.js +15 -8
  24. package/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  25. package/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  26. package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  27. package/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
  28. package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  29. package/HiDatePicker/hiLocaleUtils.js +144 -0
  30. package/HiDatePicker/stylesheet.js +33 -7
  31. package/HiDotsStepper/HiDot.js +108 -0
  32. package/HiDotsStepper/HiDotsStepper.js +121 -0
  33. package/HiExpansionPanel/HiExpansionPanel.js +1 -1
  34. package/HiForm/HiAddressField.js +176 -0
  35. package/HiForm/HiFormControl.js +2 -0
  36. package/HiForm/HiInput.js +3 -3
  37. package/HiForm/HiSlider.js +352 -0
  38. package/HiForm/HiUpload.js +204 -0
  39. package/HiForm/HiUploadField.js +182 -0
  40. package/HiForm/HiUploadInput.js +459 -0
  41. package/HiForm/index.js +16 -0
  42. package/HiMap/HiMap.js +345 -0
  43. package/HiMap/HiMapExpand.js +210 -0
  44. package/HiMap/index.js +23 -0
  45. package/HiNotice/HiKPI.js +238 -0
  46. package/HiNotice/HiKPINotice.js +96 -0
  47. package/HiNotice/index.js +23 -0
  48. package/HiPdfReader/HiPdfReader.js +269 -0
  49. package/HiPdfReader/index.js +15 -0
  50. package/HiPin/HiPin.js +1 -1
  51. package/HiRadio/HiRadio.js +74 -0
  52. package/HiRadio/index.js +15 -0
  53. package/HiSelect/HiSelect.js +73 -84
  54. package/HiSelect/HiSuggestSelect.js +35 -4
  55. package/HiSelect/SelectInput.js +9 -1
  56. package/HiSelectNew/HiNestedSelectContent.js +5 -1
  57. package/HiSelectNew/HiSelect.js +260 -179
  58. package/HiSelectNew/HiSelectContent.js +0 -8
  59. package/HiSelectNew/HiSelectInput.js +8 -9
  60. package/HiSelectableList/HiSelectableList.js +39 -4
  61. package/HiSelectableList/HiSelectableListItem.js +81 -38
  62. package/HiTable/HiCellBuilder.js +25 -12
  63. package/HiTable/HiTableHeader.js +16 -17
  64. package/HiTable/constants.js +3 -1
  65. package/README.md +248 -98
  66. package/es/HiBreadcrumb/HiBreadcrumb.js +14 -4
  67. package/es/HiBreadcrumb/HiStep.js +4 -1
  68. package/es/HiBreadcrumb/HiStepContent.js +0 -1
  69. package/es/HiBreadcrumb/HiStepLabel.js +13 -4
  70. package/es/HiBreadcrumb/HiStepper.js +1 -1
  71. package/es/HiButton/HiButton.js +7 -0
  72. package/es/HiCell/CellIcon.js +5 -5
  73. package/es/HiCell/CellImage.js +13 -1
  74. package/es/HiCell/CellRate.js +6 -3
  75. package/es/HiCell/CellSentinel.js +7 -10
  76. package/es/HiCell/CellTextStyled.js +28 -1
  77. package/es/HiColoredLabel/HiColoredLabel.js +1 -1
  78. package/es/HiDatePicker/Caption.js +14 -10
  79. package/es/HiDatePicker/HiDatePicker.js +8 -3
  80. package/es/HiDatePicker/HiDateRangePicker.js +40 -28
  81. package/es/HiDatePicker/HiDateRangeSelector.js +69 -21
  82. package/es/HiDatePicker/ListPicker.js +1 -1
  83. package/es/HiDatePicker/NavBar.js +7 -1
  84. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
  85. package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
  86. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +5 -5
  87. package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  88. package/es/HiDatePicker/Overlays/Overlay.js +16 -9
  89. package/es/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  90. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  91. package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  92. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
  93. package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  94. package/es/HiDatePicker/hiLocaleUtils.js +131 -0
  95. package/es/HiDatePicker/stylesheet.js +32 -7
  96. package/es/HiDotsStepper/HiDot.js +66 -0
  97. package/es/HiDotsStepper/HiDotsStepper.js +73 -0
  98. package/es/HiExpansionPanel/HiExpansionPanel.js +1 -1
  99. package/es/HiForm/HiAddressField.js +134 -0
  100. package/es/HiForm/HiFormControl.js +2 -0
  101. package/es/HiForm/HiInput.js +3 -3
  102. package/es/HiForm/HiSlider.js +302 -0
  103. package/es/HiForm/HiUpload.js +158 -0
  104. package/es/HiForm/HiUploadField.js +140 -0
  105. package/es/HiForm/HiUploadInput.js +411 -0
  106. package/es/HiForm/index.js +2 -0
  107. package/es/HiMap/HiMap.js +290 -0
  108. package/es/HiMap/HiMapExpand.js +162 -0
  109. package/es/HiMap/index.js +2 -0
  110. package/es/HiNotice/HiKPI.js +196 -0
  111. package/es/HiNotice/HiKPINotice.js +78 -0
  112. package/es/HiNotice/index.js +2 -0
  113. package/es/HiPdfReader/HiPdfReader.js +214 -0
  114. package/es/HiPdfReader/index.js +1 -0
  115. package/es/HiPin/HiPin.js +1 -1
  116. package/es/HiRadio/HiRadio.js +55 -0
  117. package/es/HiRadio/index.js +1 -0
  118. package/es/HiSelect/HiSelect.js +68 -78
  119. package/es/HiSelect/HiSuggestSelect.js +30 -4
  120. package/es/HiSelect/SelectInput.js +9 -1
  121. package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
  122. package/es/HiSelectNew/HiSelect.js +246 -162
  123. package/es/HiSelectNew/HiSelectContent.js +0 -7
  124. package/es/HiSelectNew/HiSelectInput.js +8 -9
  125. package/es/HiSelectableList/HiSelectableList.js +34 -6
  126. package/es/HiSelectableList/HiSelectableListItem.js +92 -40
  127. package/es/HiTable/HiCellBuilder.js +130 -123
  128. package/es/HiTable/HiTableHeader.js +14 -12
  129. package/es/HiTable/constants.js +1 -0
  130. package/es/index.js +9 -1
  131. package/es/utils/helpers.js +1 -1
  132. package/index.es.js +9 -1
  133. package/index.js +66 -2
  134. package/package.json +5 -2
  135. package/umd/hipay-material-ui.development.js +44450 -40930
  136. package/umd/hipay-material-ui.production.min.js +2 -2
  137. package/utils/helpers.js +1 -1
@@ -106,7 +106,10 @@ var styles = function styles(theme) {
106
106
  }, theme.typography.b1, {
107
107
  display: 'inline-flex',
108
108
  width: '100%'
109
- })
109
+ }),
110
+ separator: {
111
+ borderTop: "1px solid ".concat(theme.palette.input.bottomLine)
112
+ }
110
113
  };
111
114
  };
112
115
  /**
@@ -138,6 +141,112 @@ function (_React$PureComponent) {
138
141
  (0, _classCallCheck2.default)(this, HiSelect);
139
142
  _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiSelect).call(this, props));
140
143
 
144
+ _this.buildSelectProps = function (options) {
145
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
146
+ var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
147
+ var loading = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
148
+ // build item list
149
+ var itemList = (0, _toConsumableArray2.default)(loading ? [{
150
+ id: '_loading',
151
+ type: 'loader',
152
+ disabled: true,
153
+ centered: true,
154
+ hideCheckbox: true,
155
+ label: 'loading'
156
+ }] : []).concat((0, _toConsumableArray2.default)(search !== '' ? (0, _toConsumableArray2.default)(options.filter(function (item) {
157
+ return item.label && (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(search.toLowerCase())) !== -1;
158
+ })) : (0, _toConsumableArray2.default)(_this.props.hasAll ? [(0, _extends2.default)({
159
+ id: '_all',
160
+ label: _this.props.translations.all
161
+ }, _this.props.iconAll && {
162
+ type: 'icon',
163
+ icon: _this.props.iconAll
164
+ })] : []).concat((0, _toConsumableArray2.default)(options))));
165
+ return {
166
+ itemList: itemList,
167
+ inputValue: _this.buildInputValue(options, value, loading)
168
+ };
169
+ };
170
+
171
+ _this.buildInputValue = function (options) {
172
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
173
+ var loading = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
174
+ var _this$props = _this.props,
175
+ classes = _this$props.classes,
176
+ hasAll = _this$props.hasAll,
177
+ translations = _this$props.translations,
178
+ type = _this$props.type; // build input value
179
+
180
+ var inputValue;
181
+
182
+ if (loading && value.length === 1) {
183
+ inputValue = translations.one_item_selected;
184
+ } else if (hasAll && options.length === value.length) {
185
+ inputValue = translations.all;
186
+ value.unshift('_all');
187
+ } else if (value.length > 1) {
188
+ inputValue = translations.n_items_selected.replace('%s', value.length);
189
+ } else if (value.length === 1) {
190
+ var item = options.find(function (o) {
191
+ return o.id === value[0];
192
+ });
193
+
194
+ if (item === undefined) {
195
+ inputValue = translations.one_item_selected;
196
+ } else if (type === 'icon' || item.type === 'icon') {
197
+ inputValue = _react.default.createElement("span", {
198
+ className: classes.selectIconLabel
199
+ }, _react.default.createElement(_HiIcon.default, {
200
+ className: classes.labelIcon,
201
+ icon: item.icon
202
+ }), item.label);
203
+ } else if (type === 'image' || item.type === 'image') {
204
+ inputValue = _react.default.createElement("span", {
205
+ className: classes.selectIconLabel
206
+ }, _react.default.createElement("img", {
207
+ className: classes.labelImg,
208
+ src: item.img,
209
+ alt: item.label,
210
+ onError: function onError(e) {
211
+ if (item.fallbackImage) {
212
+ e.target.src = "".concat(item.fallbackImage);
213
+ } else {
214
+ e.target.style.display = 'none';
215
+ }
216
+ }
217
+ }), item.label);
218
+ } else {
219
+ inputValue = item.label;
220
+ }
221
+ }
222
+
223
+ return inputValue;
224
+ };
225
+
226
+ _this.focusOnFirstItem = function () {
227
+ var overlay = (0, _reactDom.findDOMNode)(_this.overlay);
228
+ setTimeout(function () {
229
+ var item = overlay.getElementsByTagName('li')[0];
230
+ item.focus();
231
+ }, 1);
232
+ };
233
+
234
+ _this.getInputElement = function (el) {
235
+ _this.searchField = el;
236
+
237
+ if (_this.props.inputRef) {
238
+ _this.props.inputRef(_this.searchField);
239
+ }
240
+ };
241
+
242
+ _this.handleBlur = function () {
243
+ _this.handleSearchReset();
244
+
245
+ _this.setState({
246
+ focused: false
247
+ });
248
+ };
249
+
141
250
  _this.handleClick = function () {
142
251
  if (_this.state.open) {
143
252
  _this.handleClose();
@@ -151,20 +260,59 @@ function (_React$PureComponent) {
151
260
  if (_this.props.onClick) _this.props.onClick(); // Gestion du focus
152
261
 
153
262
  if (!_this.props.searchable) {
154
- // sinon focus sur le premier élément de la liste
155
- _this.focusOnFirstItem();
263
+ // Sinon focus sur l'élément sélectionné
264
+ _this.focusOnSelectedItem(_this.props.value);
156
265
  }
157
266
  }
158
267
  };
159
268
 
160
- _this.focusOnFirstItem = function () {
269
+ _this.focusOnSelectedItem = function (selectedValue) {
161
270
  var overlay = (0, _reactDom.findDOMNode)(_this.overlay);
162
271
  setTimeout(function () {
272
+ // On initialise au premier élément pour être sûr de ne pas se retrouver avec un focus of undefined
163
273
  var item = overlay.getElementsByTagName('li')[0];
164
- item.focus();
274
+
275
+ if (selectedValue && typeof selectedValue === 'string') {
276
+ item = overlay.getElementsByTagName('li')[selectedValue];
277
+ } else if (selectedValue && typeof selectedValue === 'number') {
278
+ item = overlay.getElementsByTagName('li')[selectedValue - 1];
279
+ }
280
+
281
+ if (item) {
282
+ item.focus();
283
+ }
165
284
  }, 1);
166
285
  };
167
286
 
287
+ _this.handleClickAway = function (event) {
288
+ // Au clic sur le bouton, on laisse le handleClick fermer le select
289
+ if (!_this.inputEl.contains(event.target)) {
290
+ _this.handleClose(event);
291
+ }
292
+ };
293
+
294
+ _this.handleClose = function () {
295
+ _this.handleSearchReset();
296
+
297
+ _this.setState({
298
+ open: false
299
+ });
300
+
301
+ if (_this.props.onClose) {
302
+ _this.props.onClose();
303
+ }
304
+
305
+ if (_this.inputEl) {
306
+ _this.inputEl.focus();
307
+ }
308
+ };
309
+
310
+ _this.handleFocus = function () {
311
+ _this.setState({
312
+ focused: true
313
+ });
314
+ };
315
+
168
316
  _this.handleKeyDown = function (event) {
169
317
  var nextItem;
170
318
  var key = (0, _keycode.default)(event);
@@ -175,7 +323,17 @@ function (_React$PureComponent) {
175
323
  } else if (key === 'up') {
176
324
  event.preventDefault();
177
325
  nextItem = (0, _helpers.getNextItemSelectable)(document.activeElement, 'up');
178
- } else if (key === 'tab' || key === 'esc') {
326
+ }
327
+
328
+ if (nextItem) {
329
+ nextItem.focus();
330
+ }
331
+ };
332
+
333
+ _this.handleKeyUp = function (event) {
334
+ var key = (0, _keycode.default)(event);
335
+
336
+ if (key === 'tab' || key === 'esc') {
179
337
  _this.setState({
180
338
  open: false
181
339
  });
@@ -192,10 +350,6 @@ function (_React$PureComponent) {
192
350
 
193
351
  _this.handleClose();
194
352
  }
195
-
196
- if (nextItem) {
197
- nextItem.focus();
198
- }
199
353
  };
200
354
 
201
355
  _this.handleKeyDownSearch = function (event) {
@@ -210,46 +364,19 @@ function (_React$PureComponent) {
210
364
  }
211
365
  };
212
366
 
213
- _this.handleFocus = function () {
214
- _this.setState({
215
- focused: true
216
- });
217
- };
218
-
219
- _this.handleBlur = function () {
220
- _this.setState({
221
- focused: false
222
- });
223
- };
224
-
225
- _this.handleClose = function () {
226
- _this.setState({
227
- open: false
228
- });
229
-
230
- if (_this.props.onClose) {
231
- _this.props.onClose();
232
- }
233
-
234
- if (_this.inputEl) {
235
- _this.inputEl.focus();
236
- }
237
- };
238
-
239
- _this.handleClickAway = function (event) {
240
- // Au clic sur le bouton, on laisse le handleClick fermer le select
241
- if (!_this.inputEl.contains(event.target)) {
242
- _this.handleClose(event);
367
+ _this.handleScroll = function (e) {
368
+ if (e.target.scrollHeight - e.target.clientHeight - e.target.scrollTop < 15) {
369
+ _this.props.onScrollReachBottom();
243
370
  }
244
371
  };
245
372
 
246
373
  _this.handleSelect = function (event, item) {
247
- var _this$props = _this.props,
248
- hasAll = _this$props.hasAll,
249
- multiple = _this$props.multiple,
250
- onChange = _this$props.onChange,
251
- options = _this$props.options,
252
- value = _this$props.value;
374
+ var _this$props2 = _this.props,
375
+ hasAll = _this$props2.hasAll,
376
+ multiple = _this$props2.multiple,
377
+ onChange = _this$props2.onChange,
378
+ options = _this$props2.options,
379
+ value = _this$props2.value;
253
380
 
254
381
  if (!multiple) {
255
382
  // single value
@@ -277,10 +404,10 @@ function (_React$PureComponent) {
277
404
  };
278
405
 
279
406
  _this.handleSuggestions = function (suggestions) {
280
- var _this$props2 = _this.props,
281
- hasAll = _this$props2.hasAll,
282
- iconAll = _this$props2.iconAll,
283
- translations = _this$props2.translations;
407
+ var _this$props3 = _this.props,
408
+ hasAll = _this$props3.hasAll,
409
+ iconAll = _this$props3.iconAll,
410
+ translations = _this$props3.translations;
284
411
 
285
412
  if (suggestions.length === 0) {
286
413
  // Add '_no_result' suggestion
@@ -309,12 +436,6 @@ function (_React$PureComponent) {
309
436
  }
310
437
  };
311
438
 
312
- _this.handleScroll = function (e) {
313
- if (e.target.scrollHeight - e.target.clientHeight - e.target.scrollTop < 15) {
314
- _this.props.onScrollReachBottom();
315
- }
316
- };
317
-
318
439
  _this.handleSearch = function (e, inputValue) {
319
440
  var searchValue = inputValue && e.target.value ? inputValue : e.target.value;
320
441
 
@@ -335,86 +456,12 @@ function (_React$PureComponent) {
335
456
  }, '');
336
457
  };
337
458
 
338
- _this.buildSelectProps = function (options) {
339
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
340
- var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
341
- var loading = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
342
- // build item list
343
- var itemList = (0, _toConsumableArray2.default)(loading ? [{
344
- id: '_loading',
345
- type: 'loader',
346
- disabled: true,
347
- centered: true,
348
- hideCheckbox: true,
349
- label: 'loading'
350
- }] : []).concat((0, _toConsumableArray2.default)(search !== '' ? (0, _toConsumableArray2.default)(options.filter(function (item) {
351
- return item.label && (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(search.toLowerCase())) !== -1;
352
- })) : (0, _toConsumableArray2.default)(_this.props.hasAll ? [(0, _extends2.default)({
353
- id: '_all',
354
- label: _this.props.translations.all
355
- }, _this.props.iconAll && {
356
- type: 'icon',
357
- icon: _this.props.iconAll
358
- })] : []).concat((0, _toConsumableArray2.default)(options))));
359
- return {
360
- itemList: itemList,
361
- inputValue: _this.buildInputValue(options, value, loading)
362
- };
363
- };
364
-
365
- _this.buildInputValue = function (options) {
366
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
367
- var loading = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
368
- var _this$props3 = _this.props,
369
- classes = _this$props3.classes,
370
- hasAll = _this$props3.hasAll,
371
- translations = _this$props3.translations,
372
- type = _this$props3.type; // build input value
373
-
374
- var inputValue;
375
-
376
- if (loading && value.length === 1) {
377
- inputValue = translations.one_item_selected;
378
- } else if (hasAll && options.length === value.length) {
379
- inputValue = translations.all;
380
- value.unshift('_all');
381
- } else if (value.length > 1) {
382
- inputValue = translations.n_items_selected.replace('%s', value.length);
383
- } else if (value.length === 1) {
384
- var item = options.find(function (o) {
385
- return o.id === value[0];
386
- });
387
-
388
- if (item === undefined) {
389
- inputValue = translations.one_item_selected;
390
- } else if (type === 'icon' || item.type === 'icon') {
391
- inputValue = _react.default.createElement("span", {
392
- className: classes.selectIconLabel
393
- }, _react.default.createElement(_HiIcon.default, {
394
- className: classes.labelIcon,
395
- icon: item.icon
396
- }), item.label);
397
- } else if (type === 'image' || item.type === 'image') {
398
- inputValue = _react.default.createElement("span", {
399
- className: classes.selectIconLabel
400
- }, _react.default.createElement("img", {
401
- className: classes.labelImg,
402
- src: item.img,
403
- alt: item.label
404
- }), item.label);
405
- } else {
406
- inputValue = item.label;
407
- }
408
- }
409
-
410
- return inputValue;
411
- };
412
-
413
459
  _this.state = {
414
460
  open: false,
415
461
  focused: false,
416
462
  searchValue: props.searchValue ? undefined : '',
417
- suggestions: props.options
463
+ suggestions: props.options,
464
+ openDown: true
418
465
  };
419
466
  _this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
420
467
  _this.handleClose = _this.handleClose.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
@@ -430,15 +477,6 @@ function (_React$PureComponent) {
430
477
  }
431
478
 
432
479
  (0, _createClass2.default)(HiSelect, [{
433
- key: "getInputElement",
434
- value: function getInputElement(el) {
435
- this.searchField = el;
436
-
437
- if (this.props.inputRef) {
438
- this.props.inputRef(this.searchField);
439
- }
440
- }
441
- }, {
442
480
  key: "render",
443
481
  value: function render() {
444
482
  var _classNames,
@@ -456,6 +494,7 @@ function (_React$PureComponent) {
456
494
  value = _this$props4.value,
457
495
  multiple = _this$props4.multiple,
458
496
  translations = _this$props4.translations,
497
+ hiSearchInputProps = _this$props4.hiSearchInputProps,
459
498
  hiSelectableListProps = _this$props4.hiSelectableListProps,
460
499
  hiSelectInputProps = _this$props4.hiSelectInputProps,
461
500
  id = _this$props4.id,
@@ -503,43 +542,70 @@ function (_React$PureComponent) {
503
542
 
504
543
  var popperClass = (0, _classnames.default)(classes.popper, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.popperWidth, !this.props.containerWidth), (0, _defineProperty2.default)(_classNames, classes.popperRightAlign, this.props.containerWidth && this.props.align === 'right'), _classNames));
505
544
 
506
- var content = _react.default.createElement(_ClickAwayListener.default, {
507
- onClickAway: this.handleClickAway
508
- }, _react.default.createElement(_Grow.default, {
509
- in: open,
510
- id: "menu-list",
511
- style: {
512
- transformOrigin: '0 0 0'
545
+ var searchInput = function searchInput(position) {
546
+ if (!!searchable) {
547
+ return _react.default.createElement(_HiInput.default, (0, _extends2.default)({
548
+ value: searchValue,
549
+ autoFocus: true,
550
+ inputRef: _this2.getInputElement,
551
+ onKeyDown: _this2.handleKeyDownSearch,
552
+ onChange: _this2.handleSearch,
553
+ onReset: _this2.handleSearchReset,
554
+ placeholder: translations.search,
555
+ startAdornment: 'search',
556
+ tabIndex: 0,
557
+ className: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.separator, position === 'top'))
558
+ }, hiSearchInputProps));
513
559
  }
514
- }, _react.default.createElement(_Paper.default, {
515
- className: classes.paper
516
- }, !!searchable && _react.default.createElement(_HiInput.default, {
517
- value: searchValue,
518
- autoFocus: true,
519
- inputRef: this.getInputElement,
520
- onKeyDown: this.handleKeyDownSearch,
521
- onChange: this.handleSearch,
522
- onReset: this.handleSearchReset,
523
- placeholder: translations.search,
524
- startAdornment: 'search',
525
- tabIndex: 0
526
- }), startAdornment, _react.default.createElement(_reactCustomScrollbars.default, (0, _extends2.default)({
527
- ref: function ref(contentEl) {
528
- _this2.optionsContent = contentEl;
529
- },
530
- autoHeight: true,
531
- autoHeightMax: 400 // TODO ?
532
-
533
- }, onScrollReachBottom && {
534
- onScroll: this.handleScroll
535
- }), _react.default.createElement(_HiSelectableList.default, (0, _extends2.default)({
536
- type: type,
537
- itemList: itemList,
538
- onKeyDown: this.handleKeyDown,
539
- onSelect: this.handleSelect,
540
- selectedItemIdList: selectedItemIdList,
541
- fallbackImage: this.props.fallbackImage
542
- }, hiSelectableListProps))))));
560
+
561
+ return null;
562
+ }; // Replace popper onSearch when popper displayed on top of selectButton
563
+
564
+
565
+ if (this.placement && this.placement.indexOf('top') >= 0 && !!searchable) {
566
+ // +1 for search input
567
+ var nbItems = itemList.length <= 10 ? itemList.length + 1 : 11;
568
+ popperStyle.transform = "translate3d(-1px, -".concat(nbItems * 40 + 2, "px, 0px)");
569
+ } else if (this.placement && this.placement.indexOf('top') < 0 && !!searchable) {
570
+ popperStyle.transform = "translate3d(-1px, 40px, 0px)";
571
+ }
572
+
573
+ var content = function content(_ref) {
574
+ var placement = _ref.placement;
575
+
576
+ if (placement !== _this2.placement) {
577
+ _this2.placement = placement;
578
+ }
579
+
580
+ return _react.default.createElement(_ClickAwayListener.default, {
581
+ onClickAway: _this2.handleClickAway
582
+ }, _react.default.createElement(_Grow.default, {
583
+ in: open,
584
+ id: "menu-list",
585
+ style: {
586
+ transformOrigin: '0 0 0'
587
+ }
588
+ }, _react.default.createElement(_Paper.default, {
589
+ className: classes.paper
590
+ }, (_this2.placement && _this2.placement.indexOf('bottom') >= 0 || staticPosition) && searchInput('bottom'), startAdornment, _react.default.createElement(_reactCustomScrollbars.default, (0, _extends2.default)({
591
+ ref: function ref(contentEl) {
592
+ _this2.optionsContent = contentEl;
593
+ },
594
+ autoHeight: true,
595
+ autoHeightMax: 400 // TODO ?
596
+
597
+ }, onScrollReachBottom && {
598
+ onScroll: _this2.handleScroll
599
+ }), _react.default.createElement(_HiSelectableList.default, (0, _extends2.default)({
600
+ type: type,
601
+ itemList: itemList,
602
+ onKeyDown: _this2.handleKeyDown,
603
+ onKeyUp: _this2.handleKeyUp,
604
+ onSelect: _this2.handleSelect,
605
+ selectedItemIdList: selectedItemIdList,
606
+ fallbackImage: _this2.props.fallbackImage
607
+ }, hiSelectableListProps))), _this2.placement && _this2.placement.indexOf('top') >= 0 && !staticPosition && searchInput('top'))));
608
+ };
543
609
 
544
610
  return _react.default.createElement("div", {
545
611
  className: classes.root,
@@ -570,7 +636,7 @@ function (_React$PureComponent) {
570
636
  })), open && staticPosition ? _react.default.createElement("div", {
571
637
  style: popperStyle,
572
638
  className: popperClass
573
- }, content) : _react.default.createElement(_Popper.default, {
639
+ }, content({})) : _react.default.createElement(_Popper.default, {
574
640
  anchorEl: this.inputEl,
575
641
  placement: "bottom-start",
576
642
  open: open,
@@ -590,6 +656,15 @@ function (_React$PureComponent) {
590
656
 
591
657
  return null;
592
658
  }
659
+ /**
660
+ * Build itemList & inputValue from select props
661
+ * @param options
662
+ * @param value
663
+ * @param search
664
+ * @param loading
665
+ * @returns {{itemList: *[], inputValue: *}}
666
+ */
667
+
593
668
  }]);
594
669
  return HiSelect;
595
670
  }(_react.default.PureComponent);
@@ -602,6 +677,7 @@ HiSelect.defaultProps = {
602
677
  hasAll: false,
603
678
  hiSelectableListProps: {},
604
679
  hiSelectInputProps: {},
680
+ hiSearchInputProps: {},
605
681
  multiple: false,
606
682
  placeholder: '',
607
683
  searchable: false,
@@ -656,7 +732,12 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
656
732
  hasAll: _propTypes.default.bool,
657
733
 
658
734
  /**
659
- * Override HiSelectableList props (
735
+ * Override HiInput props (for search)
736
+ */
737
+ hiSearchInputProps: _propTypes.default.object,
738
+
739
+ /**
740
+ * Override HiSelectableList props
660
741
  */
661
742
  hiSelectableListProps: _propTypes.default.object,
662
743
 
@@ -37,8 +37,6 @@ var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
37
37
 
38
38
  var _helpers = require("../utils/helpers");
39
39
 
40
- var _HiIcon = _interopRequireDefault(require("../HiIcon"));
41
-
42
40
  var _keycode = _interopRequireDefault(require("keycode"));
43
41
 
44
42
  var styles = function styles(theme) {
@@ -295,9 +293,6 @@ function (_React$PureComponent) {
295
293
  var _this2 = this;
296
294
 
297
295
  var _this$props3 = this.props,
298
- classes = _this$props3.classes,
299
- disabled = _this$props3.disabled,
300
- error = _this$props3.error,
301
296
  loading = _this$props3.loading,
302
297
  options = _this$props3.options,
303
298
  searchable = _this$props3.searchable,
@@ -306,10 +301,7 @@ function (_React$PureComponent) {
306
301
  multiple = _this$props3.multiple,
307
302
  translations = _this$props3.translations,
308
303
  hiSelectableListProps = _this$props3.hiSelectableListProps,
309
- hiSelectInputProps = _this$props3.hiSelectInputProps,
310
- id = _this$props3.id,
311
304
  onScrollReachBottom = _this$props3.onScrollReachBottom,
312
- onSubmit = _this$props3.onSubmit,
313
305
  startAdornment = _this$props3.startAdornment,
314
306
  _this$props3$searchVa = _this$props3.searchValue,
315
307
  searchValue = _this$props3$searchVa === void 0 ? this.state.searchValue : _this$props3$searchVa,
@@ -209,14 +209,12 @@ function (_React$PureComponent) {
209
209
  _this.handleBlur = function (event) {
210
210
  if ((!_this.input || !_this.input.contains(event.relatedTarget)) && _this.props.onBlur) {
211
211
  _this.props.onBlur(event);
212
- } else {
213
- if (_this.input && (!_this.resetIcon || !_this.resetIcon.contains(event.relatedTarget))) {
214
- _this.input.focus();
215
- }
212
+ } else if (_this.input && (!_this.resetIcon || !_this.resetIcon.contains(event.relatedTarget))) {
213
+ _this.input.focus();
216
214
  }
217
215
  };
218
216
 
219
- _this.handleRef = function (el) {
217
+ _this.ref = function (el) {
220
218
  _this.input = el;
221
219
 
222
220
  if (_this.props.refElement) {
@@ -227,7 +225,7 @@ function (_React$PureComponent) {
227
225
  _this.handleKeyDown = _this.handleKeyDown.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
228
226
  _this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
229
227
  _this.handleBlur = _this.handleBlur.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
230
- _this.handleRef = _this.handleRef.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
228
+ _this.ref = _this.ref.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
231
229
  _this.handleReset = _this.handleReset.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
232
230
  return _this;
233
231
  }
@@ -265,7 +263,7 @@ function (_React$PureComponent) {
265
263
  onBlur: this.props.onBlur,
266
264
  role: "button",
267
265
  tabIndex: "0",
268
- ref: this.handleRef
266
+ ref: this.ref
269
267
  }, _react.default.createElement("span", {
270
268
  className: (0, _classnames.default)(classes.label, (0, _defineProperty2.default)({}, classes.placeholder, value === undefined))
271
269
  }, value || placeholder), _react.default.createElement(_ArrowDropDown.default, {
@@ -279,8 +277,9 @@ function (_React$PureComponent) {
279
277
  onMouseLeave: this.props.onMouseLeave,
280
278
  onKeyDown: this.handleKeyDown,
281
279
  onFocus: this.props.onFocus,
282
- onBlur: this.handleBlur,
283
- buttonRef: this.handleRef
280
+ onBlur: this.handleBlur // buttref={this.ref}
281
+ ,
282
+ buttonRef: this.ref
284
283
  }, _react.default.createElement("span", {
285
284
  className: (0, _classnames.default)(classes.label, (0, _defineProperty2.default)({}, classes.placeholder, value === undefined))
286
285
  }, value || placeholder), onReset && focused && _react.default.createElement("div", {