@hipay/hipay-material-ui 3.7.4 → 3.7.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -185,6 +185,18 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
185
185
  };
186
186
  };
187
187
 
188
+ _this.findRecursively = function (arr, id) {
189
+ for (var i = 0; i < arr.length; i++) {
190
+ if (arr[i].id === id) {
191
+ return arr[i];
192
+ } else if (arr[i].children && arr[i].children.length) {
193
+ var found = _this.findRecursively(arr[i].children, id);
194
+
195
+ if (found) return found;
196
+ }
197
+ }
198
+ };
199
+
188
200
  _this.buildInputValue = function (options) {
189
201
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
190
202
  var loading = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -204,9 +216,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
204
216
  } else if (value.length > 1) {
205
217
  inputValue = translations.n_items_selected.replace('%s', value.length);
206
218
  } else if (value.length === 1) {
207
- var item = options.find(function (o) {
208
- return o.id === value[0];
209
- });
219
+ var item = _this.findRecursively(options, value[0]);
210
220
 
211
221
  if (item === undefined) {
212
222
  inputValue = translations.one_item_selected;
@@ -282,7 +292,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
282
292
  }
283
293
  };
284
294
 
285
- _this.handleClick = function () {
295
+ _this.handleClick = function (event) {
286
296
  if (_this.state.open) {
287
297
  _this.handleClose();
288
298
  } else if (_this.props.alert && !_this.state.alertOpen) {
@@ -368,7 +378,9 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
368
378
  }
369
379
 
370
380
  if (_this.inputEl) {
371
- _this.inputEl.focus();
381
+ setTimeout(function () {
382
+ _this.inputEl.focus();
383
+ }, 100);
372
384
  }
373
385
  };
374
386
 
@@ -396,7 +408,16 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
396
408
  var key = (0, _keycode.default)(event);
397
409
 
398
410
  if (!_this.state.alertOpen) {
399
- if (key === 'esc' && _this.state.open) {
411
+ if (event.target === _this.inputEl && _this.state.open && key === 'down') {
412
+ // Focus on list 1st item
413
+ event.stopPropagation();
414
+ event.preventDefault();
415
+ var firstLi = document.querySelector("#".concat(_this.props.id, " + div ul > li"));
416
+
417
+ if (!!firstLi) {
418
+ firstLi.focus();
419
+ }
420
+ } else if (key === 'esc' && _this.state.open) {
400
421
  event.stopPropagation();
401
422
  event.preventDefault();
402
423
 
@@ -409,10 +430,32 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
409
430
  }
410
431
  } else if (key === 'space' && event.target !== _this.searchField) {
411
432
  event.preventDefault();
433
+ } else if (key === 'tab' && (_this.state.open || _this.state.alertOpen)) {
434
+ event.stopPropagation();
412
435
 
413
- _this.handleClick();
414
- } else if (key === 'tab') {
415
436
  _this.handleClose();
437
+ } else if (key === "down" && event.target.id.includes("_subheader")) {
438
+ // Focus on parent, next item is child
439
+ if (document.querySelector("#group-".concat(event.target.id, " li:nth-child(1)"))) {
440
+ document.querySelector("#group-".concat(event.target.id, " li:nth-child(1)")).focus();
441
+ }
442
+ } else if (key === "down" && !event.target.nextSibling) {
443
+ var _document$getElementB, _document$getElementB2;
444
+
445
+ // Focus on parent, next item is child
446
+ if ((_document$getElementB = document.getElementById(event.target.dataset.group)) === null || _document$getElementB === void 0 ? void 0 : (_document$getElementB2 = _document$getElementB.nextSibling) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.nextSibling) {
447
+ document.getElementById(event.target.dataset.group).nextSibling.nextSibling.focus();
448
+ }
449
+ } else if (key === "up") {
450
+ if (event.target.previousSibling === null && !!event.target.dataset.group) {
451
+ // Previous item is parent item
452
+ document.getElementById(event.target.dataset.group).focus();
453
+ } else if (!!event.target.previousSibling && !event.target.dataset.group) {
454
+ // On parent, go to previous (last) child
455
+ if (event.target.previousSibling.querySelector("li:last-child")) {
456
+ event.target.previousSibling.querySelector("li:last-child").focus();
457
+ }
458
+ }
416
459
  }
417
460
  }
418
461
  };
