intelicoreact 1.2.85 → 1.2.87

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.
@@ -53,7 +53,7 @@ var RC = 'dropdown';
53
53
  var MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
54
54
 
55
55
  var Dropdown = function Dropdown(_ref) {
56
- var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr3, _dropdownListRef$curr4, _filteredOptions$find;
56
+ var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find;
57
57
 
58
58
  var label = _ref.label,
59
59
  _ref$options = _ref.options,
@@ -144,10 +144,10 @@ var Dropdown = function Dropdown(_ref) {
144
144
  if (!options) return null;
145
145
  var getTotalOptions = (0, _react.useCallback)(function () {
146
146
  return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
147
- if (item !== null && item !== void 0 && item.list) {
148
- var _item$list;
147
+ if (item !== null && item !== void 0 && item.list || item !== null && item !== void 0 && item.items) {
148
+ var _item$list, _item$items;
149
149
 
150
- result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || 0;
150
+ result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || (item === null || item === void 0 ? void 0 : (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.length) || 0;
151
151
  } else {
152
152
  ++result;
153
153
  }
@@ -177,24 +177,24 @@ var Dropdown = function Dropdown(_ref) {
177
177
  } else return option;
178
178
  });
179
179
  var filteredGroups = optionsWithOtherAtTheEnd.map(function (item) {
180
- var _item$items;
180
+ var _item$items2;
181
181
 
182
182
  return _objectSpread(_objectSpread({}, item), {}, {
183
- items: !isSearchable || !isSearchChanged ? item === null || item === void 0 ? void 0 : item.items : (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.slice().filter(function (el) {
183
+ items: !isSearchable || !isSearchChanged ? item === null || item === void 0 ? void 0 : item.items : (_item$items2 = item.items) === null || _item$items2 === void 0 ? void 0 : _item$items2.slice().filter(function (el) {
184
184
  var _el$label;
185
185
 
186
186
  return (el === null || el === void 0 ? void 0 : (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '')) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === '';
187
187
  })
188
188
  });
189
189
  }).filter(function (item) {
190
- var _item$items2;
190
+ var _item$items3;
191
191
 
192
- return ((_item$items2 = item.items) === null || _item$items2 === void 0 ? void 0 : _item$items2.length) > 0;
192
+ return ((_item$items3 = item.items) === null || _item$items3 === void 0 ? void 0 : _item$items3.length) > 0;
193
193
  });
194
194
  var filteredItems = optionsWithOtherAtTheEnd.filter(function (item) {
195
- var _item$items3;
195
+ var _item$items4;
196
196
 
197
- return !((_item$items3 = item.items) !== null && _item$items3 !== void 0 && _item$items3.length);
197
+ return !((_item$items4 = item.items) !== null && _item$items4 !== void 0 && _item$items4.length);
198
198
  }).filter(function (item) {
199
199
  var _item$label;
200
200
 
@@ -322,11 +322,11 @@ var Dropdown = function Dropdown(_ref) {
322
322
  var selectedLabel = ((_options$find = options.find(function (el) {
323
323
  return el.value === value;
324
324
  })) === null || _options$find === void 0 ? void 0 : _options$find.label) || options.reduce(function (acc, item) {
325
- var _item$items4, _item$items4$find;
325
+ var _item$items5, _item$items5$find;
326
326
 
327
- return acc || ((_item$items4 = item.items) === null || _item$items4 === void 0 ? void 0 : (_item$items4$find = _item$items4.find(function (el) {
327
+ return acc || ((_item$items5 = item.items) === null || _item$items5 === void 0 ? void 0 : (_item$items5$find = _item$items5.find(function (el) {
328
328
  return el.value === value;
329
- })) === null || _item$items4$find === void 0 ? void 0 : _item$items4$find.label);
329
+ })) === null || _item$items5$find === void 0 ? void 0 : _item$items5$find.label);
330
330
  }, null);
331
331
  var doScrollCallback = (0, _react.useCallback)(function (e) {
332
332
  var _ref2 = scrollReactionObj || {},
@@ -614,35 +614,35 @@ var Dropdown = function Dropdown(_ref) {
614
614
  }
615
615
  }, [isOpen]);
616
616
  (0, _react.useEffect)(function () {
617
- if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
618
- var _dropdownListRef$curr, _dropdownListRef$curr2;
617
+ if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
618
+ var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
619
619
 
620
620
  setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
621
- setIsFixedMaxHeight(isScrollableList !== null ? isScrollableList : false);
621
+ setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
622
622
  }
623
- }, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight]);
623
+ }, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
624
624
  (0, _react.useEffect)(function () {
625
625
  var setScrollTopValue = function setScrollTopValue(e) {
626
626
  setScrollTop(parseInt(e.target.scrollTop));
627
627
  };
628
628
 
629
629
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
630
- var _dropdownListRef$curr5;
630
+ var _dropdownListRef$curr7;
631
631
 
632
- dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.addEventListener('scroll', setScrollTopValue);
632
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener('scroll', setScrollTopValue);
633
633
  }
634
634
 
635
635
  return function () {
636
- var _dropdownListRef$curr6;
636
+ var _dropdownListRef$curr8;
637
637
 
638
- dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.removeEventListener('scroll', setScrollTopValue);
638
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener('scroll', setScrollTopValue);
639
639
  };
640
640
  }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
641
641
  (0, _react.useEffect)(function () {
642
642
  if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
643
- var _dropdownListRef$curr7, _dropdownListRef$curr8;
643
+ var _dropdownListRef$curr9, _dropdownListRef$curr10;
644
644
 
645
- setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.clientHeight)));
645
+ setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight)));
646
646
  }
647
647
  }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
648
648
  var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.2.85",
3
+ "version": "1.2.87",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [