@hipay/hipay-material-ui 1.0.0-beta.25 → 1.0.0-beta.26

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.
@@ -78,7 +78,7 @@ class HiSelect extends React.PureComponent {
78
78
  hierarchySelected: {},
79
79
  hierarchy: {},
80
80
  nbOptions: 0,
81
- dynamic: false
81
+ dynamic: props.dynamic || false
82
82
  };
83
83
 
84
84
  // Check if value is in options
@@ -121,7 +121,7 @@ class HiSelect extends React.PureComponent {
121
121
  }
122
122
  });
123
123
  this.state.nbOptions = optionsLength;
124
- } else {
124
+ } else if (!props.dynamic) {
125
125
  this.state.dynamic = true;
126
126
  }
127
127
 
@@ -251,25 +251,26 @@ class HiSelect extends React.PureComponent {
251
251
  }
252
252
 
253
253
  if ((dynamic || loading) && selectedIdList.length === 1) {
254
- display = translations.one_item_selected.replace('%s', selectedIdList.length);
254
+ display = translations.one_item_selected;
255
255
  } else if ((this.state.nbOptions !== selectedIdList.length || !hasAll) && selectedIdList.length > 1) {
256
256
  display = translations.n_items_selected.replace('%s', selectedIdList.length);
257
257
  } else if (this.state.nbOptions === selectedIdList.length && this.state.nbOptions > 1) {
258
258
  display = translations.all;
259
259
  } else if (selectedIdList.length === 1) {
260
- if (type !== 'icon') {
261
- let item = options.find(o => o.id === selectedIdList[0]);
262
- if (!item && pinnedItem) {
260
+ let item = options.find(o => o.id === selectedIdList[0]);
261
+ if (item === undefined) {
262
+ display = translations.one_item_selected;
263
+ } else if (type !== 'icon') {
264
+ if (pinnedItem) {
263
265
  item = pinnedItem;
264
266
  }
265
267
  display = item.label;
266
268
  } else {
267
- const optionSelected = options.find(o => o.id === selectedIdList[0]);
268
269
  display = React.createElement(
269
270
  'span',
270
271
  { className: classes.selectIconLabel },
271
- React.createElement(HiIconBuilder, { icon: optionSelected.icon, className: classes.labelIcon }),
272
- optionSelected.label
272
+ React.createElement(HiIconBuilder, { icon: item.icon, className: classes.labelIcon }),
273
+ item.label
273
274
  );
274
275
  }
275
276
  }
@@ -403,6 +404,7 @@ HiSelect.defaultProps = {
403
404
  hierarchic: false,
404
405
  parentItemSelectable: false,
405
406
  displayAsChip: false,
407
+ dynamic: false,
406
408
  icon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
407
409
  parentIcon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
408
410
  hoverIcon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
@@ -633,9 +635,9 @@ var _initialiseProps = function () {
633
635
  }
634
636
  }
635
637
  this.setState({ hierarchySelected: hiSelected });
636
- onChange(event, valueList);
638
+ onChange(event, valueList, item);
637
639
  } else {
638
- onChange(event, item.id);
640
+ onChange(event, item.id, item);
639
641
  this.handleClose();
640
642
  }
641
643
  };
@@ -702,6 +704,12 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
702
704
  * Option permettant d'afficher les sélection sous forme de Chip.
703
705
  */
704
706
  displayAsChip: PropTypes.bool,
707
+ /**
708
+ * Option permettant de définir si les options du select sont dynamiques.
709
+ * Si les options du select sont initialisées à vide, alors ce sera mis à true
710
+ * automatiquement.
711
+ */
712
+ dynamic: PropTypes.bool.isRequired,
705
713
  /**
706
714
  * Applique le style error
707
715
  */
@@ -102,7 +102,7 @@ class HiSelectableList extends React.PureComponent {
102
102
  hoverIcon: hoverIcon,
103
103
  checkedIcon: checkedIcon,
104
104
  checkbox: checkbox,
105
- level: parents.length,
105
+ level: item.level ? item.level : parents.length,
106
106
  disabled: disabledIds ? disabledIds.includes(item.id) : false
107
107
  }, others));
108
108
  }
@@ -313,7 +313,7 @@ class HiSelectableListItem extends React.Component {
313
313
 
314
314
  if (leftPadding) {
315
315
  paddingLeft = leftPadding;
316
- } else if (!hierarchic) {
316
+ } else if (!hierarchic && level === 0) {
317
317
  // Si pas de hiérarchie et sans checkbox, padding de 8px
318
318
  if (!effectiveCheckbox) {
319
319
  paddingLeft = 8;
@@ -330,9 +330,9 @@ class HiSelectableListItem extends React.Component {
330
330
  }
331
331
  } else if (level > 0) {
332
332
  if (effectiveCheckbox) {
333
- paddingLeft = 16 * (level - 1);
334
- } else {
335
333
  paddingLeft = 16 * level;
334
+ } else {
335
+ paddingLeft = 16 * (level + 1);
336
336
  }
337
337
  } else if (!effectiveCheckbox) {
338
338
  if (item.id === '_all') {
@@ -241,10 +241,11 @@ export default class BodyCellBuilder extends React.Component {
241
241
  default:
242
242
  cellElement = React.createElement(CellText, {
243
243
  ukey: ukey,
244
- value: data.value,
244
+ value: data.label ? data.label : data.value,
245
245
  ellipsis: ellipsis,
246
246
  view: view,
247
- sticky: sticky
247
+ sticky: sticky,
248
+ color: data.color
248
249
  });
249
250
  break;
250
251
  }
@@ -3,9 +3,6 @@ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import Tooltip from '../../Tooltip';
5
5
  import HiColoredLabel from '../../HiColoredLabel';
6
- import withStyles from '../../styles/withStyles';
7
-
8
- export const styles = theme => ({});
9
6
 
10
7
  /**
11
8
  * Cette cellule permet d'afficher le nom d'un compte sous la forme d'un label coloré.
@@ -42,4 +39,4 @@ CellAccount.propTypes = process.env.NODE_ENV !== "production" ? {
42
39
  */
43
40
  value: PropTypes.string.isRequired
44
41
  } : {};
45
- export default withStyles(styles, { name: 'HmuiCellAccount' })(CellAccount);
42
+ export default CellAccount;
@@ -3,12 +3,11 @@ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import moment from 'moment';
5
5
  import 'moment/locale/fr';
6
-
7
6
  import withStyles from '../../styles/withStyles';
8
7
  import Tooltip from '../../Tooltip';
9
8
  import * as cst from '../constants';
10
9
 
11
- export const styles = theme => ({
10
+ export const styles = {
12
11
  rightEllipsisSpan: {
13
12
  display: 'inline-block',
14
13
  overflow: 'hidden',
@@ -16,7 +15,7 @@ export const styles = theme => ({
16
15
  whiteSpace: 'pre',
17
16
  width: '100%'
18
17
  }
19
- });
18
+ };
20
19
 
21
20
  /**
22
21
  * Cette cellule permet d'afficher une date en fonction de la locale de l'utilisateur
@@ -36,14 +35,14 @@ class CellDate extends React.Component {
36
35
  const { classes, displayTime, value, locale, view, formatShort } = this.props;
37
36
 
38
37
  const date = moment(value);
39
- moment.locale(locale);
38
+ date.locale(locale);
40
39
 
41
- const titleValue = displayTime ? date.format(this.formatLong) : date.format(this.formatLong.replace('HH:mm:ss', ''));
40
+ const titleValue = displayTime ? date.format(this.formatLong) : date.format(this.formatLong.replace(' HH:mm:ss', ''));
42
41
  let displayedValue = titleValue;
43
42
  if (view === cst.VIEWS.SMALL) {
44
- displayedValue = displayTime ? date.format(formatShort.replace('YYYY', 'YY') + ' HH:mm:ss') : date.format(formatShort.replace('YYYY', 'YY'));
43
+ displayedValue = displayTime ? date.format(`${formatShort.replace('YYYY', 'YY')} HH:mm:ss`) : date.format(formatShort.replace('YYYY', 'YY'));
45
44
  } else if (view === cst.VIEWS.MEDIUM) {
46
- displayedValue = displayTime ? date.format(formatShort + ' HH:mm:ss') : date.format(formatShort);
45
+ displayedValue = displayTime ? date.format(`${formatShort} HH:mm:ss`) : date.format(formatShort);
47
46
  }
48
47
 
49
48
  if (view === cst.VIEWS.LARGE) {
@@ -90,6 +89,11 @@ CellDate.propTypes = process.env.NODE_ENV !== "production" ? {
90
89
  * Locale moment
91
90
  */
92
91
  locale: PropTypes.string,
92
+ /**
93
+ * True si la colonne est la première colonne et
94
+ * doit avoir un comportement "sticky" lors du scroll horizontal
95
+ */
96
+ sticky: PropTypes.bool,
93
97
  /**
94
98
  * Date as string
95
99
  */
@@ -1,12 +1,13 @@
1
1
  import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
-
5
4
  import Tooltip from '../../Tooltip';
6
5
  import withStyles from '../../styles/withStyles';
7
6
  import * as cst from '../constants';
7
+ import HiColoredLabel from '../../HiColoredLabel';
8
+ import { getContrastedTextColor } from '../../styles/colorManipulator';
8
9
 
9
- export const styles = theme => ({
10
+ export const styles = {
10
11
  leftEllipsisSpan: {
11
12
  display: 'inline-block',
12
13
  overflow: 'hidden',
@@ -18,22 +19,17 @@ export const styles = theme => ({
18
19
  display: 'inline-block',
19
20
  overflow: 'hidden',
20
21
  textOverflow: 'ellipsis',
21
- whiteSpace: 'pre',
22
- width: '100%'
22
+ whiteSpace: 'pre'
23
23
  },
24
24
  noEllipsisSpan: {
25
25
  display: 'inline-block',
26
26
  overflow: 'hidden',
27
27
  whiteSpace: 'pre'
28
28
  }
29
- });
29
+ };
30
30
 
31
31
  class CellText extends React.Component {
32
32
 
33
- shouldComponentUpdate(nextProps, nextState) {
34
- return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
35
- }
36
-
37
33
  constructor(props) {
38
34
  super(props);
39
35
 
@@ -48,6 +44,10 @@ class CellText extends React.Component {
48
44
  this.buildEllipsis();
49
45
  }
50
46
 
47
+ shouldComponentUpdate(nextProps, nextState) {
48
+ return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
49
+ }
50
+
51
51
  componentDidUpdate() {
52
52
  this.buildEllipsis();
53
53
  }
@@ -73,8 +73,9 @@ class CellText extends React.Component {
73
73
 
74
74
  /**
75
75
  * Calcul l'espace pris par les 2 spans (les 2 moitiés du texte),
76
- * si ils dépassent la largeur de la cellule, diminue d'autant et proportionnellement chaque span
77
- * ajoute l'ellipse à gauche de la deuxième moitié du texte.
76
+ * si ils dépassent la largeur de la cellule :
77
+ * - diminue d'autant et proportionnellement chaque span
78
+ * - ajoute l'ellipse à gauche de la deuxième moitié du texte.
78
79
  */
79
80
  if (this.props.ellipsis === cst.ELLIPSIS_MIDDLE) {
80
81
  if (this.cellText !== null) {
@@ -94,13 +95,13 @@ class CellText extends React.Component {
94
95
  }
95
96
 
96
97
  render() {
97
- const { classes, value, ellipsis } = this.props;
98
+ const { classes, value, ellipsis, color } = this.props;
98
99
 
99
100
  let start,
100
101
  end,
101
102
  valueElement = '';
102
103
 
103
- let valueString = value.toString();
104
+ const valueString = value.toString();
104
105
 
105
106
  switch (ellipsis) {
106
107
  case cst.ELLIPSIS_AFTER_FIRST_WORD:
@@ -113,13 +114,19 @@ class CellText extends React.Component {
113
114
  }
114
115
  valueElement = React.createElement(
115
116
  'div',
116
- { ref: div => {
117
+ {
118
+ ref: div => {
117
119
  this.cellText = div;
118
- } },
120
+ },
121
+ style: {
122
+ backgroundColor: color || 'inherit',
123
+ color: color ? getContrastedTextColor(color, '#4C4C4C', '#FFF') : 'inherit'
124
+ }
125
+ },
119
126
  React.createElement(
120
127
  'span',
121
128
  { className: classes.rightEllipsisSpan },
122
- start + ' '
129
+ `${start} `
123
130
  ),
124
131
  React.createElement(
125
132
  'span',
@@ -135,9 +142,15 @@ class CellText extends React.Component {
135
142
  end = valueString.substr(Math.round(valueString.length / 2));
136
143
  valueElement = React.createElement(
137
144
  'div',
138
- { ref: div => {
145
+ {
146
+ ref: div => {
139
147
  this.cellText = div;
140
- } },
148
+ },
149
+ style: {
150
+ backgroundColor: color || 'inherit',
151
+ color: color ? getContrastedTextColor(color, '#4C4C4C', '#FFF') : 'inherit'
152
+ }
153
+ },
141
154
  React.createElement(
142
155
  'span',
143
156
  { className: classes.noEllipsisSpan },
@@ -152,7 +165,11 @@ class CellText extends React.Component {
152
165
  break;
153
166
 
154
167
  case cst.ELLIPSIS_LEFT:
155
- valueElement = React.createElement(
168
+ valueElement = color ? React.createElement(HiColoredLabel, {
169
+ className: classes.leftEllipsisSpan,
170
+ label: valueString,
171
+ color: color
172
+ }) : React.createElement(
156
173
  'div',
157
174
  { className: classes.leftEllipsisSpan, style: { width: '100%' } },
158
175
  valueString
@@ -161,7 +178,11 @@ class CellText extends React.Component {
161
178
 
162
179
  case cst.ELLIPSIS_RIGHT:
163
180
  default:
164
- valueElement = React.createElement(
181
+ valueElement = color ? React.createElement(HiColoredLabel, {
182
+ className: classes.rightEllipsisSpan,
183
+ label: valueString,
184
+ color: color
185
+ }) : React.createElement(
165
186
  'div',
166
187
  { className: classes.rightEllipsisSpan, style: { width: '100%' } },
167
188
  valueString
@@ -183,12 +204,16 @@ CellText.propTypes = process.env.NODE_ENV !== "production" ? {
183
204
  */
184
205
  classes: PropTypes.object,
185
206
  /**
186
- * Valeur à afficher
207
+ * Couleur du text & du background
187
208
  */
188
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
209
+ color: PropTypes.string,
189
210
  /**
190
211
  * Ellipsis
191
212
  */
192
- ellipsis: PropTypes.oneOf(['left', 'right', 'middle', 'name', 'after-first-word'])
213
+ ellipsis: PropTypes.oneOf(['left', 'right', 'middle', 'name', 'after-first-word']),
214
+ /**
215
+ * Valeur à afficher
216
+ */
217
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
193
218
  } : {};
194
219
  export default withStyles(styles, { name: 'HmuiCellText' })(CellText);
@@ -72,7 +72,7 @@ export const styles = theme => ({
72
72
 
73
73
  export const ONCHANGE_ERROR_MESSAGE = 'Vous devez saisir la propriété "onChange" pour les lignes "selectable"';
74
74
 
75
- class HiStickyRow extends React.PureComponent {
75
+ class HiStickyRow extends React.Component {
76
76
 
77
77
  shouldComponentUpdate(nextProps, nextState) {
78
78
  return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
@@ -1,3 +1,5 @@
1
+ messageAlert;
2
+
1
3
  import React from 'react';
2
4
  import pure from 'recompose/pure';
3
5
  import SvgIcon from '../SvgIcon';
@@ -0,0 +1,15 @@
1
+ import _extends from "babel-runtime/helpers/extends";
2
+ import React from "react";
3
+
4
+ var _ref = React.createElement("path", {
5
+ d: "M486 108H378V27a27 27 0 0 0-27-27H189a27 27 0 0 0-27 27v81H54a54.06 54.06 0 0 0-54 54v270a54.06 54.06 0 0 0 54 54h432a54.06 54.06 0 0 0 54-54V162a54.06 54.06 0 0 0-54-54zM216 54h108v54H216zm162 270h-81v81h-54v-81h-81v-54h81v-81h54v81h81z",
6
+ fill: "#767676"
7
+ });
8
+
9
+ const HiBriefcaseRescue = props => React.createElement(
10
+ "svg",
11
+ _extends({ viewBox: "0 0 540 486" }, props),
12
+ _ref
13
+ );
14
+
15
+ export default HiBriefcaseRescue;
@@ -8,4 +8,5 @@ export { default as HiRoute } from './HiRoute';
8
8
  export { default as HiSettlement } from './HiSettlement';
9
9
  export { default as HiTransaction } from './HiTransaction';
10
10
  export { default as HiUser } from './HiUser';
11
- export { default as HiWidget } from './HiWidget';
11
+ export { default as HiWidget } from './HiWidget';
12
+ export { default as HiBriefcaseRescue } from './HiBriefcaseRescue';
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Material-UI v1.0.0-beta.25
1
+ /** @license Material-UI v1.0.0-beta.26
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 Material-UI v1.0.0-beta.25
1
+ /** @license Material-UI v1.0.0-beta.26
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": "1.0.0-beta.25",
5
+ "version": "1.0.0-beta.26",
6
6
  "description": "HiPay Material-UI Style Guide - React components that implement Google's Material Design from Material-UI.",
7
7
  "main": "./index.js",
8
8
  "repository": {
@@ -23,6 +23,7 @@
23
23
  "babel-runtime": "^6.26.0",
24
24
  "brcast": "^3.0.1",
25
25
  "classnames": "^2.2.5",
26
+ "commitizen": "^2.10.1",
26
27
  "deepmerge": "^2.0.1",
27
28
  "dom-helpers": "^3.2.1",
28
29
  "hoist-non-react-statics": "^2.5.0",
@@ -18,6 +18,8 @@ var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
+ messageAlert;
22
+
21
23
  /**
22
24
  * @ignore - internal component.
23
25
  */
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _extends2 = require("babel-runtime/helpers/extends");
8
+
9
+ var _extends3 = _interopRequireDefault(_extends2);
10
+
11
+ var _react = require("react");
12
+
13
+ var _react2 = _interopRequireDefault(_react);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ var _ref = _react2.default.createElement("path", {
18
+ d: "M486 108H378V27a27 27 0 0 0-27-27H189a27 27 0 0 0-27 27v81H54a54.06 54.06 0 0 0-54 54v270a54.06 54.06 0 0 0 54 54h432a54.06 54.06 0 0 0 54-54V162a54.06 54.06 0 0 0-54-54zM216 54h108v54H216zm162 270h-81v81h-54v-81h-81v-54h81v-81h54v81h81z",
19
+ fill: "#767676"
20
+ });
21
+
22
+ var HiBriefcaseRescue = function HiBriefcaseRescue(props) {
23
+ return _react2.default.createElement(
24
+ "svg",
25
+ (0, _extends3.default)({ viewBox: "0 0 540 486" }, props),
26
+ _ref
27
+ );
28
+ };
29
+
30
+ exports.default = HiBriefcaseRescue;
@@ -103,4 +103,13 @@ Object.defineProperty(exports, 'HiWidget', {
103
103
  }
104
104
  });
105
105
 
106
+ var _HiBriefcaseRescue = require('./HiBriefcaseRescue');
107
+
108
+ Object.defineProperty(exports, 'HiBriefcaseRescue', {
109
+ enumerable: true,
110
+ get: function get() {
111
+ return _interopRequireDefault(_HiBriefcaseRescue).default;
112
+ }
113
+ });
114
+
106
115
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }