intelicoreact 1.2.48 → 1.2.50
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.
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +13 -40
- package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +14 -2
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +5 -14
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +205 -31
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +209 -7
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +4 -4
- package/dist/Atomic/UI/Hint/Hint.js +5 -23
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +42 -0
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +42 -0
- package/dist/Molecular/CustomIcons/components/AppStore.js +46 -0
- package/dist/Molecular/CustomIcons/components/Arrow.js +52 -0
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +34 -0
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +37 -0
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +37 -0
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +34 -0
- package/dist/Molecular/CustomIcons/components/Bell.js +32 -0
- package/dist/Molecular/CustomIcons/components/Button.js +32 -0
- package/dist/Molecular/CustomIcons/components/Campaigns.js +33 -0
- package/dist/Molecular/CustomIcons/components/Check.js +33 -0
- package/dist/Molecular/CustomIcons/components/Check2.js +32 -0
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +32 -0
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +32 -0
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +32 -0
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +32 -0
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +32 -0
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +47 -0
- package/dist/Molecular/CustomIcons/components/Close.js +34 -0
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +59 -0
- package/dist/Molecular/CustomIcons/components/Delete.js +33 -0
- package/dist/Molecular/CustomIcons/components/Edit.js +32 -0
- package/dist/Molecular/CustomIcons/components/Email.js +50 -0
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +40 -0
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +48 -0
- package/dist/Molecular/CustomIcons/components/Flows.js +32 -0
- package/dist/Molecular/CustomIcons/components/Gift.js +37 -0
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +46 -0
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +46 -0
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +35 -0
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +36 -0
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +35 -0
- package/dist/Molecular/CustomIcons/components/Home.js +35 -0
- package/dist/Molecular/CustomIcons/components/Home2.js +38 -0
- package/dist/Molecular/CustomIcons/components/Key.js +40 -0
- package/dist/Molecular/CustomIcons/components/Landers.js +36 -0
- package/dist/Molecular/CustomIcons/components/Lock.js +32 -0
- package/dist/Molecular/CustomIcons/components/Mail.js +40 -0
- package/dist/Molecular/CustomIcons/components/Mastercard.js +82 -0
- package/dist/Molecular/CustomIcons/components/Minus.js +45 -0
- package/dist/Molecular/CustomIcons/components/Offers.js +33 -0
- package/dist/Molecular/CustomIcons/components/Pause.js +45 -0
- package/dist/Molecular/CustomIcons/components/PayPal.js +59 -0
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +46 -0
- package/dist/Molecular/CustomIcons/components/Phone.js +47 -0
- package/dist/Molecular/CustomIcons/components/Play.js +45 -0
- package/dist/Molecular/CustomIcons/components/Plus.js +45 -0
- package/dist/Molecular/CustomIcons/components/Profile.js +37 -0
- package/dist/Molecular/CustomIcons/components/QRCode.js +47 -0
- package/dist/Molecular/CustomIcons/components/Rectangle.js +32 -0
- package/dist/Molecular/CustomIcons/components/Revert.js +35 -0
- package/dist/Molecular/CustomIcons/components/Star.js +31 -0
- package/dist/Molecular/CustomIcons/components/Star2.js +33 -0
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +35 -0
- package/dist/Molecular/CustomIcons/components/Trash.js +32 -0
- package/dist/Molecular/CustomIcons/components/TrashRed.js +32 -0
- package/dist/Molecular/CustomIcons/components/Triggers.js +32 -0
- package/dist/Molecular/CustomIcons/components/User.js +37 -0
- package/dist/Molecular/CustomIcons/components/Visa.js +48 -0
- package/dist/Molecular/CustomIcons/components/X.js +32 -0
- package/dist/Molecular/CustomIcons/index.js +798 -0
- package/package.json +1 -1
|
@@ -37,6 +37,8 @@ var _Input = _interopRequireDefault(require("../../../Atomic/FormElements/Input/
|
|
|
37
37
|
|
|
38
38
|
var _RadioInput = _interopRequireDefault(require("../../../Atomic/FormElements/RadioInput/RadioInput"));
|
|
39
39
|
|
|
40
|
+
var _CustomIcons = require("../../../Molecular/CustomIcons");
|
|
41
|
+
|
|
40
42
|
var _DropdownLoader = _interopRequireDefault(require("./components/DropdownLoader"));
|
|
41
43
|
|
|
42
44
|
require("./Dropdown.scss");
|
|
@@ -52,7 +54,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
52
54
|
var RC = 'dropdown';
|
|
53
55
|
|
|
54
56
|
var Dropdown = function Dropdown(_ref) {
|
|
55
|
-
var _options$find, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find;
|
|
57
|
+
var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find;
|
|
56
58
|
|
|
57
59
|
var label = _ref.label,
|
|
58
60
|
_ref$options = _ref.options,
|
|
@@ -400,7 +402,11 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
400
402
|
onClick: function onClick() {
|
|
401
403
|
return setIsOpen(false);
|
|
402
404
|
}
|
|
403
|
-
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X,
|
|
405
|
+
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
|
|
406
|
+
onClick: function onClick() {
|
|
407
|
+
return setIsOpen(false);
|
|
408
|
+
}
|
|
409
|
+
}))), isSearchable && /*#__PURE__*/_react.default.createElement("div", {
|
|
404
410
|
className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
|
|
405
411
|
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
406
412
|
ref: searchInputRef,
|
|
@@ -410,6 +416,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
410
416
|
return onSearchHandler(v);
|
|
411
417
|
},
|
|
412
418
|
placeholder: placeholder || 'Search',
|
|
419
|
+
withDelete: true,
|
|
413
420
|
onFocus: function onFocus() {
|
|
414
421
|
return setIsSearchInputFocused(true);
|
|
415
422
|
},
|
|
@@ -493,9 +500,9 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
493
500
|
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.removeEventListener('click', closeList);
|
|
494
501
|
};
|
|
495
502
|
}, [getListContainer]);
|
|
496
|
-
(0, _react.
|
|
503
|
+
(0, _react.useLayoutEffect)(function () {
|
|
497
504
|
setListContainerStyles();
|
|
498
|
-
}, [isOpen, searchValue]);
|
|
505
|
+
}, [isOpen, searchValue, isMobile, options, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR4 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR4 === void 0 ? void 0 : (_dropdownListWrapperR5 = _dropdownListWrapperR4.getBoundingClientRect()) === null || _dropdownListWrapperR5 === void 0 ? void 0 : _dropdownListWrapperR5.height]);
|
|
499
506
|
(0, _react.useEffect)(function () {
|
|
500
507
|
document.addEventListener('click', handleClickOutside, true);
|
|
501
508
|
return function () {
|
|
@@ -542,7 +549,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
542
549
|
(0, _react.useEffect)(function () {
|
|
543
550
|
var _searchInputRef$curre;
|
|
544
551
|
|
|
545
|
-
if (isOpen && !isSearchInputFocused && searchInputRef !== null && searchInputRef !== void 0 && searchInputRef.current) searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
552
|
+
if (isOpen && !isSearchInputFocused && searchInputRef !== null && searchInputRef !== void 0 && searchInputRef.current && !isMobile) searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
546
553
|
|
|
547
554
|
if (isOpen) {
|
|
548
555
|
var _getListContainer4;
|
|
@@ -614,41 +621,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
614
621
|
}, postfixText)), /*#__PURE__*/_react.default.createElement("span", {
|
|
615
622
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen)),
|
|
616
623
|
onClick: toggleList
|
|
617
|
-
}, isMobile ? /*#__PURE__*/_react.default.createElement(
|
|
618
|
-
width: "16",
|
|
619
|
-
height: "16",
|
|
620
|
-
viewBox: "0 0 16 16",
|
|
621
|
-
fill: "none",
|
|
622
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
623
|
-
}, /*#__PURE__*/_react.default.createElement("mask", {
|
|
624
|
-
id: "mask0_38955_3473",
|
|
625
|
-
style: {
|
|
626
|
-
maskType: 'alpha'
|
|
627
|
-
},
|
|
628
|
-
maskUnits: "userSpaceOnUse",
|
|
629
|
-
x: "0",
|
|
630
|
-
y: "0",
|
|
631
|
-
width: "16",
|
|
632
|
-
height: "16"
|
|
633
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
634
|
-
d: "M5 10L8 13L11 10",
|
|
635
|
-
stroke: "#171D33",
|
|
636
|
-
strokeWidth: "1.00032",
|
|
637
|
-
strokeLinecap: "round",
|
|
638
|
-
strokeLinejoin: "round"
|
|
639
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
640
|
-
d: "M5 6L8 3L11 6",
|
|
641
|
-
stroke: "#171D33",
|
|
642
|
-
strokeWidth: "1.00032",
|
|
643
|
-
strokeLinecap: "round",
|
|
644
|
-
strokeLinejoin: "round"
|
|
645
|
-
})), /*#__PURE__*/_react.default.createElement("g", {
|
|
646
|
-
mask: "url(#mask0_38955_3473)"
|
|
647
|
-
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
648
|
-
width: "16",
|
|
649
|
-
height: "16",
|
|
650
|
-
fill: "#171D33"
|
|
651
|
-
}))) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && renderListContainer());
|
|
624
|
+
}, isMobile ? /*#__PURE__*/_react.default.createElement(_CustomIcons.ChevronUpDown, null) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && renderListContainer());
|
|
652
625
|
};
|
|
653
626
|
|
|
654
627
|
var _default = Dropdown;
|
|
@@ -300,7 +300,8 @@
|
|
|
300
300
|
|
|
301
301
|
&__container &__list {
|
|
302
302
|
top: 0;
|
|
303
|
-
padding
|
|
303
|
+
padding:$spacing-m!important;
|
|
304
|
+
padding-top: 0!important;
|
|
304
305
|
|
|
305
306
|
&-wrapper {
|
|
306
307
|
box-sizing: border-box;
|
|
@@ -336,6 +337,16 @@
|
|
|
336
337
|
|
|
337
338
|
.input__wrap {
|
|
338
339
|
width: 100%;
|
|
340
|
+
display: flex;
|
|
341
|
+
align-items: center;
|
|
342
|
+
padding-right: $spacing-s;
|
|
343
|
+
border-radius: 6px;
|
|
344
|
+
border: 1px solid var(--form-input-border, #E1E8F1);
|
|
345
|
+
background: var(--black-bg-color, #F8FBFF)!important;
|
|
346
|
+
|
|
347
|
+
input {
|
|
348
|
+
background: unset!important;
|
|
349
|
+
}
|
|
339
350
|
}
|
|
340
351
|
}
|
|
341
352
|
|
|
@@ -373,6 +384,7 @@
|
|
|
373
384
|
|
|
374
385
|
&-group {
|
|
375
386
|
margin: 0;
|
|
387
|
+
margin-bottom: $spacing-xs;
|
|
376
388
|
|
|
377
389
|
&:last-child {
|
|
378
390
|
margin-bottom: $spacing-m;
|
|
@@ -383,7 +395,7 @@
|
|
|
383
395
|
margin-bottom: $spacing-s;
|
|
384
396
|
font-size: 11px;
|
|
385
397
|
padding: 10px 0px 6px 0px;
|
|
386
|
-
border-bottom: 1px solid
|
|
398
|
+
border-bottom: 1px solid rgba(58, 72, 122, 0.15);
|
|
387
399
|
}
|
|
388
400
|
}
|
|
389
401
|
|
|
@@ -11,6 +11,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
+
var _CustomIcons = require("../../../../Molecular/CustomIcons");
|
|
15
|
+
|
|
14
16
|
var SelectItem = function SelectItem(_ref) {
|
|
15
17
|
var item = _ref.item,
|
|
16
18
|
label = _ref.label,
|
|
@@ -28,20 +30,9 @@ var SelectItem = function SelectItem(_ref) {
|
|
|
28
30
|
onMouseEnter: onMouseEnter,
|
|
29
31
|
"data-item": item,
|
|
30
32
|
"data-testid": "selectItem--key-".concat(testId, "--label-").concat(label)
|
|
31
|
-
}, isActive && /*#__PURE__*/_react.default.createElement(
|
|
32
|
-
className: (0, _classnames.default)('opened-part__intervals-item-icon-active')
|
|
33
|
-
|
|
34
|
-
height: "16",
|
|
35
|
-
viewBox: "0 0 16 16",
|
|
36
|
-
fill: "none",
|
|
37
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
39
|
-
d: "M13.3333 4L5.99999 11.3333L2.66666 8",
|
|
40
|
-
stroke: "black",
|
|
41
|
-
strokeWidth: "1.33333",
|
|
42
|
-
strokeLinecap: "round",
|
|
43
|
-
strokeLinejoin: "round"
|
|
44
|
-
})), label);
|
|
33
|
+
}, isActive && /*#__PURE__*/_react.default.createElement(_CustomIcons.Check2, {
|
|
34
|
+
className: (0, _classnames.default)('opened-part__intervals-item-icon-active')
|
|
35
|
+
}), label);
|
|
45
36
|
};
|
|
46
37
|
|
|
47
38
|
var _default = SelectItem;
|
|
@@ -29,17 +29,31 @@ var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
|
|
|
29
29
|
|
|
30
30
|
var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
|
|
31
31
|
|
|
32
|
+
var _CheckboxInput = _interopRequireDefault(require("../../FormElements/CheckboxInput/CheckboxInput"));
|
|
33
|
+
|
|
34
|
+
var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
|
|
35
|
+
|
|
36
|
+
var _CustomIcons = require("../../../Molecular/CustomIcons");
|
|
37
|
+
|
|
32
38
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
33
39
|
|
|
40
|
+
var _useIsMobile2 = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
41
|
+
|
|
34
42
|
require("./TagsDropdown.scss");
|
|
35
43
|
|
|
36
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
45
|
|
|
38
46
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
47
|
|
|
48
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
49
|
+
|
|
50
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
51
|
+
|
|
40
52
|
var RC = 'tags-dropdown';
|
|
41
53
|
|
|
42
54
|
var TagsDropdown = function TagsDropdown(_ref) {
|
|
55
|
+
var _dropdownListWrapperR, _dropdownListWrapperR2, _dropdownListRef$curr5, _dropdownListRef$curr6;
|
|
56
|
+
|
|
43
57
|
var options = _ref.options,
|
|
44
58
|
_ref$chosenOptions = _ref.chosenOptions,
|
|
45
59
|
chosenOptions = _ref$chosenOptions === void 0 ? [] : _ref$chosenOptions,
|
|
@@ -72,12 +86,31 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
72
86
|
closeOnSelect = _ref$closeOnSelect === void 0 ? false : _ref$closeOnSelect,
|
|
73
87
|
_ref$closeOnRemove = _ref.closeOnRemove,
|
|
74
88
|
closeOnRemove = _ref$closeOnRemove === void 0 ? false : _ref$closeOnRemove,
|
|
89
|
+
_ref$closeOnRemoveAll = _ref.closeOnRemoveAll,
|
|
90
|
+
closeOnRemoveAll = _ref$closeOnRemoveAll === void 0 ? false : _ref$closeOnRemoveAll,
|
|
91
|
+
_ref$closeOnSelectAll = _ref.closeOnSelectAll,
|
|
92
|
+
closeOnSelectAll = _ref$closeOnSelectAll === void 0 ? false : _ref$closeOnSelectAll,
|
|
93
|
+
_ref$closeOnSelectMob = _ref.closeOnSelectMobile,
|
|
94
|
+
closeOnSelectMobile = _ref$closeOnSelectMob === void 0 ? false : _ref$closeOnSelectMob,
|
|
95
|
+
_ref$closeOnRemoveMob = _ref.closeOnRemoveMobile,
|
|
96
|
+
closeOnRemoveMobile = _ref$closeOnRemoveMob === void 0 ? false : _ref$closeOnRemoveMob,
|
|
97
|
+
_ref$closeOnRemoveAll2 = _ref.closeOnRemoveAllMobile,
|
|
98
|
+
closeOnRemoveAllMobile = _ref$closeOnRemoveAll2 === void 0 ? false : _ref$closeOnRemoveAll2,
|
|
99
|
+
_ref$closeOnSelectAll2 = _ref.closeOnSelectAllMobile,
|
|
100
|
+
closeOnSelectAllMobile = _ref$closeOnSelectAll2 === void 0 ? false : _ref$closeOnSelectAll2,
|
|
75
101
|
fieldKey = _ref.fieldKey,
|
|
76
102
|
id = _ref.id,
|
|
77
103
|
_ref$noOptionsText = _ref.noOptionsText,
|
|
78
104
|
noOptionsText = _ref$noOptionsText === void 0 ? 'No options available' : _ref$noOptionsText,
|
|
105
|
+
mobileSearchPlaceholder = _ref.mobileSearchPlaceholder,
|
|
106
|
+
_ref$isSearchable = _ref.isSearchable,
|
|
107
|
+
isSearchable = _ref$isSearchable === void 0 ? true : _ref$isSearchable,
|
|
79
108
|
_ref$attributesOfNati = _ref.attributesOfNativeInput,
|
|
80
109
|
attributesOfNativeInput = _ref$attributesOfNati === void 0 ? {} : _ref$attributesOfNati;
|
|
110
|
+
|
|
111
|
+
var _useIsMobile = (0, _useIsMobile2.default)(),
|
|
112
|
+
isMobile = _useIsMobile.isMobile;
|
|
113
|
+
|
|
81
114
|
var dropdownId = fieldKey || id;
|
|
82
115
|
|
|
83
116
|
var _useState = (0, _react.useState)(false),
|
|
@@ -91,6 +124,8 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
91
124
|
setSearchValue = _useState4[1];
|
|
92
125
|
|
|
93
126
|
var dropdownRef = (0, _react.useRef)(null);
|
|
127
|
+
var dropdownListRef = (0, _react.useRef)(null);
|
|
128
|
+
var dropdownListWrapperRef = (0, _react.useRef)(null);
|
|
94
129
|
var inputRef = (0, _react.useRef)(null);
|
|
95
130
|
|
|
96
131
|
var _useState5 = (0, _react.useState)(null),
|
|
@@ -98,6 +133,16 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
98
133
|
initListHeight = _useState6[0],
|
|
99
134
|
setInitListHeight = _useState6[1];
|
|
100
135
|
|
|
136
|
+
var _useState7 = (0, _react.useState)(null),
|
|
137
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
138
|
+
isScrollableList = _useState8[0],
|
|
139
|
+
setIsScrollableList = _useState8[1];
|
|
140
|
+
|
|
141
|
+
var _useState9 = (0, _react.useState)(false),
|
|
142
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
143
|
+
isFixedMaxHeight = _useState10[0],
|
|
144
|
+
setIsFixedMaxHeight = _useState10[1];
|
|
145
|
+
|
|
101
146
|
var singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce(function (acc, item) {
|
|
102
147
|
return [].concat((0, _toConsumableArray2.default)(acc), (0, _toConsumableArray2.default)(item.groupName ? item.list : [item]));
|
|
103
148
|
}, []);
|
|
@@ -116,7 +161,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
116
161
|
};
|
|
117
162
|
|
|
118
163
|
var deleteChosen = function deleteChosen(value) {
|
|
119
|
-
if (closeOnRemove) setIsOpen(false);
|
|
164
|
+
if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
|
|
120
165
|
onChange(chosenOptions.filter(function (item) {
|
|
121
166
|
return item !== value;
|
|
122
167
|
}), 'chosenOptions');
|
|
@@ -127,7 +172,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
127
172
|
|
|
128
173
|
if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
|
|
129
174
|
if (item.closeOnOptionSelect) setIsOpen(false);
|
|
130
|
-
} else if (closeOnSelect) setIsOpen(false);
|
|
175
|
+
} else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
|
|
131
176
|
|
|
132
177
|
setSearchValue('');
|
|
133
178
|
|
|
@@ -151,16 +196,29 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
151
196
|
var getMarkupForElement = function getMarkupForElement(item) {
|
|
152
197
|
var _title$toString;
|
|
153
198
|
|
|
199
|
+
var description = item.description;
|
|
154
200
|
var title = item.title || item.label;
|
|
155
|
-
|
|
201
|
+
|
|
202
|
+
var hightlightSearchValue = function hightlightSearchValue(title) {
|
|
203
|
+
var _title$toLowerCase;
|
|
204
|
+
|
|
205
|
+
var index = (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue.toLowerCase());
|
|
206
|
+
if (index === -1) return title;
|
|
207
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, title.substring(0, index), /*#__PURE__*/_react.default.createElement("span", {
|
|
208
|
+
className: "search-match"
|
|
209
|
+
}, 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)));
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
156
213
|
key: title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, '_'),
|
|
157
|
-
onClick: function onClick() {
|
|
158
|
-
|
|
214
|
+
onClick: function onClick(e) {
|
|
215
|
+
e.stopPropagation();
|
|
216
|
+
onChangeHandler(item);
|
|
159
217
|
},
|
|
160
218
|
className: (0, _classnames.default)("".concat(RC, "__list-item"), (0, _defineProperty2.default)({}, "".concat(RC, "__list-item_active"), chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
161
219
|
return value === item.value;
|
|
162
220
|
})), (0, _defineProperty2.default)({}, "".concat(RC, "__list-item_disabled"), item.disabled), (0, _defineProperty2.default)({}, "".concat(RC, "__list-item_freezed"), item === null || item === void 0 ? void 0 : item.isFreezed), item.className)
|
|
163
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
221
|
+
}, !isMobile && /*#__PURE__*/_react.default.createElement("span", {
|
|
164
222
|
className: (0, _classnames.default)("".concat(RC, "__active-icon"), (0, _defineProperty2.default)({}, "".concat(RC, "__active-icon_active"), chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
165
223
|
return value === item.value;
|
|
166
224
|
})))
|
|
@@ -168,7 +226,17 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
168
226
|
width: 16,
|
|
169
227
|
height: 16,
|
|
170
228
|
className: "color--text"
|
|
171
|
-
})),
|
|
229
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
230
|
+
className: (0, _classnames.default)("".concat(RC, "__list-item-body"))
|
|
231
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
232
|
+
className: (0, _classnames.default)("".concat(RC, "__list-item-title"))
|
|
233
|
+
}, hightlightSearchValue(title)), description && /*#__PURE__*/_react.default.createElement("span", {
|
|
234
|
+
className: (0, _classnames.default)("".concat(RC, "__list-item-description"))
|
|
235
|
+
}, description)), isMobile && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
236
|
+
value: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
237
|
+
return value === item.value;
|
|
238
|
+
})
|
|
239
|
+
}));
|
|
172
240
|
};
|
|
173
241
|
|
|
174
242
|
var prepareOptions = function prepareOptions(options) {
|
|
@@ -188,7 +256,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
188
256
|
var value = _ref4.value;
|
|
189
257
|
return value;
|
|
190
258
|
})) || [])), 'chosenOptions');
|
|
191
|
-
if (
|
|
259
|
+
if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
|
|
192
260
|
};
|
|
193
261
|
|
|
194
262
|
var unselectAllItems = function unselectAllItems(e) {
|
|
@@ -200,7 +268,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
200
268
|
return value === item;
|
|
201
269
|
})) === null || _prepareOptions2$find === void 0 ? void 0 : _prepareOptions2$find.isFreezed;
|
|
202
270
|
}), 'chosenOptions');
|
|
203
|
-
if (
|
|
271
|
+
if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
|
|
204
272
|
};
|
|
205
273
|
|
|
206
274
|
var getParentNode = function getParentNode() {
|
|
@@ -221,7 +289,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
221
289
|
};
|
|
222
290
|
|
|
223
291
|
var setListContainerStyles = function setListContainerStyles() {
|
|
224
|
-
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _dl$getBoundingClient, _sw$getBoundingClient;
|
|
292
|
+
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _dl$getBoundingClient, _sw$getBoundingClient, _sw$getBoundingClient2, _lh$getBoundingClient, _lf$getBoundingClient;
|
|
225
293
|
|
|
226
294
|
var lc = getListContainer();
|
|
227
295
|
if (!lc || !isOpen) return false;
|
|
@@ -233,8 +301,10 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
233
301
|
left = _ref6.left,
|
|
234
302
|
top = _ref6.top;
|
|
235
303
|
|
|
236
|
-
var sw =
|
|
304
|
+
var sw = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
|
|
237
305
|
var dl = lc.getElementsByClassName('tags-dropdown__list')[0];
|
|
306
|
+
var lh = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName('tags-dropdown__header')[0];
|
|
307
|
+
var lf = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName('tags-dropdown__footer')[0];
|
|
238
308
|
var 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);
|
|
239
309
|
var maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === 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);
|
|
240
310
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
@@ -244,13 +314,13 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
244
314
|
var swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
245
315
|
var controlsHeight = swHeight - dlHeight;
|
|
246
316
|
if (swHeight > maxHeight) swHeight = maxHeight - 2 * margin;
|
|
247
|
-
var maxSwHeight = toTop - margin >= maxHeight || toBottom - margin >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
317
|
+
var maxSwHeight = isMobile ? (sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient2 = sw.getBoundingClientRect()) === null || _sw$getBoundingClient2 === void 0 ? void 0 : _sw$getBoundingClient2.height) - (lh === null || lh === void 0 ? void 0 : (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) - (lf === null || lf === void 0 ? void 0 : (_lf$getBoundingClient = lf.getBoundingClientRect()) === null || _lf$getBoundingClient === void 0 ? void 0 : _lf$getBoundingClient.height) : toTop - margin >= maxHeight || toBottom - margin >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
248
318
|
var listPos = toTop < toBottom || toBottom >= swHeight ? 'bottom' : 'top';
|
|
249
319
|
if (swHeight > (listPos === 'top' ? toTop : toBottom)) swHeight = (listPos === 'top' ? toTop : toBottom) - 3 * margin;
|
|
250
320
|
lc.style.minWidth = "".concat(width, "px");
|
|
251
321
|
lc.style.left = "".concat(left, "px");
|
|
252
322
|
lc.style.top = "".concat(listPos === 'bottom' ? top + height : top - swHeight - 2 * margin, "px");
|
|
253
|
-
dl.style.maxHeight = "".concat(maxSwHeight - controlsHeight, "px");
|
|
323
|
+
dl.style.maxHeight = "".concat(isMobile ? maxSwHeight : maxSwHeight - controlsHeight, "px");
|
|
254
324
|
};
|
|
255
325
|
|
|
256
326
|
var renderListContainer = function renderListContainer() {
|
|
@@ -267,29 +337,96 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
267
337
|
return false;
|
|
268
338
|
};
|
|
269
339
|
|
|
340
|
+
var isItemMatchesSearch = function isItemMatchesSearch(item) {
|
|
341
|
+
var title = item.title || item.label;
|
|
342
|
+
return searchValue.length ? title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '') : true;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
var getFilteredOptions = function getFilteredOptions(options) {
|
|
346
|
+
return options === null || options === void 0 ? void 0 : options.reduce(function (result, option) {
|
|
347
|
+
if (option.groupName) {
|
|
348
|
+
var _option$list;
|
|
349
|
+
|
|
350
|
+
var filteredGroupItems = option === null || option === void 0 ? void 0 : (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(function (item) {
|
|
351
|
+
return isItemMatchesSearch(item);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
if (filteredGroupItems !== null && filteredGroupItems !== void 0 && filteredGroupItems.length) {
|
|
355
|
+
result.push(_objectSpread(_objectSpread({}, option), {}, {
|
|
356
|
+
list: filteredGroupItems
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
} else if (isItemMatchesSearch(option)) {
|
|
360
|
+
result.push(option);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return result;
|
|
364
|
+
}, []);
|
|
365
|
+
};
|
|
366
|
+
|
|
270
367
|
var getListMarkUp = function getListMarkUp() {
|
|
368
|
+
var filteredOptions = getFilteredOptions(options);
|
|
271
369
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
370
|
+
ref: dropdownListWrapperRef,
|
|
371
|
+
className: (0, _classnames.default)("".concat(RC, "__selector-wrapper"), (0, _defineProperty2.default)({}, "".concat(RC, "__selector-wrapper--fixed-height"), isFixedMaxHeight && isMobile))
|
|
372
|
+
}, headerContent || isMobile ? /*#__PURE__*/_react.default.createElement("div", {
|
|
373
|
+
className: (0, _classnames.default)("".concat(RC, "__header"), (0, _defineProperty2.default)({}, "".concat(RC, "__header-with-shadow"), isScrollableList && isMobile))
|
|
374
|
+
}, isMobile && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
375
|
+
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
376
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
377
|
+
className: (0, _classnames.default)("".concat(RC, "__label"))
|
|
378
|
+
}, label), /*#__PURE__*/_react.default.createElement("div", {
|
|
379
|
+
className: (0, _classnames.default)("".concat(RC, "__close-icon")),
|
|
380
|
+
onClick: function onClick(e) {
|
|
381
|
+
e.stopPropagation();
|
|
382
|
+
setIsOpen(false);
|
|
383
|
+
}
|
|
384
|
+
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
|
|
385
|
+
onClick: function onClick(e) {
|
|
386
|
+
e.stopPropagation();
|
|
387
|
+
setIsOpen(false);
|
|
388
|
+
}
|
|
389
|
+
}))), 1 === 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
390
|
+
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
391
|
+
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
392
|
+
className: "".concat(RC, "__input"),
|
|
393
|
+
value: searchValue,
|
|
394
|
+
onChange: function onChange(v) {
|
|
395
|
+
return setSearchValue(v);
|
|
396
|
+
},
|
|
397
|
+
placeholder: mobileSearchPlaceholder || 'Search',
|
|
398
|
+
withDelete: true,
|
|
399
|
+
onMouseDown: function onMouseDown() {
|
|
400
|
+
if (!isOpen) {
|
|
401
|
+
if (!isMobile) setIsSearchInputFocused(true);
|
|
402
|
+
setIsOpen(true);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}))), headerContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
406
|
+
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
407
|
+
}, headerContent)) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
408
|
+
ref: dropdownListRef,
|
|
409
|
+
className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : '', " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : '')
|
|
410
|
+
}, (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) > 0 ? filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(function (option) {
|
|
411
|
+
var _option$groupName, _option$groupName$toS, _option$list2;
|
|
279
412
|
|
|
280
413
|
return option.groupName ? /*#__PURE__*/_react.default.createElement("div", {
|
|
281
414
|
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0 ? void 0 : (_option$groupName$toS = _option$groupName.toString()) === null || _option$groupName$toS === void 0 ? void 0 : _option$groupName$toS.replace(/ /g, '_').concat(Date.now()),
|
|
282
415
|
className: (0, _classnames.default)("".concat(RC, "-group"), option.className)
|
|
283
416
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
284
417
|
className: "".concat(RC, "-group__name")
|
|
285
|
-
}, option.groupName), (_option$
|
|
418
|
+
}, option.groupName), (_option$list2 = option.list) === null || _option$list2 === void 0 ? void 0 : _option$list2.map(function (item) {
|
|
286
419
|
return getMarkupForElement(item);
|
|
287
420
|
})) : getMarkupForElement(option);
|
|
288
421
|
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
289
422
|
className: "".concat(RC, "__no-options")
|
|
290
|
-
}, noOptionsText)), footerContent ? /*#__PURE__*/_react.default.createElement("div", {
|
|
291
|
-
className: "".concat(RC, "__footer")
|
|
292
|
-
}, footerContent
|
|
423
|
+
}, noOptionsText)), footerContent || isMobile ? /*#__PURE__*/_react.default.createElement("div", {
|
|
424
|
+
className: (0, _classnames.default)("".concat(RC, "__footer"), (0, _defineProperty2.default)({}, "".concat(RC, "__footer-with-shadow"), isScrollableList))
|
|
425
|
+
}, footerContent, isMobile && /*#__PURE__*/_react.default.createElement("button", {
|
|
426
|
+
onClick: function onClick() {
|
|
427
|
+
return setIsOpen(false);
|
|
428
|
+
}
|
|
429
|
+
}, "Apply", chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.length ? "(".concat(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length, ")") : '')) : null);
|
|
293
430
|
};
|
|
294
431
|
|
|
295
432
|
var closeList = function closeList(e) {
|
|
@@ -303,9 +440,16 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
303
440
|
initListContainer();
|
|
304
441
|
}, []);
|
|
305
442
|
(0, _react.useLayoutEffect)(function () {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
443
|
+
if (!isMobile) {
|
|
444
|
+
window.addEventListener('resize', setListContainerStyles);
|
|
445
|
+
window.addEventListener('mousewheel', closeList);
|
|
446
|
+
window.addEventListener('mouseup', handleClickOutside);
|
|
447
|
+
} else {
|
|
448
|
+
window.removeEventListener('resize', setListContainerStyles);
|
|
449
|
+
window.removeEventListener('mousewheel', closeList);
|
|
450
|
+
window.removeEventListener('mouseup', handleClickOutside);
|
|
451
|
+
}
|
|
452
|
+
|
|
309
453
|
return function () {
|
|
310
454
|
window.removeEventListener('resize', setListContainerStyles);
|
|
311
455
|
window.removeEventListener('mousewheel', closeList);
|
|
@@ -314,20 +458,48 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
314
458
|
}, [getListContainer]);
|
|
315
459
|
(0, _react.useLayoutEffect)(function () {
|
|
316
460
|
setListContainerStyles();
|
|
317
|
-
}, [isOpen, chosenOptions]);
|
|
461
|
+
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : (_dropdownListWrapperR2 = _dropdownListWrapperR.getBoundingClientRect()) === null || _dropdownListWrapperR2 === void 0 ? void 0 : _dropdownListWrapperR2.height]);
|
|
318
462
|
(0, _react.useEffect)(function () {
|
|
319
|
-
|
|
463
|
+
if (!isMobile) {
|
|
464
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
465
|
+
} else {
|
|
466
|
+
document.removeEventListener('click', handleClickOutside, true);
|
|
467
|
+
}
|
|
468
|
+
|
|
320
469
|
return function () {
|
|
321
470
|
return document.removeEventListener('click', handleClickOutside, true);
|
|
322
471
|
};
|
|
323
|
-
}, []);
|
|
472
|
+
}, [isMobile]);
|
|
324
473
|
(0, _react.useEffect)(function () {
|
|
325
474
|
var _selectAllButtonRef$c, _unselectAllButtonRef;
|
|
326
475
|
|
|
327
476
|
var fn = isOpen ? 'addEventListener' : 'removeEventListener';
|
|
328
477
|
selectAllButtonRef === null || selectAllButtonRef === void 0 ? void 0 : (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 ? void 0 : _selectAllButtonRef$c[fn]('click', selectAllItems, true);
|
|
329
478
|
unselectAllButtonRef === null || unselectAllButtonRef === void 0 ? void 0 : (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 ? void 0 : _unselectAllButtonRef[fn]('click', unselectAllItems, true);
|
|
479
|
+
|
|
480
|
+
if (isOpen) {
|
|
481
|
+
var _getListContainer2;
|
|
482
|
+
|
|
483
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.classList.add('tags-dropdown__container--opened');
|
|
484
|
+
} else {
|
|
485
|
+
var _getListContainer3;
|
|
486
|
+
|
|
487
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.classList.remove('tags-dropdown__container--opened');
|
|
488
|
+
}
|
|
330
489
|
}, [isOpen]);
|
|
490
|
+
(0, _react.useEffect)(function () {
|
|
491
|
+
if (isOpen && isMobile) {
|
|
492
|
+
var _dropdownListRef$curr, _dropdownListRef$curr2;
|
|
493
|
+
|
|
494
|
+
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));
|
|
495
|
+
|
|
496
|
+
if (isScrollableList === null) {
|
|
497
|
+
var _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
498
|
+
|
|
499
|
+
setIsFixedMaxHeight((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));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}, [isOpen, isMobile, 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]);
|
|
331
503
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
332
504
|
className: (0, _classnames.default)(RC, className, (0, _defineProperty2.default)({}, "".concat(RC, "_disabled"), disabled)),
|
|
333
505
|
ref: dropdownRef
|
|
@@ -385,7 +557,9 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
385
557
|
}
|
|
386
558
|
}, attributesOfNativeInput)) : '', isOpen && renderListContainer(), /*#__PURE__*/_react.default.createElement("span", {
|
|
387
559
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen))
|
|
388
|
-
}, /*#__PURE__*/_react.default.createElement(_reactFeather.
|
|
560
|
+
}, isMobile ? /*#__PURE__*/_react.default.createElement(_CustomIcons.ChevronUpDown, null) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, {
|
|
561
|
+
className: "color--text"
|
|
562
|
+
}) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, {
|
|
389
563
|
className: "color--text"
|
|
390
564
|
}))));
|
|
391
565
|
};
|