@hipay/hipay-material-ui 3.7.4 → 3.7.5

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.
@@ -48,6 +48,8 @@ var _Calendar = _interopRequireDefault(require("mdi-material-ui/Calendar"));
48
48
 
49
49
  var _CalendarBlank = _interopRequireDefault(require("mdi-material-ui/CalendarBlank"));
50
50
 
51
+ var _CalendarArrowRight = _interopRequireDefault(require("mdi-material-ui/CalendarArrowRight"));
52
+
51
53
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
52
54
 
53
55
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
@@ -104,12 +106,23 @@ function buildDateRangeInfo(t, from, to, format) {
104
106
  prefix = _options$prefix === void 0 ? null : _options$prefix,
105
107
  _options$toNow = options.toNow,
106
108
  toNow = _options$toNow === void 0 ? false : _options$toNow,
109
+ _options$toToday = options.toToday,
110
+ toToday = _options$toToday === void 0 ? false : _options$toToday,
107
111
  _options$displayDays = options.displayDays,
108
- displayDays = _options$displayDays === void 0 ? true : _options$displayDays; // From
112
+ displayDays = _options$displayDays === void 0 ? true : _options$displayDays,
113
+ _options$displayDayNa = options.displayDayName,
114
+ displayDayName = _options$displayDayNa === void 0 ? false : _options$displayDayNa; // From
115
+
116
+ var info = "".concat(t.from, " ").concat(from.format(format), " "); // Display day name
117
+
118
+ if (displayDayName) {
119
+ info = "".concat(t.from, " ").concat(from.format('dddd'), " ").concat(from.format(format), " ");
120
+ } // To
109
121
 
110
- var info = "".concat(t.from, " ").concat(from.format(format), " "); // To
111
122
 
112
- if (toNow) {
123
+ if (toToday) {
124
+ info += "".concat(t.to_today);
125
+ } else if (toNow) {
113
126
  info += "".concat(t.to_now);
114
127
  } else {
115
128
  info += "".concat(t.to, " ").concat(to.format(format));
@@ -132,7 +145,7 @@ function buildDateRangeInfo(t, from, to, format) {
132
145
 
133
146
  if (displayDays) {
134
147
  var days = Math.ceil(to.diff(from, 'days', true));
135
- info = "".concat(days, " ").concat(t.days, ", ").concat(info);
148
+ info = "".concat(days, " ").concat(days === 1 ? t.day : t.days, ", ").concat(info);
136
149
  }
137
150
 
138
151
  return info;
@@ -143,6 +156,7 @@ function buildDateRangeOptionByKey(key, t, format) {
143
156
  var label;
144
157
  var info;
145
158
  var to;
159
+ var days;
146
160
 
147
161
  switch (key) {
148
162
  case 'custom':
@@ -203,7 +217,8 @@ function buildDateRangeOptionByKey(key, t, format) {
203
217
  label = t.previous_month;
204
218
  from = (0, _momentTimezone.default)().subtract(1, 'month').startOf('month');
205
219
  to = (0, _momentTimezone.default)().subtract(1, 'month').endOf('month');
206
- info = "".concat(from.daysInMonth(), " ").concat(t.days, ", ").concat(yearAndMonth(format, from));
220
+ days = from.daysInMonth();
221
+ info = "".concat(days, " ").concat(days === 1 ? t.day : t.days, ", ").concat(yearAndMonth(format, from));
207
222
  break;
208
223
 
209
224
  case 'cq':
@@ -239,18 +254,27 @@ function buildDateRangeOptionByKey(key, t, format) {
239
254
  });
240
255
  break;
241
256
 
242
- case 'yy':
243
- label = t.year_on_year;
244
- from = (0, _momentTimezone.default)().subtract(1, 'years');
257
+ case "1":
258
+ label = "24h";
259
+ from = (0, _momentTimezone.default)().subtract(1, 'day');
245
260
  to = (0, _momentTimezone.default)();
246
- info = buildDateRangeInfo(t, from, to, format, {
247
- prefix: null,
248
- toNow: true,
249
- displayDays: true
250
- });
261
+ info = "".concat(t.from, " ").concat(from.format("HH:mm"), " ").concat(t.yesterday.toLowerCase(), " ").concat(t.to_now);
251
262
  break;
252
263
 
253
264
  default:
265
+ if (parseInt(key) > 0) {
266
+ label = "".concat(key, " ").concat(key === 1 ? t.day : t.days);
267
+ from = (0, _momentTimezone.default)().subtract(parseInt(key), 'day');
268
+ to = (0, _momentTimezone.default)();
269
+ info = buildDateRangeInfo(t, from, to, format, {
270
+ prefix: null,
271
+ toNow: true,
272
+ toToday: false,
273
+ displayDays: false,
274
+ displayDayName: true
275
+ });
276
+ }
277
+
254
278
  break;
255
279
  }
256
280
 
@@ -307,12 +331,15 @@ var styles = function styles(theme) {
307
331
  };
308
332
 
309
333
  exports.styles = styles;
310
- var PRESET_PERIOD_LIST = ['cd', 'pd', 'cw', 'pw', 'cm', 'pm', 'cq', 'pq', 'cy', 'yy'];
334
+ var PRESET_PERIOD_LIST = ['cd', 'pd', 'cw', 'pw', 'cm', 'pm', 'cq', 'pq', 'cy'];
335
+ var SLIDING_PERIOD_LIST = ['1', '7', '30', '365'];
311
336
  var CUSTOM_PERIOD_LIST = ['custom'];
312
337
 
313
338
  var _ref2 = /*#__PURE__*/_react.default.createElement(_Calendar.default, null);
314
339
 
315
- var _ref3 = /*#__PURE__*/_react.default.createElement(_CalendarBlank.default, null);
340
+ var _ref3 = /*#__PURE__*/_react.default.createElement(_CalendarArrowRight.default, null);
341
+
342
+ var _ref4 = /*#__PURE__*/_react.default.createElement(_CalendarBlank.default, null);
316
343
 
317
344
  var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
318
345
  (0, _inherits2.default)(HiDateRangeSelector, _React$Component);
@@ -395,8 +422,6 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
395
422
  }, {
396
423
  key: "buildOptions",
397
424
  value: function buildOptions() {
398
- var _this2 = this;
399
-
400
425
  var _this$props = this.props,
401
426
  availableOptionKeys = _this$props.availableOptionKeys,
402
427
  translations = _this$props.translations;
@@ -405,39 +430,49 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
405
430
  var presetOptionsAvailable = availableOptionKeys.filter(function (option) {
406
431
  return PRESET_PERIOD_LIST.includes(option);
407
432
  });
433
+ var slidingOptionsAvailable = availableOptionKeys.filter(function (option) {
434
+ return SLIDING_PERIOD_LIST.includes(option);
435
+ });
408
436
  var customOptionsAvailable = availableOptionKeys.filter(function (option) {
409
437
  return CUSTOM_PERIOD_LIST.includes(option);
410
438
  });
411
439
 
412
- if (presetOptionsAvailable) {
440
+ if (presetOptionsAvailable.length) {
413
441
  options.push({
414
442
  id: "preset_periods_subheader",
415
443
  type: PRESET_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
416
- pinned: true,
417
444
  icon: _ref2,
418
445
  label: translations.preset_periods,
419
- selectable: false
446
+ children: this.options.filter(function (o) {
447
+ return presetOptionsAvailable.includes(o.id);
448
+ }),
449
+ collapseParent: true
420
450
  });
421
- presetOptionsAvailable.forEach(function (option) {
422
- options.push(_this2.options.find(function (_option) {
423
- return _option.id === option;
424
- }));
451
+ }
452
+
453
+ if (slidingOptionsAvailable.length) {
454
+ options.push({
455
+ id: "sliding_periods_subheader",
456
+ type: SLIDING_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
457
+ icon: _ref3,
458
+ label: translations.sliding_periods,
459
+ children: this.options.filter(function (o) {
460
+ return slidingOptionsAvailable.includes(o.id);
461
+ }),
462
+ collapseParent: true
425
463
  });
426
464
  }
427
465
 
428
- if (customOptionsAvailable) {
466
+ if (customOptionsAvailable.length) {
429
467
  options.push({
430
468
  id: "custom_periods_subheader",
431
469
  type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
432
- pinned: true,
433
- icon: _ref3,
470
+ icon: _ref4,
434
471
  label: translations.custom_periods,
435
- selectable: false
436
- });
437
- customOptionsAvailable.forEach(function (option) {
438
- options.push(_this2.options.find(function (_option) {
439
- return _option.id === option;
440
- }));
472
+ children: this.options.filter(function (o) {
473
+ return customOptionsAvailable.includes(o.id);
474
+ }),
475
+ collapseParent: true
441
476
  });
442
477
  }
443
478
 
@@ -446,7 +481,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
446
481
  }, {
447
482
  key: "render",
448
483
  value: function render() {
449
- var _this3 = this;
484
+ var _this2 = this;
450
485
 
451
486
  var _this$props2 = this.props,
452
487
  availableOptionKeys = _this$props2.availableOptionKeys,
@@ -477,7 +512,9 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
477
512
  var hiSelectableListProps = {
478
513
  secondaryInline: false,
479
514
  hideCheckbox: true,
480
- lazy: false
515
+ lazy: false,
516
+ collapseParent: true,
517
+ noPadding: true
481
518
  };
482
519
  var options = this.buildOptions();
483
520
  return /*#__PURE__*/_react.default.createElement(_HiFormControl.default, {
@@ -497,7 +534,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
497
534
  flexDirection: 'column'
498
535
  } : {},
499
536
  ref: function ref(container) {
500
- _this3.container = container;
537
+ _this2.container = container;
501
538
  }
502
539
  }, /*#__PURE__*/_react.default.createElement("div", {
503
540
  className: classes.select,
@@ -584,12 +621,14 @@ HiDateRangeSelector.defaultProps = {
584
621
  yearAndMonth: 'YYYY[-]MM',
585
622
  yearAndQuarter: 'YYYY[-Q]Q',
586
623
  year: 'Year',
624
+ day: 'day',
587
625
  days: 'days',
588
626
  custom_period: 'Custom Period',
589
627
  yesterday: 'Yesterday',
590
628
  from: 'from',
591
629
  to: 'to',
592
630
  to_now: 'to now',
631
+ to_today: 'to today',
593
632
  current_week: 'Current Week',
594
633
  previous_week: 'Previous Week',
595
634
  current_month: 'Current Month',
@@ -606,7 +645,8 @@ HiDateRangeSelector.defaultProps = {
606
645
  missing_date_to: 'Missing date to',
607
646
  preset_periods: 'Preset periods',
608
647
  custom_periods: 'Custom periods',
609
- custom_period_info: "Select a custom period"
648
+ custom_period_info: "Select a custom period",
649
+ sliding_periods: 'Sliding periods'
610
650
  }
611
651
  };
612
652
 
@@ -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,16 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
282
292
  }
283
293
  };
284
294
 
285
- _this.handleClick = function () {
295
+ _this.handleClick = function (event) {
296
+ if (event) {
297
+ event.preventDefault();
298
+ event.stopPropagation();
299
+
300
+ if (event.type === "keydown") {
301
+ return;
302
+ }
303
+ }
304
+
286
305
  if (_this.state.open) {
287
306
  _this.handleClose();
288
307
  } else if (_this.props.alert && !_this.state.alertOpen) {
@@ -409,8 +428,9 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
409
428
  }
410
429
  } else if (key === 'space' && event.target !== _this.searchField) {
411
430
  event.preventDefault();
431
+ event.stopPropagation();
412
432
 
413
- _this.handleClick();
433
+ _this.handleClick(event);
414
434
  } else if (key === 'tab') {
415
435
  _this.handleClose();
416
436
  }
@@ -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");
@@ -57,6 +59,23 @@ var styles = function styles(theme) {
57
59
  }
58
60
  };
59
61
  };
62
+
63
+ exports.styles = styles;
64
+
65
+ var findSelectedItemParent = function findSelectedItemParent(arr, id) {
66
+ if (id) {
67
+ var res = arr.find(function (p) {
68
+ var _p$children;
69
+
70
+ return (_p$children = p.children) === null || _p$children === void 0 ? void 0 : _p$children.map(function (o) {
71
+ return o.id;
72
+ }).includes(id);
73
+ });
74
+ if (res) return res.id;
75
+ }
76
+
77
+ return null;
78
+ };
60
79
  /**
61
80
  * Construit une liste d'item sélectionnable (avec checkbox)
62
81
  * - la navigation au clavier est gérée par l'event KeyDown
@@ -64,27 +83,28 @@ var styles = function styles(theme) {
64
83
  */
65
84
 
66
85
 
67
- exports.styles = styles;
68
-
69
86
  var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
70
87
  (0, _inherits2.default)(HiSelectableList, _React$PureComponent);
71
88
 
72
89
  var _super = _createSuper(HiSelectableList);
73
90
 
74
- function HiSelectableList() {
91
+ function HiSelectableList(props) {
75
92
  var _this;
76
93
 
77
94
  (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));
95
+ _this = _super.call(this);
84
96
 
85
97
  _this.handleSelect = function (item) {
86
98
  return function (event) {
87
- _this.props.onSelect(event, item);
99
+ if (_this.props.collapseParent && item.children) {
100
+ _this.setState(function (prevState) {
101
+ return {
102
+ openedParent: prevState.openedParent === item.id ? null : item.id
103
+ };
104
+ });
105
+ } else {
106
+ _this.props.onSelect(event, item);
107
+ }
88
108
  };
89
109
  };
90
110
 
@@ -125,7 +145,8 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
125
145
  onKeyUp = _this$props.onKeyUp,
126
146
  suggestionFocusIndex = _this$props.suggestionFocusIndex,
127
147
  classes = _this$props.classes,
128
- others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp", "suggestionFocusIndex", "classes"]);
148
+ noPadding = _this$props.noPadding,
149
+ others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp", "suggestionFocusIndex", "classes", "noPadding"]);
129
150
 
130
151
  if (sort && item.children) {
131
152
  item.children.sort(_this.compareItem);
@@ -156,7 +177,7 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
156
177
  hideCheckbox: hideCheckbox,
157
178
  hoverIcon: hoverIcon,
158
179
  icon: icon,
159
- level: level,
180
+ level: noPadding ? 0 : level,
160
181
  onSelect: item.selectable !== false ? _this.handleSelect(item) : undefined,
161
182
  onKeyDown: item.selectable !== false ? onKeyDown : undefined,
162
183
  onKeyUp: onKeyUp,
@@ -165,12 +186,23 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
165
186
  item: item,
166
187
  classes: {
167
188
  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) {
189
+ },
190
+ collapseHeader: _this.props.collapseParent && item.children && item.children.length > 0,
191
+ opened: _this.state.openedParent === item.id
192
+ }, item)), item.children && item.children.length > 0 && (_this.props.collapseParent && level === 0 ? /*#__PURE__*/_react.default.createElement(_Collapse.default, {
193
+ id: "group-".concat(item.id),
194
+ in: _this.state.openedParent === item.id,
195
+ timeout: "auto",
196
+ unmountOnExit: true
197
+ }, item.children.filter(function (subItem) {
170
198
  return !(subItem.displayed === false);
171
199
  }).map(function (subItem) {
172
200
  return _this.buildRecursiveListItem(subItem, index, level + 1);
173
- }));
201
+ })) : item.children.filter(function (subItem) {
202
+ return !(subItem.displayed === false);
203
+ }).map(function (subItem) {
204
+ return _this.buildRecursiveListItem(subItem, index, level + 1);
205
+ })));
174
206
 
175
207
  if (lazy) {
176
208
  return /*#__PURE__*/_react.default.createElement(_reactLazyload.default, {
@@ -208,6 +240,20 @@ var HiSelectableList = /*#__PURE__*/function (_React$PureComponent) {
208
240
  return (0, _helpers.foldAccents)(a.label.toString().toLowerCase()) > (0, _helpers.foldAccents)(b.label.toString().toLowerCase()) ? 1 : -1;
209
241
  };
210
242
 
243
+ _this.state = {};
244
+
245
+ if (props.collapseParent) {
246
+ if (props.selectedItemIdList[0]) {
247
+ _this.state = {
248
+ openedParent: findSelectedItemParent(props.itemList, props.selectedItemIdList[0])
249
+ };
250
+ } else {
251
+ _this.state = {
252
+ openedParent: props.itemList[0].id
253
+ };
254
+ }
255
+ }
256
+
211
257
  return _this;
212
258
  }
213
259
 
@@ -289,7 +335,8 @@ HiSelectableList.defaultProps = {
289
335
  lazy: true,
290
336
  selectedItemIdList: [],
291
337
  sort: false,
292
- sortAppendList: ['_all']
338
+ sortAppendList: ['_all'],
339
+ collapseParent: false
293
340
  };
294
341
 
295
342
  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 _ref2 = /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, null);
274
+
275
+ var _ref3 = /*#__PURE__*/_react.default.createElement(_ArrowRight.default, null);
276
+
254
277
  function HiSelectableListItem(props) {
255
278
  var _classNames, _classNames3, _classNames4;
256
279
 
@@ -273,12 +296,15 @@ 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;
282
308
  var classes = useStyles(props);
283
309
  var ref = (0, _react.useRef)(null);
284
310
  var isHovering = !!hoverIcon ? (0, _reactUse.useHoverDirty)(ref) : false;
@@ -309,7 +335,7 @@ function HiSelectableListItem(props) {
309
335
  displayedIcon = icon;
310
336
  }
311
337
 
312
- var ListItemComponentName = pinned ? _ListSubheader.default : _ListItem.default;
338
+ var ListItemComponentName = pinned || collapseHeader ? _ListSubheader.default : _ListItem.default;
313
339
  var itemIcon;
314
340
 
315
341
  if (displayedIcon) {
@@ -336,14 +362,14 @@ function HiSelectableListItem(props) {
336
362
  classes: {
337
363
  root: classes.root
338
364
  },
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)),
365
+ 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
366
  disabled: disabled,
341
367
  onClick: !disabled ? onSelect : undefined,
342
368
  style: {
343
369
  paddingLeft: "".concat(paddingLeft + level * 32, "px")
344
370
  }
345
371
  }, /*#__PURE__*/_react.default.createElement("div", {
346
- className: (0, _classnames.default)(classes.labelContent, (0, _defineProperty2.default)({}, classes.labelWithoutSecondaryInline, !secondaryInline || !secondaryLabel && !info))
372
+ className: (0, _classnames.default)(classes.labelContent, (0, _defineProperty2.default)({}, classes.labelWithoutSecondaryInline, !secondaryInline || !secondaryLabel && typeof info === "undefined"))
347
373
  }, !hideCheckbox && !pinned && /*#__PURE__*/_react.default.createElement(_HiCheckbox.default, {
348
374
  tabIndex: 0,
349
375
  classes: {
@@ -374,12 +400,15 @@ function HiSelectableListItem(props) {
374
400
  color: color,
375
401
  label: label,
376
402
  labelHighlight: labelHighlight,
377
- selected: selected
378
- }))), /*#__PURE__*/_react.default.createElement("div", {
403
+ selected: selected,
404
+ title: title
405
+ }), collapseHeader && /*#__PURE__*/_react.default.createElement("span", {
406
+ className: classes.rightIcon
407
+ }, opened ? _ref2 : _ref3))), /*#__PURE__*/_react.default.createElement("div", {
379
408
  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
409
  }, !!secondaryLabel && /*#__PURE__*/_react.default.createElement("div", {
381
410
  className: (0, _classnames.default)(classes.secondaryLabel, (0, _defineProperty2.default)({}, classes.inline, secondaryInline))
382
- }, secondaryLabel), !!info && /*#__PURE__*/_react.default.createElement("span", {
411
+ }, secondaryLabel), typeof info !== "undefined" && /*#__PURE__*/_react.default.createElement("span", {
383
412
  className: (0, _classnames.default)(classes.info)
384
413
  }, info)));
385
414
  }
@@ -396,7 +425,8 @@ HiSelectableListItem.defaultProps = {
396
425
  pinned: false,
397
426
  secondaryInline: true,
398
427
  selected: false,
399
- thin: false
428
+ thin: false,
429
+ opened: false
400
430
  };
401
431
  var _default = HiSelectableListItem;
402
432
  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: {