@hipay/hipay-material-ui 2.0.0-beta.65 → 2.0.0-beta.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,16 +28,17 @@ class HiBreadcrumb extends React.PureComponent {
28
28
  }, React.createElement("div", null, steps.map((step, index) => {
29
29
  const validConnector = step.status === 'validated' && index < steps.length - 1 && (steps[index + 1].status === 'validated' || steps[index + 1].status === 'active');
30
30
  return React.createElement(HiStep, {
31
- index: index,
31
+ index: step.id,
32
32
  content: step.content,
33
33
  key: step.id,
34
- onClick: this.handleStep(index),
34
+ onClick: this.handleStep(step.id),
35
35
  isLast: index === steps.length - 1,
36
36
  validConnector: validConnector,
37
37
  type: type,
38
- steps: steps
38
+ steps: steps,
39
+ active: activeStep === step.id
39
40
  }, React.createElement(HiStepLabel, {
40
- active: activeStep === index,
41
+ active: activeStep === step.id,
41
42
  status: step.status,
42
43
  notificationNumber: step.notificationNumber,
43
44
  type: type,
@@ -9,15 +9,28 @@ import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
9
9
  import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
10
10
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
11
11
  import withStyles from '../styles/withStyles';
12
+ import classNames from 'classnames';
12
13
  export const styles = theme => ({
13
14
  summaryContent: {
14
15
  display: 'inline-block',
15
- border: 'none'
16
+ border: 'none',
17
+ '&$expanded': {
18
+ margin: 'initial'
19
+ }
16
20
  },
17
21
  summaryRoot: {
18
22
  borderBottom: '1px solid #E3E6E7',
19
23
  height: 48,
20
- minHeight: 48
24
+ minHeight: 48,
25
+ padding: '0 0 0 8px',
26
+ '&$expanded': {
27
+ minHeight: 48
28
+ }
29
+ },
30
+ expanded: {},
31
+ collapseDisable: {
32
+ cursor: 'default',
33
+ pointerEvents: 'none'
21
34
  },
22
35
  heading: _objectSpread({}, theme.typography.b1, {
23
36
  fontSize: 20,
@@ -29,7 +42,7 @@ export const styles = theme => ({
29
42
  fontSize: 11,
30
43
  lineHeight: '24px',
31
44
  float: 'right',
32
- marginRight: 40,
45
+ marginRight: 32,
33
46
  '&>svg': {
34
47
  fontSize: 18,
35
48
  marginLeft: 3,
@@ -41,11 +54,16 @@ export const styles = theme => ({
41
54
  border: 'none'
42
55
  },
43
56
  panelDetails: {
44
- padding: '8px 24px'
57
+ padding: 0
45
58
  },
46
59
  disabledPanel: {
47
60
  backgroundColor: '#ffffff',
48
61
  opacity: 1
62
+ },
63
+ expandIcon: {
64
+ width: 24,
65
+ height: 24,
66
+ right: 0
49
67
  }
50
68
  });
51
69
 
@@ -60,10 +78,12 @@ class HiExpansionPanel extends React.PureComponent {
60
78
  secondaryHeading,
61
79
  secondaryHeadingDisabled,
62
80
  secondaryHeadingIcon,
81
+ collapseDisable,
63
82
  children,
64
- classes
83
+ classes,
84
+ expanded
65
85
  } = _this$props,
66
- props = _objectWithoutProperties(_this$props, ["disabled", "heading", "secondaryHeading", "secondaryHeadingDisabled", "secondaryHeadingIcon", "children", "classes"]);
86
+ props = _objectWithoutProperties(_this$props, ["disabled", "heading", "secondaryHeading", "secondaryHeadingDisabled", "secondaryHeadingIcon", "collapseDisable", "children", "classes", "expanded"]);
67
87
 
68
88
  const effectiveDisabled = disabled || !children;
69
89
  return React.createElement(ExpansionPanel, _extends({
@@ -71,13 +91,19 @@ class HiExpansionPanel extends React.PureComponent {
71
91
  classes: {
72
92
  root: classes.panel,
73
93
  disabled: classes.disabledPanel
74
- }
94
+ },
95
+ expanded: collapseDisable || expanded
75
96
  }, props), React.createElement(ExpansionPanelSummary, {
76
97
  classes: {
77
98
  root: classes.summaryRoot,
78
- content: classes.summaryContent
99
+ content: classes.summaryContent,
100
+ expanded: classes.expanded,
101
+ expandIcon: classes.expandIcon
79
102
  },
80
- expandIcon: _ref
103
+ className: classNames({
104
+ [classes.collapseDisable]: collapseDisable
105
+ }),
106
+ expandIcon: !collapseDisable && _ref
81
107
  }, React.createElement("div", {
82
108
  className: classes.secondaryHeading
83
109
  }, !effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled, secondaryHeadingIcon), React.createElement("div", {
@@ -129,7 +155,12 @@ HiExpansionPanel.propTypes = process.env.NODE_ENV !== "production" ? {
129
155
  /**
130
156
  * Icone dans le titre secondaire du panel
131
157
  */
132
- secondaryHeadingIcon: PropTypes.any
158
+ secondaryHeadingIcon: PropTypes.any,
159
+
160
+ /**
161
+ * Désactive l'action d'ouverture et de fermeture du composant
162
+ */
163
+ collapseDisable: PropTypes.bool
133
164
  } : {};
134
165
  export default withStyles(styles, {
135
166
  hiComponent: true,
@@ -361,9 +361,9 @@ HiUpload.propTypes = process.env.NODE_ENV !== "production" ? {
361
361
  helperText: PropTypes.string,
362
362
 
363
363
  /**
364
- * id du composant
364
+ * Identifiant unique
365
365
  */
366
- id: PropTypes.string.isRequired,
366
+ id: PropTypes.string,
367
367
 
368
368
  /**
369
369
  * Array containing each of the inputs the component has to show (represented by an object).
@@ -209,6 +209,12 @@ class HiSelect extends React.PureComponent {
209
209
  if (!this.props.searchable) {
210
210
  // Sinon focus sur l'élément sélectionné
211
211
  this.focusOnSelectedItem(this.props.value);
212
+ } else {
213
+ if (this.searchField) {
214
+ setTimeout(() => {
215
+ this.searchField.focus();
216
+ }, 1);
217
+ }
212
218
  }
213
219
  }
214
220
  };
@@ -285,7 +291,7 @@ class HiSelect extends React.PureComponent {
285
291
  this.handleClose();
286
292
  }
287
293
  }
288
- } else if (key === 'space') {
294
+ } else if (key === 'space' && event.target !== this.searchField) {
289
295
  event.preventDefault();
290
296
 
291
297
  if (this.state.open) {
@@ -7,6 +7,7 @@ import withStyles from '../styles/withStyles';
7
7
  import HiSelectableListItem from './HiSelectableListItem';
8
8
  import { getNextItemSelectable, foldAccents } from '../utils/helpers';
9
9
  import keycode from 'keycode';
10
+ import LazyLoad, { forceCheck } from 'react-lazyload';
10
11
  export const styles = () => ({
11
12
  root: {
12
13
  padding: 0
@@ -52,18 +53,35 @@ class HiSelectableList extends React.PureComponent {
52
53
  hideCheckbox,
53
54
  hoverIcon,
54
55
  icon,
56
+ lazy,
55
57
  selectedItemIdList,
56
58
  sort,
57
59
  onKeyDown,
58
60
  onKeyUp
59
61
  } = _this$props,
60
- others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
62
+ others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
61
63
 
62
64
  if (sort && item.children) {
63
65
  item.children.sort(this.compareItem);
64
66
  }
65
67
 
66
- return React.createElement(React.Fragment, {
68
+ const placeholderContent = React.createElement("div", {
69
+ style: {
70
+ width: '90%',
71
+ padding: '8px 6px',
72
+ height: 40,
73
+ position: 'sticky',
74
+ left: 0
75
+ }
76
+ }, React.createElement("div", {
77
+ style: {
78
+ backgroundColor: '#F5F5F5',
79
+ width: '100%',
80
+ height: '100%',
81
+ borderRadius: 4
82
+ }
83
+ }));
84
+ const itemComponent = React.createElement(React.Fragment, {
67
85
  key: item.id
68
86
  }, React.createElement(HiSelectableListItem, _extends({}, others, {
69
87
  checkedIcon: checkedIcon,
@@ -79,6 +97,19 @@ class HiSelectableList extends React.PureComponent {
79
97
  ,
80
98
  item: item
81
99
  }, item)), item.children && item.children.length > 0 && item.children.filter(subItem => !(subItem.displayed === false)).map(subItem => this.buildRecursiveListItem(subItem, level + 1)));
100
+
101
+ if (lazy) {
102
+ return React.createElement(LazyLoad, {
103
+ key: item.id,
104
+ height: 40,
105
+ offset: 400,
106
+ once: true,
107
+ overflow: true,
108
+ placeholder: placeholderContent
109
+ }, itemComponent);
110
+ } else {
111
+ return itemComponent;
112
+ }
82
113
  };
83
114
 
84
115
  this.compareItem = (a, b) => {
@@ -107,9 +138,8 @@ class HiSelectableList extends React.PureComponent {
107
138
  componentDidMount() {
108
139
  // Focus on last item selected
109
140
  if (this.props.overlay && this.props.overlay.getElementsByTagName('li')[0]) {
110
- let item = this.props.overlay.getElementsByTagName('li')[0];
111
-
112
- if (this.props.value) {
141
+ if (Array.isArray(this.props.value) && this.props.value.length > 0 || !Array.isArray(this.props.value) && this.props.value) {
142
+ let item = this.props.overlay.getElementsByTagName('li')[0];
113
143
  let lastSelectedValue = Array.isArray(this.props.value) ? this.props.value[this.props.value.length - 1] : this.props.value;
114
144
  let index = 0;
115
145
  this.props.itemList.forEach(option => {
@@ -129,9 +159,14 @@ class HiSelectableList extends React.PureComponent {
129
159
  });
130
160
  }
131
161
  });
162
+ item && item.focus();
132
163
  }
164
+ }
165
+ }
133
166
 
134
- item.focus();
167
+ componentDidUpdate(prevProps) {
168
+ if (this.props.lazy && prevProps.itemList !== this.props.itemList) {
169
+ forceCheck();
135
170
  }
136
171
  }
137
172
 
@@ -163,6 +198,7 @@ HiSelectableList.defaultProps = {
163
198
  disabled: false,
164
199
  disabledItemIdList: [],
165
200
  hideCheckbox: false,
201
+ lazy: true,
166
202
  selectedItemIdList: [],
167
203
  sort: false,
168
204
  sortAppendList: ['_all']
@@ -218,6 +254,11 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
218
254
  */
219
255
  itemList: PropTypes.array.isRequired,
220
256
 
257
+ /**
258
+ * Active lazyloading on list items
259
+ */
260
+ lazy: PropTypes.bool,
261
+
221
262
  /**
222
263
  * Fonction de callback à la sélection d'un item, renvoie l'item sélectionné
223
264
  *
@@ -19,7 +19,7 @@ export const styles = theme => ({
19
19
  backgroundColor: `${theme.palette.action.hover} !important`
20
20
  }
21
21
  },
22
- clicableRow: {
22
+ clickableRow: {
23
23
  cursor: 'pointer'
24
24
  }
25
25
  });
@@ -47,7 +47,7 @@ class HiTableRow extends React.PureComponent {
47
47
  } = this.props;
48
48
  return React.createElement(TableRow, {
49
49
  className: classNames(classes.row, {
50
- [classes.clicableRow]: this.props.onClick
50
+ [classes.clickableRow]: this.props.onClick
51
51
  }),
52
52
  hover: true,
53
53
  onClick: event => this.handleClick(event, rowdata),
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.65
1
+ /** @license HiPay-Material-UI v2.0.0-beta.68
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.65
1
+ /** @license HiPay-Material-UI v2.0.0-beta.68
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
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@hipay/hipay-material-ui",
3
+ "private": false,
3
4
  "author": "HiPay PSYCHE Team",
4
- "version": "2.0.0-beta.65",
5
+ "version": "2.0.0-beta.68",
5
6
  "description": "React components that implement Google's Material Design.",
6
7
  "keywords": [
7
8
  "react",
@@ -57,6 +58,7 @@
57
58
  "react-day-picker": "^7.2.4",
58
59
  "react-event-listener": "^0.6.2",
59
60
  "react-jss": "^8.1.0",
61
+ "react-lazyload": "^2.5.0",
60
62
  "react-leaflet": "^2.1.0",
61
63
  "react-pdf": "^3.0.5",
62
64
  "react-spinners": "^0.4.5",
@@ -67,12 +69,9 @@
67
69
  "warning": "^4.0.1"
68
70
  },
69
71
  "sideEffects": false,
70
- "publishConfig": {
71
- "access": "public"
72
- },
73
72
  "engines": {
74
73
  "node": ">=6.0.0"
75
74
  },
76
75
  "main": "./index.js",
77
76
  "module": "./index.es.js"
78
- }
77
+ }