@@ -448,9 +491,11 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
448
491
  value = _this$props2.value;
449
492
 
450
493
  if (!multiple) {
451
- // single value
452
- _this.handleClose();
453
-
494
+ // This is a fix to prevent select open after select => TODO improve ?
495
+ setTimeout(function () {
496
+ // single value
497
+ _this.handleClose();
498
+ }, 1);
454
499
  onChange(event, item.id, item);
455
500
  } else if (hasAll && item.id === '_all') {
456
501
  if (value.length === options.length) {
@@ -13,8 +13,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/es
13
13
 
14
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
15
15
 
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
17
-
18
16
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
19
17
 
20
18
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
@@ -167,19 +165,22 @@ var HiSelectInput = /*#__PURE__*/function (_React$PureComponent) {
167
165
 
168
166
  var _super = _createSuper(HiSelectInput);
169
167
 
170
- function HiSelectInput(props) {
168
+ function HiSelectInput() {
171
169
  var _this;
172
170
 
173
171
  (0, _classCallCheck2.default)(this, HiSelectInput);
174
- _this = _super.call(this, props);
172
+
173
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
174
+ args[_key] = arguments[_key];
175
+ }
176
+
177
+ _this = _super.call.apply(_super, [this].concat(args));
175
178
 
176
179
  _this.handleKeyDown = function (event) {
177
180
  var key = (0, _keycode.default)(event);
178
181
 
179
182
  if (_this.props.onKeyDown) {
180
183
  _this.props.onKeyDown(event);
181
- } else if (key === 'down' || key === 'up') {
182
- _this.props.onClick();
183
184
  } else if (key === 'enter' && _this.props.onSubmit) {
184
185
  event.preventDefault();
185
186
 
@@ -234,11 +235,6 @@ var HiSelectInput = /*#__PURE__*/function (_React$PureComponent) {
234
235
  }
235
236
  };
236
237
 
237
- _this.handleKeyDown = _this.handleKeyDown.bind((0, _assertThisInitialized2.default)(_this));
238
- _this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)(_this));
239
- _this.handleBlur = _this.handleBlur.bind((0, _assertThisInitialized2.default)(_this));
240
- _this.ref = _this.ref.bind((0, _assertThisInitialized2.default)(_this));
241
- _this.handleReset = _this.handleReset.bind((0, _assertThisInitialized2.default)(_this));
242
238
  return _this;
243
239
  }
244
240
 
@@ -27,6 +27,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/es
27
27
 
28
28
  var _react = _interopRequireDefault(require("react"));
29
29
 
30
+ var _Collapse = _interopRequireDefault(require("@material-ui/core/Collapse"));
31
+
30
32
  var _List = _interopRequireDefault(require("@material-ui/core/List"));
31
33
 
32
34
  var _styles = require("@material-ui/core/styles");
@@ -54,9 +56,32 @@ var styles = function styles(theme) {
54
56
  suggestionFocus: {
55
57
  backgroundColor: theme.palette.action.hover,
56
58
  fontWeight: theme.typography.fontWeightMedium
59
+ },
60
+ parentRoot: {
61
+ "&:focus": {
62
+ backgroundColor: theme.palette.action.hover,
63
+ fontWeight: theme.typography.fontWeightMedium
64
+ }
57
65
  }
58
66
  };
59
67
  };
68
+
69
+ exports.styles = styles;
70
+
71
+ var findSelectedItemParent = function findSelectedItemParent(arr, id) {
72
+ if (id) {
73
+ var res = arr.find(function (p) {
74
+ var _p$children;
75
+
76
+ return (_p$children = p.children) === null || _p$children === void 0 ? void 0 : _p$children.map(function (o) {
77
+ return o.id;
78
+ }).includes(id);
79
+ });
80
+ if (res) return res.id;
81
+ }
82
+
83
+ return null;
84
+ };
60
85
  /**
61
86
  * Construit une liste d'item sélectionnable (avec checkbox)
62
87
  * - la navigation au clavier est gérée par l'event KeyDown
@@ -64,27 +89,28 @@ var styles = function styles(theme) {
64
89
  */
65
90
 
66
91
 
67
- exports.styles = styles;
68
-
69
92
  var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
70
93
  (0, _inherits2.default)(HiSelectableList, _React$PureComponent);
71
94
 
72
95
  var _super = _createSuper(HiSelectableList);
73
96
 
74
- function HiSelectableList() {
97
+ function HiSelectableList(props) {
75
98
  var _this;
76
99
 
77
100
  (0, _classCallCheck2.default)(this, HiSelectableList);
78
-
79
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
80
- args[_key] = arguments[_key];
81
- }
82
-
83
- _this = _super.call.apply(_super, [this].concat(args));
101
+ _this = _super.call(this, props);
84
102
 
85
103
  _this.handleSelect = function (item) {
86
104
  return function (event) {
87
- _this.props.onSelect(event, item);
105
+ if (_this.props.collapseParent && item.children) {
106
+ _this.setState(function (prevState) {
107
+ return {
108
+ openedParent: prevState.openedParent === item.id ? null : item.id
109
+ };
110
+ });
111
+ } else {
112
+ _this.props.onSelect(event, item);
113
+ }
88
114
  };
89
115
  };
90
116
 
@@ -111,6 +137,7 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
111
137
 
112
138
  _this.buildRecursiveListItem = function (item, index) {
113
139
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
140
+ var group = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
114
141
  var _this$props = _this.props,
115
142
  checkedIcon = _this$props.checkedIcon,
116
143
  disabled = _this$props.disabled,
@@ -125,7 +152,8 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
125
152
  onKeyUp = _this$props.onKeyUp,
126
153
  suggestionFocusIndex = _this$props.suggestionFocusIndex,
127
154
  classes = _this$props.classes,
128
- others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp", "suggestionFocusIndex", "classes"]);
155
+ noPadding = _this$props.noPadding,
156
+ others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp", "suggestionFocusIndex", "classes", "noPadding"]);
129
157
 
130
158
  if (sort && item.children) {
131
159
  item.children.sort(_this.compareItem);
@@ -148,6 +176,12 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
148
176
  }
149
177
  }));
150
178
 
179
+ var handleKeyDown = function handleKeyDown() {
180
+ if (onKeyDown) {
181
+ onKeyDown();
182
+ }
183
+ };
184
+
151
185
  var itemComponent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
152
186
  key: item.id
153
187
  }, /*#__PURE__*/_react.default.createElement(_HiSelectableListItem.default, (0, _extends2.default)({}, others, {
@@ -156,21 +190,34 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
156
190
  hideCheckbox: hideCheckbox,
157
191
  hoverIcon: hoverIcon,
158
192
  icon: icon,
159
- level: level,
193
+ level: noPadding ? 0 : level,
160
194
  onSelect: item.selectable !== false ? _this.handleSelect(item) : undefined,
161
- onKeyDown: item.selectable !== false ? onKeyDown : undefined,
195
+ onKeyDown: item.selectable !== false ? handleKeyDown : undefined,
162
196
  onKeyUp: onKeyUp,
163
197
  selected: selectedItemIdList.includes(item.id) // item props override upper props (disabled, hideCheckbox, icon, level...)
164
198
  ,
165
199
  item: item,
166
200
  classes: {
201
+ root: classes.parentRoot,
167
202
  listItem: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.suggestionFocus, index === suggestionFocusIndex))
168
- }
169
- }, item)), item.children && item.children.length > 0 && item.children.filter(function (subItem) {
203
+ },
204
+ collapseHeader: _this.props.collapseParent && item.children && item.children.length > 0,
205
+ opened: _this.state.openedParent === item.id,
206
+ group: group
207
+ }, item)), item.children && item.children.length > 0 && (_this.props.collapseParent && level === 0 ? /*#__PURE__*/_react.default.createElement(_Collapse.default, {
208
+ id: "group-".concat(item.id),
209
+ in: _this.state.openedParent === item.id,
210
+ timeout: "auto",
211
+ unmountOnExit: true
212
+ }, item.children.filter(function (subItem) {
213
+ return !(subItem.displayed === false);
214
+ }).map(function (subItem) {
215
+ return _this.buildRecursiveListItem(subItem, index, level + 1, item.id);
216
+ })) : item.children.filter(function (subItem) {
170
217
  return !(subItem.displayed === false);
171
218
  }).map(function (subItem) {
172
219
  return _this.buildRecursiveListItem(subItem, index, level + 1);
173
- }));
220
+ })));
174
221
 
175
222
  if (lazy) {
176
223
  return /*#__PURE__*/_react.default.createElement(_reactLazyload.default, {
@@ -208,6 +255,19 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
208
255
  return (0, _helpers.foldAccents)(a.label.toString().toLowerCase()) > (0, _helpers.foldAccents)(b.label.toString().toLowerCase()) ? 1 : -1;
209
256
  };
210
257
 
258
+ var openedParent;
259
+
260
+ if (props.collapseParent) {
261
+ if (props.selectedItemIdList[0]) {
262
+ openedParent = findSelectedItemParent(props.itemList, props.selectedItemIdList[0]);
263
+ } else {
264
+ openedParent = props.itemList[0].id;
265
+ }
266
+ }
267
+
268
+ _this.state = {
269
+ openedParent: openedParent
270
+ };
211
271
  return _this;
212
272
  }
213
273
 
@@ -289,7 +349,8 @@ HiSelectableList.defaultProps = {
289
349
  lazy: true,
290
350
  selectedItemIdList: [],
291
351
  sort: false,
292
- sortAppendList: ['_all']
352
+ sortAppendList: ['_all'],
353
+ collapseParent: false
293
354
  };
294
355
 
295
356
  var _default = (0, _styles.withStyles)(styles, {
@@ -39,6 +39,10 @@ var _HiLoader = _interopRequireDefault(require("../HiLoader"));
39
39
 
40
40
  var _helpers = require("../utils/helpers");
41
41
 
42
+ var _ArrowDropDown = _interopRequireDefault(require("@material-ui/icons/ArrowDropDown"));
43
+
44
+ var _ArrowRight = _interopRequireDefault(require("@material-ui/icons/ArrowRight"));
45
+
42
46
  var useItemLabelStyles = (0, _styles.makeStyles)(function (theme) {
43
47
  return {
44
48
  label: {
@@ -57,7 +61,8 @@ function ItemLabel(props) {
57
61
  var color = props.color,
58
62
  label = props.label,
59
63
  labelHighlight = props.labelHighlight,
60
- selected = props.selected;
64
+ selected = props.selected,
65
+ title = props.title;
61
66
  var classes = useItemLabelStyles(props);
62
67
 
63
68
  if (labelHighlight) {
@@ -90,7 +95,7 @@ function ItemLabel(props) {
90
95
 
91
96
  return /*#__PURE__*/_react.default.createElement("div", {
92
97
  className: classes.label,
93
- title: label
98
+ title: title || label
94
99
  }, label);
95
100
  }
96
101
 
@@ -123,16 +128,20 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
123
128
  }
124
129
  },
125
130
  '&:focus': {
126
- '&:not($disabled):not($pinned)': {
131
+ '&:not($disabled):not($pinned):not($collapseHeader)': {
127
132
  backgroundColor: theme.palette.action.hover
128
133
  },
129
134
  outline: 'none'
135
+ },
136
+ '&$collapseHeader': {
137
+ minHeight: 32,
138
+ lineHeight: "32px"
130
139
  }
131
140
  },
132
141
  listItemWithoutSecondaryInline: {},
133
142
  listItemInlineWithInfoWithoutSecondary: {},
134
143
  listItemHover: {
135
- '&:hover:not($disabled):not($pinned)': {
144
+ '&:hover:not($disabled):not($pinned):not($collapseHeader)': {
136
145
  backgroundColor: theme.palette.action.hover,
137
146
  fontWeight: theme.typography.fontWeightMedium
138
147
  }
@@ -154,6 +163,11 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
154
163
  display: 'inherit',
155
164
  backgroundColor: theme.palette.background3
156
165
  },
166
+ collapseHeader: {
167
+ zIndex: 1,
168
+ display: 'inherit',
169
+ backgroundColor: theme.palette.background3
170
+ },
157
171
  thin: {
158
172
  fontWeight: theme.typography.fontWeightLight
159
173
  },
@@ -241,7 +255,12 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
241
255
  },
242
256
  infosInlineWithoutSecondary: {},
243
257
  infosWithSecondaryInline: {},
244
- infosWithoutSecondaryInline: {}
258
+ infosWithoutSecondaryInline: {},
259
+ rightIcon: {
260
+ position: "absolute",
261
+ right: 12,
262
+ top: 8
263
+ }
245
264
  };
246
265
  });
247
266
  /**
@@ -251,6 +270,10 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
251
270
 
252
271
  exports.useStyles = useStyles;
253
272
 
273
+ var _ref = /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, null);
274
+
275
+ var _ref2 = /*#__PURE__*/_react.default.createElement(_ArrowRight.default, null);
276
+
254
277
  function HiSelectableListItem(props) {
255
278
  var _classNames, _classNames3, _classNames4;
256
279
 
@@ -273,22 +296,27 @@ function HiSelectableListItem(props) {
273
296
  labelHighlight = props.labelHighlight,
274
297
  paddingLeft = props.paddingLeft,
275
298
  pinned = props.pinned,
299
+ collapseHeader = props.collapseHeader,
276
300
  secondaryInline = props.secondaryInline,
277
301
  secondaryLabel = props.secondaryLabel,
278
302
  thin = props.thin,
303
+ title = props.title,
279
304
  type = props.type,
280
305
  color = props.color,
281
- item = props.item;
306
+ item = props.item,
307
+ opened = props.opened,
308
+ group = props.group;
282
309
  var classes = useStyles(props);
283
310
  var ref = (0, _react.useRef)(null);
284
311
  var isHovering = !!hoverIcon ? (0, _reactUse.useHoverDirty)(ref) : false;
285
- var onKeyDown = (0, _react.useCallback)(function (_ref) {
286
- var code = _ref.code;
287
-
288
- if (code === 'Space' || code === 'Enter') {
312
+ var onKeyDown = (0, _react.useCallback)(function (event) {
313
+ if (event.code === 'Space' || event.code === 'Enter') {
289
314
  event.preventDefault();
290
315
  event.stopPropagation();
291
- if (item) onSelect(null, item);
316
+
317
+ if (item) {
318
+ onSelect(event, item);
319
+ }
292
320
  }
293
321
  }, [item]);
294
322
  (0, _reactUse.useEvent)('keydown', onKeyDown, ref.current); // Return simple loader list item
@@ -309,7 +337,7 @@ function HiSelectableListItem(props) {
309
337
  displayedIcon = icon;
310
338
  }
311
339
 
312
- var ListItemComponentName = pinned ? _ListSubheader.default : _ListItem.default;
340
+ var ListItemComponentName = pinned || collapseHeader ? _ListSubheader.default : _ListItem.default;
313
341
  var itemIcon;
314
342
 
315
343
  if (displayedIcon) {
@@ -336,14 +364,15 @@ function HiSelectableListItem(props) {
336
364
  classes: {
337
365
  root: classes.root
338
366
  },
339
- className: (0, _classnames.default)(classes.listItem, classes.listItemHover, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.disabled, disabled), (0, _defineProperty2.default)(_classNames, classes.selected, selected), (0, _defineProperty2.default)(_classNames, classes.thin, thin), (0, _defineProperty2.default)(_classNames, classes.pinned, pinned), (0, _defineProperty2.default)(_classNames, classes.inline, secondaryInline), (0, _defineProperty2.default)(_classNames, classes.listItemWithoutSecondaryInline, !secondaryInline), (0, _defineProperty2.default)(_classNames, classes.listItemInlineWithInfoWithoutSecondary, secondaryInline && info && !secondaryLabel), _classNames)),
367
+ className: (0, _classnames.default)(classes.listItem, classes.listItemHover, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.disabled, disabled), (0, _defineProperty2.default)(_classNames, classes.selected, selected), (0, _defineProperty2.default)(_classNames, classes.thin, thin), (0, _defineProperty2.default)(_classNames, classes.pinned, pinned), (0, _defineProperty2.default)(_classNames, classes.collapseHeader, collapseHeader), (0, _defineProperty2.default)(_classNames, classes.inline, secondaryInline), (0, _defineProperty2.default)(_classNames, classes.listItemWithoutSecondaryInline, !secondaryInline), (0, _defineProperty2.default)(_classNames, classes.listItemInlineWithInfoWithoutSecondary, secondaryInline && typeof info !== "undefined" && !secondaryLabel), _classNames)),
340
368
  disabled: disabled,
341
369
  onClick: !disabled ? onSelect : undefined,
342
370
  style: {
343
371
  paddingLeft: "".concat(paddingLeft + level * 32, "px")
344
- }
372
+ },
373
+ "data-group": group
345
374
  }, /*#__PURE__*/_react.default.createElement("div", {
346
- className: (0, _classnames.default)(classes.labelContent, (0, _defineProperty2.default)({}, classes.labelWithoutSecondaryInline, !secondaryInline || !secondaryLabel && !info))
375
+ className: (0, _classnames.default)(classes.labelContent, (0, _defineProperty2.default)({}, classes.labelWithoutSecondaryInline, !secondaryInline || !secondaryLabel && typeof info === "undefined"))
347
376
  }, !hideCheckbox && !pinned && /*#__PURE__*/_react.default.createElement(_HiCheckbox.default, {
348
377
  tabIndex: 0,
349
378
  classes: {
@@ -374,12 +403,15 @@ function HiSelectableListItem(props) {
374
403
  color: color,
375
404
  label: label,
376
405
  labelHighlight: labelHighlight,
377
- selected: selected
378
- }))), /*#__PURE__*/_react.default.createElement("div", {
406
+ selected: selected,
407
+ title: title
408
+ }), collapseHeader && /*#__PURE__*/_react.default.createElement("span", {
409
+ className: classes.rightIcon
410
+ }, opened ? _ref : _ref2))), /*#__PURE__*/_react.default.createElement("div", {
379
411
  className: (0, _classnames.default)(classes.infosContent, (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, classes.infosWithoutSecondaryInline, !secondaryInline), (0, _defineProperty2.default)(_classNames4, classes.infosWithSecondaryInline, !secondaryInline), (0, _defineProperty2.default)(_classNames4, classes.infosInlineWithoutSecondary, secondaryInline && !secondaryLabel), _classNames4))
380
412
  }, !!secondaryLabel && /*#__PURE__*/_react.default.createElement("div", {
381
413
  className: (0, _classnames.default)(classes.secondaryLabel, (0, _defineProperty2.default)({}, classes.inline, secondaryInline))
382
- }, secondaryLabel), !!info && /*#__PURE__*/_react.default.createElement("span", {
414
+ }, secondaryLabel), typeof info !== "undefined" && /*#__PURE__*/_react.default.createElement("span", {
383
415
  className: (0, _classnames.default)(classes.info)
384
416
  }, info)));
385
417
  }
@@ -396,7 +428,8 @@ HiSelectableListItem.defaultProps = {
396
428
  pinned: false,
397
429
  secondaryInline: true,
398
430
  selected: false,
399
- thin: false
431
+ thin: false,
432
+ opened: false
400
433
  };
401
434
  var _default = HiSelectableListItem;
402
435
  exports.default = _default;
@@ -21,6 +21,8 @@ var _SwitchBase = _interopRequireDefault(require("@material-ui/core/internal/Swi
21
21
 
22
22
  var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
23
23
 
24
+ var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
25
+
24
26
  var _helpers = require("../utils/helpers");
25
27
 
26
28
  var _styles = require("@material-ui/core/styles");
@@ -83,6 +85,9 @@ var styles = function styles(theme) {
83
85
  opacity: theme.palette.type === 'light' ? 0.12 : 0.1
84
86
  }
85
87
  },
88
+ iconNotChecked: {
89
+ color: "#CBCBCB"
90
+ },
86
91
  iconChecked: {},
87
92
  iconCheckedPrimary: {
88
93
  backgroundColor: theme.palette.primary.main,
@@ -165,9 +170,13 @@ function HiSwitch(props) {
165
170
  disabled = props.disabled,
166
171
  other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "checked", "color", "disabled"]);
167
172
  var isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
168
- var iconClass = (0, _classnames.default)(classes.icon, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.iconChecked, checked), (0, _defineProperty2.default)(_classNames, classes.iconCheckedNeutral, !disabled && checked && !isHiColor), (0, _defineProperty2.default)(_classNames, classes["iconChecked".concat((0, _helpers.capitalize)(color))], !disabled && checked && isHiColor), (0, _defineProperty2.default)(_classNames, classes.iconDisabled, disabled), _classNames));
173
+ var iconClass = (0, _classnames.default)(classes.icon, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.iconNotChecked, !checked), (0, _defineProperty2.default)(_classNames, classes.iconChecked, checked), (0, _defineProperty2.default)(_classNames, classes.iconCheckedNeutral, !disabled && checked && !isHiColor), (0, _defineProperty2.default)(_classNames, classes["iconChecked".concat((0, _helpers.capitalize)(color))], !disabled && checked && isHiColor), (0, _defineProperty2.default)(_classNames, classes.iconDisabled, disabled), _classNames));
174
+
175
+ var icon = /*#__PURE__*/_react.default.createElement(_Close.default, {
176
+ className: iconClass
177
+ });
169
178
 
170
- var icon = /*#__PURE__*/_react.default.createElement(_Check.default, {
179
+ var checkedIcon = /*#__PURE__*/_react.default.createElement(_Check.default, {
171
180
  className: iconClass
172
181
  });
173
182
 
@@ -181,7 +190,7 @@ function HiSwitch(props) {
181
190
  checked: isHiColor && !disabled ? classes["checked".concat((0, _helpers.capitalize)(color))] : classes.checkedNeutral,
182
191
  disabled: classes.disabled
183
192
  },
184
- checkedIcon: icon,
193
+ checkedIcon: checkedIcon,
185
194
  checked: checked,
186
195
  disabled: disabled,
187
196
  inputProps: {
@@ -163,6 +163,7 @@ var HiCellBuilder = /*#__PURE__*/function (_React$PureComponent) {
163
163
  });
164
164
 
165
165
  case cst.TYPE_DATE:
166
+ case cst.TYPE_MONTH:
166
167
  return /*#__PURE__*/_react.default.createElement(_CellDate.default, {
167
168
  date: datacell.date,
168
169
  displayTime: datacell.displayTime,
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.ALIGN_RIGHT_TYPES = exports.DEFAULT_PADDING = exports.DEFAULT_VIEWS = exports.DEFAULT_WIDTHS = exports.FRAUD_RESULT_ASK_AUTHENTICATE = exports.FRAUD_RESULT_FORCE_AUTHENTICATE = exports.FRAUD_RESULT_PENDING = exports.FRAUD_RESULT_CHALLENGED = exports.FRAUD_RESULT_BLOCKED = exports.FRAUD_RESULT_ACCEPTED = exports.ELLIPSIS_RIGHT = exports.ELLIPSIS_NAME = exports.ELLIPSIS_MIDDLE = exports.ELLIPSIS_LEFT = exports.ELLIPSIS_AFTER_FIRST_WORD = exports.NO_EVOLUTION = exports.EVOLUTION_DOWN = exports.EVOLUTION_UP = exports.VIEWS = exports.TYPE_PIN_TO_ACTION = exports.TYPE_THIRD_PARTY_SECURITY = exports.TYPE_TEXT = exports.TYPE_COUNTRY = exports.TYPE_STATUS = exports.TYPE_SCORE = exports.TYPE_SENTINEL = exports.TYPE_RATE = exports.TYPE_NUMERIC = exports.TYPE_IMAGE = exports.TYPE_ICON = exports.TYPE_DATE = exports.TYPE_CHECKBOX = exports.TYPE_ADDRESS = exports.TYPE_CUSTOMER_ACCOUNT_NUMBER = exports.TYPE_AMOUNT = exports.TYPE_ACCOUNT_NUMBER = exports.TYPE_ACCOUNT = exports.CELL_HEADER_HEIGHT_DENSE = exports.CELL_HEADER_HEIGHT = exports.CELL_HEIGHT_DENSE = exports.CELL_HEIGHT = exports.NB_ROWS_BACK_TO_TOP = exports.MAX_ROWS = void 0;
8
+ exports.ALIGN_RIGHT_TYPES = exports.DEFAULT_PADDING = exports.DEFAULT_VIEWS = exports.DEFAULT_WIDTHS = exports.FRAUD_RESULT_ASK_AUTHENTICATE = exports.FRAUD_RESULT_FORCE_AUTHENTICATE = exports.FRAUD_RESULT_PENDING = exports.FRAUD_RESULT_CHALLENGED = exports.FRAUD_RESULT_BLOCKED = exports.FRAUD_RESULT_ACCEPTED = exports.ELLIPSIS_RIGHT = exports.ELLIPSIS_NAME = exports.ELLIPSIS_MIDDLE = exports.ELLIPSIS_LEFT = exports.ELLIPSIS_AFTER_FIRST_WORD = exports.NO_EVOLUTION = exports.EVOLUTION_DOWN = exports.EVOLUTION_UP = exports.VIEWS = exports.TYPE_PIN_TO_ACTION = exports.TYPE_THIRD_PARTY_SECURITY = exports.TYPE_TEXT = exports.TYPE_COUNTRY = exports.TYPE_STATUS = exports.TYPE_SCORE = exports.TYPE_SENTINEL = exports.TYPE_RATE = exports.TYPE_NUMERIC = exports.TYPE_MONTH = exports.TYPE_IMAGE = exports.TYPE_ICON = exports.TYPE_DATE = exports.TYPE_CHECKBOX = exports.TYPE_ADDRESS = exports.TYPE_CUSTOMER_ACCOUNT_NUMBER = exports.TYPE_AMOUNT = exports.TYPE_ACCOUNT_NUMBER = exports.TYPE_ACCOUNT = exports.CELL_HEADER_HEIGHT_DENSE = exports.CELL_HEADER_HEIGHT = exports.CELL_HEIGHT_DENSE = exports.CELL_HEIGHT = exports.NB_ROWS_BACK_TO_TOP = exports.MAX_ROWS = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
11
11
 
@@ -53,6 +53,8 @@ var TYPE_ICON = 'icon';
53
53
  exports.TYPE_ICON = TYPE_ICON;
54
54
  var TYPE_IMAGE = 'image';
55
55
  exports.TYPE_IMAGE = TYPE_IMAGE;
56
+ var TYPE_MONTH = 'month';
57
+ exports.TYPE_MONTH = TYPE_MONTH;
56
58
  var TYPE_NUMERIC = 'numeric';
57
59
  exports.TYPE_NUMERIC = TYPE_NUMERIC;
58
60
  var TYPE_RATE = 'rate';
@@ -149,6 +149,12 @@ Object.defineProperty(exports, "HiPriceGrid", {
149
149
  return _HiPriceGrid.default;
150
150
  }
151
151
  });
152
+ Object.defineProperty(exports, "HiPrivate", {
153
+ enumerable: true,
154
+ get: function get() {
155
+ return _HiPrivate.default;
156
+ }
157
+ });
152
158
  Object.defineProperty(exports, "HiRoute", {
153
159
  enumerable: true,
154
160
  get: function get() {
@@ -276,6 +282,8 @@ var _HiPermission = _interopRequireDefault(require("./HiPermission"));
276
282
 
277
283
  var _HiPriceGrid = _interopRequireDefault(require("./HiPriceGrid"));
278
284
 
285
+ var _HiPrivate = _interopRequireDefault(require("./HiPrivate"));
286
+
279
287
  var _HiRoute = _interopRequireDefault(require("./HiRoute"));
280
288
 
281
289
  var _HiRouteMenu = _interopRequireDefault(require("./HiRouteMenu"));
@@ -149,6 +149,12 @@ Object.defineProperty(exports, "HiPriceGrid", {
149
149
  return _HiPriceGrid.default;
150
150
  }
151
151
  });
152
+ Object.defineProperty(exports, "HiPrivate", {
153
+ enumerable: true,
154
+ get: function get() {
155
+ return _HiPrivate.default;
156
+ }
157
+ });
152
158
  Object.defineProperty(exports, "HiRoute", {
153
159
  enumerable: true,
154
160
  get: function get() {
@@ -276,6 +282,8 @@ var _HiPermission = _interopRequireDefault(require("./HiPermission"));
276
282
 
277
283
  var _HiPriceGrid = _interopRequireDefault(require("./HiPriceGrid"));
278
284
 
285
+ var _HiPrivate = _interopRequireDefault(require("./HiPrivate"));
286
+
279
287
  var _HiRoute = _interopRequireDefault(require("./HiRoute"));
280
288
 
281
289
  var _HiRouteMenu = _interopRequireDefault(require("./HiRouteMenu"));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hipay/hipay-material-ui",
3
3
  "private": false,
4
- "version": "3.7.4",
4
+ "version": "3.7.6",
5
5
  "description": "React components that implement Google's Material Design.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -69,4 +69,4 @@
69
69
  },
70
70
  "main": "./index.js",
71
71
  "module": "./esm/index.js"
72
- }
72
+ }