intelicoreact 1.2.96 → 1.2.98

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.
@@ -90,7 +90,7 @@ var Dropdown = function Dropdown(_ref) {
90
90
  isMobileProp = _useIsMobile.isMobile;
91
91
 
92
92
  var isMobile = isMobileProp && withMobileLogic;
93
- var dropdownId = id || fieldKey;
93
+ var dropdownId = id || fieldKey || Math.random().toString(16).slice(2);
94
94
 
95
95
  var _useState = (0, _react.useState)(false),
96
96
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -106,6 +106,7 @@ var Dropdown = function Dropdown(_ref) {
106
106
  var dropdownListRef = (0, _react.useRef)(null);
107
107
  var dropdownListWrapperRef = (0, _react.useRef)(null);
108
108
  var searchInputRef = (0, _react.useRef)(null);
109
+ var wrapperRef = (0, _react.useRef)(null);
109
110
 
110
111
  var _useState5 = (0, _react.useState)(null),
111
112
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
@@ -259,6 +260,14 @@ var Dropdown = function Dropdown(_ref) {
259
260
  setSearchValue(inputValue);
260
261
  };
261
262
 
263
+ var onWrapperClick = function onWrapperClick(e) {
264
+ if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
265
+ e.stopPropagation();
266
+ e.preventDefault();
267
+ setIsOpen(false);
268
+ }
269
+ };
270
+
262
271
  var hightlightedText = function hightlightedText(text, postfix, description) {
263
272
  var _text;
264
273
 
@@ -446,7 +455,9 @@ var Dropdown = function Dropdown(_ref) {
446
455
  var _cn3, _cn4, _getSortedOptions;
447
456
 
448
457
  return /*#__PURE__*/_react.default.createElement("div", {
449
- className: (0, _classnames.default)("".concat(RC, "__container-wrapper"))
458
+ className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
459
+ ref: wrapperRef,
460
+ onClick: onWrapperClick
450
461
  }, /*#__PURE__*/_react.default.createElement("div", {
451
462
  className: (0, _classnames.default)("".concat(RC, "__list-wrapper"), (_cn3 = {}, (0, _defineProperty2.default)(_cn3, "".concat(RC, "__list-wrapper--fixed-height"), isFixedMaxHeight), (0, _defineProperty2.default)(_cn3, "".concat(RC, "__list-wrapper--with-bottom-shadow"), isScrollableList && isMobile), (0, _defineProperty2.default)(_cn3, "".concat(RC, "__list-wrapper--with-bottom-shadow-hidden"), scrollTop === scrollHeight), _cn3)),
452
463
  ref: dropdownListWrapperRef
@@ -646,6 +657,13 @@ var Dropdown = function Dropdown(_ref) {
646
657
  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)));
647
658
  }
648
659
  }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
660
+ (0, _react.useEffect)(function () {
661
+ return function () {
662
+ var _getListContainer7;
663
+
664
+ (_getListContainer7 = getListContainer()) === null || _getListContainer7 === void 0 ? void 0 : _getListContainer7.remove();
665
+ };
666
+ }, []);
649
667
  var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
650
668
  return option.value === value;
651
669
  })) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
@@ -114,7 +114,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
114
114
  isMobileProp = _useIsMobile.isMobile;
115
115
 
116
116
  var isMobile = isMobileProp && withMobileLogic;
117
- var dropdownId = fieldKey || id;
117
+ var dropdownId = fieldKey || id || Math.random().toString(16).slice(2);
118
118
 
119
119
  var _useState = (0, _react.useState)(false),
120
120
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -130,6 +130,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
130
130
  var dropdownListRef = (0, _react.useRef)(null);
131
131
  var dropdownListWrapperRef = (0, _react.useRef)(null);
132
132
  var inputRef = (0, _react.useRef)(null);
133
+ var wrapperRef = (0, _react.useRef)(null);
133
134
 
134
135
  var _useState5 = (0, _react.useState)(null),
135
136
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
@@ -206,6 +207,14 @@ var TagsDropdown = function TagsDropdown(_ref) {
206
207
  setSearchValue(inputValue);
207
208
  };
208
209
 
210
+ var onWrapperClick = function onWrapperClick(e) {
211
+ if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
212
+ e.stopPropagation();
213
+ e.preventDefault();
214
+ setIsOpen(false);
215
+ }
216
+ };
217
+
209
218
  var getMarkupForElement = function getMarkupForElement(item) {
210
219
  var _title$toString;
211
220
 
@@ -414,7 +423,9 @@ var TagsDropdown = function TagsDropdown(_ref) {
414
423
 
415
424
  var filteredOptions = getFilteredOptions(options);
416
425
  return /*#__PURE__*/_react.default.createElement("div", {
417
- className: (0, _classnames.default)("".concat(RC, "__container-wrapper"))
426
+ className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
427
+ ref: wrapperRef,
428
+ onClick: onWrapperClick
418
429
  }, /*#__PURE__*/_react.default.createElement("div", {
419
430
  ref: dropdownListWrapperRef,
420
431
  className: (0, _classnames.default)("".concat(RC, "__selector-wrapper"), (0, _defineProperty2.default)({}, "".concat(RC, "__selector-wrapper--fixed-height"), isFixedMaxHeight && isMobile))
@@ -573,6 +584,13 @@ var TagsDropdown = function TagsDropdown(_ref) {
573
584
  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)));
574
585
  }
575
586
  }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
587
+ (0, _react.useEffect)(function () {
588
+ return function () {
589
+ var _getListContainer4;
590
+
591
+ (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.remove();
592
+ };
593
+ }, []);
576
594
  return /*#__PURE__*/_react.default.createElement("div", {
577
595
  className: (0, _classnames.default)(RC, className, (_cn8 = {}, (0, _defineProperty2.default)(_cn8, "".concat(RC, "_disabled"), disabled), (0, _defineProperty2.default)(_cn8, "".concat(RC, "-mobile"), isMobile), _cn8)),
578
596
  ref: dropdownRef
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.2.96",
3
+ "version": "1.2.98",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [