intelicoreact 1.3.53 → 1.3.55

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.
@@ -100,7 +100,10 @@ const Dropdown = _ref => {
100
100
  return result;
101
101
  }, 0);
102
102
  }, [options]);
103
- if (isMobile) isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
103
+
104
+ if (isMobile) {
105
+ isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
106
+ }
104
107
 
105
108
  const moveOtherToEnd = options => {
106
109
  const otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => (option === null || option === void 0 ? void 0 : option.value) === "other");
@@ -214,7 +217,7 @@ const Dropdown = _ref => {
214
217
 
215
218
  const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
216
219
 
217
- text = text.replace(/["&<>]/g, function (a) {
220
+ text = text.replace(/["&<>]/g, a => {
218
221
  return {
219
222
  '"': "&quot;",
220
223
  "&": "&amp;",
@@ -280,7 +283,9 @@ const Dropdown = _ref => {
280
283
  } = scrollReactionObj || {};
281
284
 
282
285
  if (callback && typeof callback === "function") {
283
- if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) callback(e);
286
+ if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) {
287
+ callback(e);
288
+ }
284
289
  }
285
290
  }, [filteredOptions]);
286
291
 
@@ -338,7 +343,7 @@ const Dropdown = _ref => {
338
343
  };
339
344
 
340
345
  const setListContainerStyles = () => {
341
- var _dropdownRef$current$, _dropdownListWrapperR, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _sw$getBoundingClient, _dropdownListWrapperR2, _dropdownListWrapperR3, _lh$getBoundingClient;
346
+ var _dropdownRef$current$, _dropdownListWrapperR, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _sw$getBoundingClient, _dropdownListWrapperR2, _dropdownListWrapperR3, _lh$getBoundingClient, _getComputedStyle$hei, _getComputedStyle3, _getComputedStyle3$he;
342
347
 
343
348
  const lc = getListContainer();
344
349
  if (!lc || !isOpen) return false;
@@ -351,7 +356,7 @@ const Dropdown = _ref => {
351
356
  } = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
352
357
  const sw = lc.getElementsByClassName("dropdown__list")[0];
353
358
  const lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getElementsByClassName("dropdown__list-header")[0];
354
- const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle$mar2 = _getComputedStyle.marginTop) === null || _getComputedStyle$mar2 === void 0 ? void 0 : _getComputedStyle$mar2.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
359
+ const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle$mar2 = _getComputedStyle.marginTop) === null || _getComputedStyle$mar2 === void 0 ? void 0 : _getComputedStyle$mar2.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
355
360
  const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(sw)) === null || _getComputedStyle2 === void 0 ? void 0 : (_getComputedStyle2$ma = _getComputedStyle2.maxHeight) === null || _getComputedStyle2$ma === void 0 ? void 0 : _getComputedStyle2$ma.replace("px", "")) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0, 10);
356
361
  if (initListHeight === null) setInitListHeight(maxHeight);
357
362
  const toTop = top - margin;
@@ -361,7 +366,7 @@ const Dropdown = _ref => {
361
366
  const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
362
367
  lc.style.minWidth = "".concat(width, "px");
363
368
  lc.style.left = "".concat(left, "px");
364
- lc.style.top = "".concat(listPos === "bottom" ? top + height : top - swHeight - 3 * margin, "px");
369
+ lc.style.top = "".concat(listPos === "bottom" ? top + height : top - margin * 3 - parseInt((_getComputedStyle$hei = (_getComputedStyle3 = getComputedStyle(dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current)) === null || _getComputedStyle3 === void 0 ? void 0 : (_getComputedStyle3$he = _getComputedStyle3.height) === null || _getComputedStyle3$he === void 0 ? void 0 : _getComputedStyle3$he.replace("px", "")) !== null && _getComputedStyle$hei !== void 0 ? _getComputedStyle$hei : 0, 10), "px");
365
370
  sw.style.maxHeight = "".concat(maxSwHeight, "px");
366
371
  };
367
372
 
@@ -526,7 +531,7 @@ const Dropdown = _ref => {
526
531
  (0, _react.useEffect)(() => {
527
532
  document.addEventListener("click", handleClickOutside, true);
528
533
  return () => document.removeEventListener("click", handleClickOutside, true);
529
- }, [value]);
534
+ }, []);
530
535
  (0, _react.useEffect)(() => {
531
536
  if (!isOpen) {
532
537
  setIsSearchChanged(false);
@@ -621,7 +626,7 @@ const Dropdown = _ref => {
621
626
  }, /*#__PURE__*/_react.default.createElement("button", {
622
627
  "data-testid": "dropdown--".concat(testId || "", "--container"),
623
628
  className: "".concat(RC, "__trigger input__wrap ").concat(isOpen ? "input__wrap--focus" : "", " ").concat(!value ? "placeholder" : "", " ").concat(error ? "error" : ""),
624
- onClick: toggleList,
629
+ onClick: () => setIsOpen(true),
625
630
  onKeyDown: onKeyDown,
626
631
  onKeyUp: onKeyUp,
627
632
  tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
@@ -52,6 +52,7 @@ const DropdownLiveSearch = _ref => {
52
52
  isNotValidateASCII = false,
53
53
  noOptionsText = "No options available",
54
54
  attributesOfNativeInput = {},
55
+ withMobileLogic,
55
56
  tabIndex
56
57
  } = _ref;
57
58
  const dropdownId = fieldKey || id;
@@ -220,9 +220,11 @@ const TagsDropdown = _ref => {
220
220
 
221
221
  const index = (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue.toLowerCase());
222
222
  if (index === -1) return title;
223
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, title.substring(0, index), /*#__PURE__*/_react.default.createElement("span", {
224
- className: "search-match"
225
- }, title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))), title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length)));
223
+ return /*#__PURE__*/_react.default.createElement("pre", {
224
+ className: "inherit-styles"
225
+ }, /*#__PURE__*/_react.default.createElement("span", null, title.substring(0, index)), /*#__PURE__*/_react.default.createElement("span", {
226
+ className: "search-match bg--yellow"
227
+ }, title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))), /*#__PURE__*/_react.default.createElement("span", null, title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))));
226
228
  };
227
229
 
228
230
  return /*#__PURE__*/_react.default.createElement("button", {
@@ -171,6 +171,12 @@
171
171
 
172
172
  color: #757f8c;
173
173
  }
174
+
175
+ pre.inherit-styles {
176
+ font: inherit!important;
177
+ margin: 0;
178
+ padding: 0;
179
+ }
174
180
  }
175
181
  }
176
182
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.3.53",
3
+ "version": "1.3.55",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [