@hipay/hipay-material-ui 2.0.0-beta.49 → 2.0.0-beta.50

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.
@@ -35,7 +35,8 @@ var styles = function styles(theme) {
35
35
  borderRadius: 2,
36
36
  textOverflow: 'ellipsis',
37
37
  overflow: 'hidden',
38
- whiteSpace: 'nowrap'
38
+ whiteSpace: 'nowrap',
39
+ lineHeight: 1
39
40
  }),
40
41
  color: {
41
42
  fontWeight: 400
@@ -236,7 +236,7 @@ function (_React$PureComponent) {
236
236
  onKeyDown: this.handleKeyDownSearch,
237
237
  onBlur: this.handleBlur,
238
238
  onFocus: this.handleFocus
239
- })), _react.default.createElement(_Popper.default, {
239
+ })), open && _react.default.createElement(_Popper.default, {
240
240
  disablePortal: true,
241
241
  anchorEl: this.textInput,
242
242
  placement: "bottom-start",
@@ -31,6 +31,8 @@ var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
31
31
 
32
32
  var _HiSelectableListItem = _interopRequireDefault(require("./HiSelectableListItem"));
33
33
 
34
+ var _helpers = require("../utils/helpers");
35
+
34
36
  var styles = function styles() {
35
37
  return {
36
38
  root: {
@@ -110,7 +112,17 @@ function (_React$PureComponent) {
110
112
  return 0;
111
113
  }
112
114
 
113
- return a.label.toString().toLowerCase() > b.label.toString().toLowerCase();
115
+ var sortAppendList = _this.props.sortAppendList;
116
+
117
+ if (sortAppendList.indexOf(a.id) < sortAppendList.indexOf(b.id)) {
118
+ return 1;
119
+ }
120
+
121
+ if (sortAppendList.indexOf(a.id) > sortAppendList.indexOf(b.id)) {
122
+ return -1;
123
+ }
124
+
125
+ return (0, _helpers.foldAccents)(a.label.toString().toLowerCase()) > (0, _helpers.foldAccents)(b.label.toString().toLowerCase()) ? 1 : -1;
114
126
  };
115
127
 
116
128
  return _this;
@@ -151,7 +163,8 @@ HiSelectableList.defaultProps = {
151
163
  disabledItemIdList: [],
152
164
  hideCheckbox: false,
153
165
  selectedItemIdList: [],
154
- sort: false
166
+ sort: false,
167
+ sortAppendList: ['_all']
155
168
  };
156
169
  HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
157
170
  /**
@@ -215,7 +228,12 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
215
228
  /**
216
229
  * Tri des éléments selon leur label
217
230
  */
218
- sort: _propTypes.default.bool
231
+ sort: _propTypes.default.bool,
232
+
233
+ /**
234
+ * Liste des éléments à placer en premier, peu import le tri
235
+ */
236
+ sortAppendList: _propTypes.default.array
219
237
  } : {};
220
238
 
221
239
  var _default = (0, _withStyles.default)(styles, {
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import classNames from 'classnames';
7
7
  import withStyles from '../styles/withStyles';
8
- import { capitalize, escapeHTML } from '../utils/helpers';
8
+ import { capitalize } from '../utils/helpers';
9
9
  import { fade } from '../styles/colorManipulator';
10
10
  export const styles = theme => ({
11
11
  root: _objectSpread({}, theme.typography.b1, {
@@ -16,7 +16,8 @@ export const styles = theme => ({
16
16
  borderRadius: 2,
17
17
  textOverflow: 'ellipsis',
18
18
  overflow: 'hidden',
19
- whiteSpace: 'nowrap'
19
+ whiteSpace: 'nowrap',
20
+ lineHeight: 1
20
21
  }),
21
22
  color: {
22
23
  fontWeight: 400
@@ -184,7 +184,7 @@ class HiSuggestSelect extends React.PureComponent {
184
184
  onKeyDown: this.handleKeyDownSearch,
185
185
  onBlur: this.handleBlur,
186
186
  onFocus: this.handleFocus
187
- })), React.createElement(Popper, {
187
+ })), open && React.createElement(Popper, {
188
188
  disablePortal: true,
189
189
  anchorEl: this.textInput,
190
190
  placement: "bottom-start",
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import List from '@material-ui/core/List';
6
6
  import withStyles from '../styles/withStyles';
7
7
  import HiSelectableListItem from './HiSelectableListItem';
8
+ import { foldAccents } from '../utils/helpers';
8
9
  export const styles = () => ({
9
10
  root: {
10
11
  padding: 0
@@ -60,7 +61,17 @@ class HiSelectableList extends React.PureComponent {
60
61
  return 0;
61
62
  }
62
63
 
63
- return a.label.toString().toLowerCase() > b.label.toString().toLowerCase();
64
+ const sortAppendList = this.props.sortAppendList;
65
+
66
+ if (sortAppendList.indexOf(a.id) < sortAppendList.indexOf(b.id)) {
67
+ return 1;
68
+ }
69
+
70
+ if (sortAppendList.indexOf(a.id) > sortAppendList.indexOf(b.id)) {
71
+ return -1;
72
+ }
73
+
74
+ return foldAccents(a.label.toString().toLowerCase()) > foldAccents(b.label.toString().toLowerCase()) ? 1 : -1;
64
75
  };
65
76
  }
66
77
 
@@ -91,7 +102,8 @@ HiSelectableList.defaultProps = {
91
102
  disabledItemIdList: [],
92
103
  hideCheckbox: false,
93
104
  selectedItemIdList: [],
94
- sort: false
105
+ sort: false,
106
+ sortAppendList: ['_all']
95
107
  };
96
108
  HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
97
109
  /**
@@ -155,7 +167,12 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
155
167
  /**
156
168
  * Tri des éléments selon leur label
157
169
  */
158
- sort: PropTypes.bool
170
+ sort: PropTypes.bool,
171
+
172
+ /**
173
+ * Liste des éléments à placer en premier, peu import le tri
174
+ */
175
+ sortAppendList: PropTypes.array
159
176
  } : {};
160
177
  export default withStyles(styles, {
161
178
  hiComponent: true,
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.49
1
+ /** @license HiPay-Material-UI v2.0.0-beta.50
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.0.0-beta.49
1
+ /** @license HiPay-Material-UI v2.0.0-beta.50
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.0.0-beta.49",
5
+ "version": "2.0.0-beta.50",
6
6
  "description": "React components that implement Google's Material Design.",
7
7
  "keywords": [
8
8
  "react",
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.49
1
+ /** @license HiPay-Material-UI v2.0.0-beta.50
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.
@@ -15098,6 +15098,28 @@
15098
15098
 
15099
15099
  return node.previousSibling;
15100
15100
  }
15101
+ /**
15102
+ * Retourne la chaîne de caractères passée en entrée sans les accents
15103
+ * @param toFold
15104
+ * @returns {*}
15105
+ */
15106
+
15107
+ function foldAccents(toFold) {
15108
+ return toFold.replace(/([àáâãäå])|([ç])|([èéêë])|([ìíîï])|([ñ])|([òóôõöø])|([ß])|([ùúûü])|([ÿ])|([æ])|([œ])/g, function (str, a, c, e, i, n, o, s, u, y, ae, oe) {
15109
+ if (a) return 'a';
15110
+ if (c) return 'c';
15111
+ if (e) return 'e';
15112
+ if (i) return 'i';
15113
+ if (n) return 'n';
15114
+ if (o) return 'o';
15115
+ if (s) return 's';
15116
+ if (u) return 'u';
15117
+ if (y) return 'y';
15118
+ if (ae) return 'ae';
15119
+ if (oe) return 'oe';
15120
+ return str;
15121
+ });
15122
+ }
15101
15123
 
15102
15124
  /**
15103
15125
  * @ignore - internal component.
@@ -93950,7 +93972,8 @@
93950
93972
  borderRadius: 2,
93951
93973
  textOverflow: 'ellipsis',
93952
93974
  overflow: 'hidden',
93953
- whiteSpace: 'nowrap'
93975
+ whiteSpace: 'nowrap',
93976
+ lineHeight: 1
93954
93977
  }),
93955
93978
  color: {
93956
93979
  fontWeight: 400
@@ -98469,7 +98492,17 @@
98469
98492
  return 0;
98470
98493
  }
98471
98494
 
98472
- return a.label.toString().toLowerCase() > b.label.toString().toLowerCase();
98495
+ var sortAppendList = _this.props.sortAppendList;
98496
+
98497
+ if (sortAppendList.indexOf(a.id) < sortAppendList.indexOf(b.id)) {
98498
+ return 1;
98499
+ }
98500
+
98501
+ if (sortAppendList.indexOf(a.id) > sortAppendList.indexOf(b.id)) {
98502
+ return -1;
98503
+ }
98504
+
98505
+ return foldAccents(a.label.toString().toLowerCase()) > foldAccents(b.label.toString().toLowerCase()) ? 1 : -1;
98473
98506
  };
98474
98507
 
98475
98508
  return _this;
@@ -98511,7 +98544,8 @@
98511
98544
  disabledItemIdList: [],
98512
98545
  hideCheckbox: false,
98513
98546
  selectedItemIdList: [],
98514
- sort: false
98547
+ sort: false,
98548
+ sortAppendList: ['_all']
98515
98549
  };
98516
98550
  HiSelectableList.propTypes = {
98517
98551
  /**
@@ -98575,7 +98609,12 @@
98575
98609
  /**
98576
98610
  * Tri des éléments selon leur label
98577
98611
  */
98578
- sort: propTypes.bool
98612
+ sort: propTypes.bool,
98613
+
98614
+ /**
98615
+ * Liste des éléments à placer en premier, peu import le tri
98616
+ */
98617
+ sortAppendList: propTypes.array
98579
98618
  };
98580
98619
  var HiSelectableList$1 = withStyles(styles$q, {
98581
98620
  hiComponent: true,