@hipay/hipay-material-ui 2.1.0-RC1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,9 +8,14 @@ import HiSelectableListItem from './HiSelectableListItem';
8
8
  import { getNextItemSelectable, foldAccents } from '../utils/helpers';
9
9
  import keycode from 'keycode';
10
10
  import LazyLoad, { forceCheck } from 'react-lazyload';
11
- export const styles = () => ({
11
+ import classNames from 'classnames';
12
+ export const styles = theme => ({
12
13
  root: {
13
14
  padding: 0
15
+ },
16
+ suggestionFocus: {
17
+ backgroundColor: theme.palette.action.hover,
18
+ fontWeight: theme.typography.fontWeightMedium
14
19
  }
15
20
  });
16
21
  /**
@@ -44,7 +49,7 @@ class HiSelectableList extends React.PureComponent {
44
49
  }
45
50
  };
46
51
 
47
- this.buildRecursiveListItem = (item, level = 0) => {
52
+ this.buildRecursiveListItem = (item, index, level = 0) => {
48
53
  const _this$props = this.props,
49
54
  {
50
55
  checkedIcon,
@@ -57,9 +62,11 @@ class HiSelectableList extends React.PureComponent {
57
62
  selectedItemIdList,
58
63
  sort,
59
64
  onKeyDown,
60
- onKeyUp
65
+ onKeyUp,
66
+ suggestionFocusIndex,
67
+ classes
61
68
  } = _this$props,
62
- others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
69
+ others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp", "suggestionFocusIndex", "classes"]);
63
70
 
64
71
  if (sort && item.children) {
65
72
  item.children.sort(this.compareItem);
@@ -95,8 +102,13 @@ class HiSelectableList extends React.PureComponent {
95
102
  onKeyUp: onKeyUp,
96
103
  selected: selectedItemIdList.includes(item.id) // item props override upper props (disabled, hideCheckbox, icon, level...)
97
104
  ,
98
- item: item
99
- }, item)), item.children && item.children.length > 0 && item.children.filter(subItem => !(subItem.displayed === false)).map(subItem => this.buildRecursiveListItem(subItem, level + 1)));
105
+ item: item,
106
+ classes: {
107
+ listItem: classNames({
108
+ [classes.suggestionFocus]: index === suggestionFocusIndex
109
+ })
110
+ }
111
+ }, item)), item.children && item.children.length > 0 && item.children.filter(subItem => !(subItem.displayed === false)).map(subItem => this.buildRecursiveListItem(subItem, index, level + 1)));
100
112
 
101
113
  if (lazy) {
102
114
  return React.createElement(LazyLoad, {
@@ -188,7 +200,7 @@ class HiSelectableList extends React.PureComponent {
188
200
  this.el = el;
189
201
  }
190
202
  }, itemList.filter(item => !(item.displayed === false)) // don't remove if undefined
191
- .map(item => this.buildRecursiveListItem(item)));
203
+ .map((item, index) => this.buildRecursiveListItem(item, index)));
192
204
  }
193
205
 
194
206
  }
@@ -277,6 +289,11 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
277
289
  */
278
290
  selectedItemIdList: PropTypes.array,
279
291
 
292
+ /**
293
+ * Index de l'item "focus"
294
+ */
295
+ suggestionFocusIndex: PropTypes.number,
296
+
280
297
  /**
281
298
  * Tri des éléments selon leur label
282
299
  */
@@ -294,5 +311,6 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
294
311
  } : {};
295
312
  export default withStyles(styles, {
296
313
  hiComponent: true,
297
- name: 'HmuiHiSelectableList'
314
+ name: 'HmuiHiSelectableList',
315
+ index: 51
298
316
  })(HiSelectableList);
@@ -330,7 +330,7 @@ class HiSelectableListItem extends React.PureComponent {
330
330
  indeterminateIcon: indeterminateIcon
331
331
  }), type === 'image' && img && React.createElement("img", {
332
332
  src: img,
333
- alt: img,
333
+ alt: '',
334
334
  onError: e => {
335
335
  if (fallbackImage) {
336
336
  e.target.src = `${fallbackImage}`;
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.1.0RC1
1
+ /** @license HiPay-Material-UI v2.1.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.1.0RC1
1
+ /** @license HiPay-Material-UI v2.1.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hipay/hipay-material-ui",
3
3
  "private": false,
4
4
  "author": "HiPay PSYCHE Team",
5
- "version": "2.1.0RC1",
5
+ "version": "2.1.0",
6
6
  "description": "React components that implement Google's Material Design.",
7
7
  "keywords": [
8
8
  "react",