intelicoreact 1.2.56 → 1.2.57
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.
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
|
|
18
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -37,8 +37,6 @@ 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
|
-
|
|
42
40
|
var _DropdownLoader = _interopRequireDefault(require("./components/DropdownLoader"));
|
|
43
41
|
|
|
44
42
|
require("./Dropdown.scss");
|
|
@@ -52,6 +50,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
52
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; }
|
|
53
51
|
|
|
54
52
|
var RC = 'dropdown';
|
|
53
|
+
var MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
55
54
|
|
|
56
55
|
var Dropdown = function Dropdown(_ref) {
|
|
57
56
|
var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find;
|
|
@@ -80,11 +79,15 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
80
79
|
noOptionsText = _ref$noOptionsText === void 0 ? 'No options available' : _ref$noOptionsText,
|
|
81
80
|
_ref$attributesOfNati = _ref.attributesOfNativeInput,
|
|
82
81
|
attributesOfNativeInput = _ref$attributesOfNati === void 0 ? {} : _ref$attributesOfNati,
|
|
83
|
-
isDoNotPullOutListOfMainContainer = _ref.isDoNotPullOutListOfMainContainer
|
|
82
|
+
isDoNotPullOutListOfMainContainer = _ref.isDoNotPullOutListOfMainContainer,
|
|
83
|
+
withMobileLogic = _ref.withMobileLogic,
|
|
84
|
+
_ref$minItemsForShowM = _ref.minItemsForShowMobileSearch,
|
|
85
|
+
minItemsForShowMobileSearch = _ref$minItemsForShowM === void 0 ? MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH : _ref$minItemsForShowM;
|
|
84
86
|
|
|
85
87
|
var _useIsMobile = (0, _useIsMobile2.default)(),
|
|
86
|
-
|
|
88
|
+
isMobileProp = _useIsMobile.isMobile;
|
|
87
89
|
|
|
90
|
+
var isMobile = isMobileProp && withMobileLogic;
|
|
88
91
|
var dropdownId = id || fieldKey;
|
|
89
92
|
|
|
90
93
|
var _useState = (0, _react.useState)(false),
|
|
@@ -114,23 +117,28 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
114
117
|
|
|
115
118
|
var _useState9 = (0, _react.useState)(false),
|
|
116
119
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
isSearchInputFocused = _useState10[0],
|
|
121
|
+
setIsSearchInputFocused = _useState10[1];
|
|
119
122
|
|
|
120
|
-
var _useState11 = (0, _react.useState)(
|
|
123
|
+
var _useState11 = (0, _react.useState)(null),
|
|
121
124
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
isScrollableList = _useState12[0],
|
|
126
|
+
setIsScrollableList = _useState12[1];
|
|
124
127
|
|
|
125
|
-
var _useState13 = (0, _react.useState)(
|
|
128
|
+
var _useState13 = (0, _react.useState)(false),
|
|
126
129
|
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
isFixedMaxHeight = _useState14[0],
|
|
131
|
+
setIsFixedMaxHeight = _useState14[1];
|
|
129
132
|
|
|
130
|
-
var _useState15 = (0, _react.useState)(
|
|
133
|
+
var _useState15 = (0, _react.useState)(0),
|
|
131
134
|
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
scrollTop = _useState16[0],
|
|
136
|
+
setScrollTop = _useState16[1];
|
|
137
|
+
|
|
138
|
+
var _useState17 = (0, _react.useState)(1),
|
|
139
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
140
|
+
scrollHeight = _useState18[0],
|
|
141
|
+
setScrollHeight = _useState18[1];
|
|
134
142
|
|
|
135
143
|
if (!options) return null;
|
|
136
144
|
|
|
@@ -184,6 +192,16 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
184
192
|
var onChangeHandler = function onChangeHandler(item) {
|
|
185
193
|
setIsOpen(false);
|
|
186
194
|
onChange(item.value);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var onKeyDown = function onKeyDown(e) {
|
|
198
|
+
if (![9, 13].includes(e.keyCode)) return false;
|
|
199
|
+
setIsOpen(false);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
var onKeyUp = function onKeyUp(e) {
|
|
203
|
+
if (![9, 13].includes(e.keyCode)) return false;
|
|
204
|
+
setIsOpen(true);
|
|
187
205
|
}; // decorator
|
|
188
206
|
|
|
189
207
|
|
|
@@ -318,7 +336,20 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
318
336
|
var dropdownList = document.createElement('div');
|
|
319
337
|
dropdownList.setAttribute('id', dropdownId);
|
|
320
338
|
dropdownList.classList.add('dropdown__container');
|
|
321
|
-
|
|
339
|
+
|
|
340
|
+
if (isMobile) {
|
|
341
|
+
dropdownList.addEventListener('click', function (e) {
|
|
342
|
+
if (e.target.id === dropdownId) setIsOpen(false);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
try {
|
|
347
|
+
var _getListContainer2;
|
|
348
|
+
|
|
349
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
|
|
350
|
+
} finally {
|
|
351
|
+
getParentNode().append(dropdownList);
|
|
352
|
+
}
|
|
322
353
|
};
|
|
323
354
|
|
|
324
355
|
var getListContainer = function getListContainer() {
|
|
@@ -388,14 +419,28 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
388
419
|
return newData;
|
|
389
420
|
};
|
|
390
421
|
|
|
422
|
+
var getTotalOptions = (0, _react.useCallback)(function () {
|
|
423
|
+
return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
|
|
424
|
+
if (item !== null && item !== void 0 && item.list) {
|
|
425
|
+
var _item$list;
|
|
426
|
+
|
|
427
|
+
result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || 0;
|
|
428
|
+
} else {
|
|
429
|
+
++result;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return result;
|
|
433
|
+
}, 0);
|
|
434
|
+
}, [options]);
|
|
435
|
+
|
|
391
436
|
var getListMarkUp = function getListMarkUp() {
|
|
392
|
-
var _getSortedOptions;
|
|
437
|
+
var _cn3, _cn4, _getSortedOptions;
|
|
393
438
|
|
|
394
439
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
395
|
-
className: (0, _classnames.default)("".concat(RC, "__list-wrapper"), (0, _defineProperty2.default)(
|
|
440
|
+
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)),
|
|
396
441
|
ref: dropdownListWrapperRef
|
|
397
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
398
|
-
className: (0, _classnames.default)("".concat(RC, "__list-header"), (0, _defineProperty2.default)(
|
|
442
|
+
}, isMobile && /*#__PURE__*/_react.default.createElement("div", {
|
|
443
|
+
className: (0, _classnames.default)("".concat(RC, "__list-header"), (_cn4 = {}, (0, _defineProperty2.default)(_cn4, "".concat(RC, "__list-header-with-shadow"), isScrollableList && isMobile), (0, _defineProperty2.default)(_cn4, "".concat(RC, "__list-header-with-shadow-hidden"), scrollTop === 0), _cn4))
|
|
399
444
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
400
445
|
className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
|
|
401
446
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -409,9 +454,9 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
409
454
|
onClick: function onClick() {
|
|
410
455
|
return setIsOpen(false);
|
|
411
456
|
}
|
|
412
|
-
}))), isSearchable && /*#__PURE__*/_react.default.createElement("div", {
|
|
457
|
+
}))), (isSearchable || getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH)) && /*#__PURE__*/_react.default.createElement("div", {
|
|
413
458
|
className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
|
|
414
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
459
|
+
}, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
|
|
415
460
|
ref: searchInputRef,
|
|
416
461
|
className: "".concat(RC, "__input"),
|
|
417
462
|
value: searchValue !== null && searchValue !== void 0 ? searchValue : selectedLabel,
|
|
@@ -432,7 +477,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
432
477
|
setIsOpen(true);
|
|
433
478
|
}
|
|
434
479
|
}
|
|
435
|
-
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
480
|
+
}, attributesOfNativeInput)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
436
481
|
className: (0, _classnames.default)("".concat(RC, "__list"), (0, _defineProperty2.default)({}, "".concat(RC, "__list-top"), isListTop)),
|
|
437
482
|
ref: dropdownListRef
|
|
438
483
|
}, (_getSortedOptions = getSortedOptions(depend.options)) === null || _getSortedOptions === void 0 ? void 0 : _getSortedOptions.map(function (option) {
|
|
@@ -480,7 +525,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
480
525
|
}
|
|
481
526
|
}, [isDoNotPullOutListOfMainContainer, dropdownRef.current]);
|
|
482
527
|
(0, _react.useLayoutEffect)(function () {
|
|
483
|
-
var
|
|
528
|
+
var _getListContainer3;
|
|
484
529
|
|
|
485
530
|
if (!isMobile) {
|
|
486
531
|
window.addEventListener('resize', setListContainerStyles);
|
|
@@ -494,15 +539,15 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
494
539
|
window.removeEventListener('touchmove', closeList);
|
|
495
540
|
}
|
|
496
541
|
|
|
497
|
-
(
|
|
542
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener('click', closeList);
|
|
498
543
|
return function () {
|
|
499
|
-
var
|
|
544
|
+
var _getListContainer4;
|
|
500
545
|
|
|
501
546
|
window.removeEventListener('resize', setListContainerStyles);
|
|
502
547
|
window.removeEventListener('mousewheel', closeList);
|
|
503
548
|
window.removeEventListener('scroll', closeList);
|
|
504
549
|
window.removeEventListener('touchmove', closeList);
|
|
505
|
-
(
|
|
550
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener('click', closeList);
|
|
506
551
|
};
|
|
507
552
|
}, [getListContainer]);
|
|
508
553
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -516,7 +561,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
516
561
|
}, [value]);
|
|
517
562
|
(0, _react.useEffect)(function () {
|
|
518
563
|
if (!isOpen) {
|
|
519
|
-
setIsFocusedByClick(false);
|
|
520
564
|
setIsSearchChanged(false);
|
|
521
565
|
}
|
|
522
566
|
|
|
@@ -528,17 +572,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
528
572
|
if (scrollReactionObj && (0, _typeof2.default)(scrollReactionObj) === 'object') removeEventListener('scroll', doScrollCallback);
|
|
529
573
|
};
|
|
530
574
|
}, [isOpen, dropdownListRef]);
|
|
531
|
-
|
|
532
|
-
var onKeyDown = function onKeyDown(e) {
|
|
533
|
-
if (![9, 13].includes(e.keyCode)) return false;
|
|
534
|
-
setIsOpen(false);
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
var onKeyUp = function onKeyUp(e) {
|
|
538
|
-
if (![9, 13].includes(e.keyCode)) return false;
|
|
539
|
-
setIsOpen(true);
|
|
540
|
-
};
|
|
541
|
-
|
|
542
575
|
(0, _react.useEffect)(function () {
|
|
543
576
|
if (!searchValue && isSearchInputFocused) {
|
|
544
577
|
setSearchValue(selectedLabel);
|
|
@@ -557,13 +590,13 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
557
590
|
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();
|
|
558
591
|
|
|
559
592
|
if (isOpen) {
|
|
560
|
-
var
|
|
593
|
+
var _getListContainer5;
|
|
561
594
|
|
|
562
|
-
(
|
|
595
|
+
(_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.classList.add('dropdown__container--opened');
|
|
563
596
|
} else {
|
|
564
|
-
var
|
|
597
|
+
var _getListContainer6;
|
|
565
598
|
|
|
566
|
-
(
|
|
599
|
+
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove('dropdown__container--opened');
|
|
567
600
|
}
|
|
568
601
|
|
|
569
602
|
if (!isOpen && isMobile) {
|
|
@@ -571,7 +604,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
571
604
|
}
|
|
572
605
|
}, [isOpen]);
|
|
573
606
|
(0, _react.useEffect)(function () {
|
|
574
|
-
if (isOpen && isMobile) {
|
|
607
|
+
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
575
608
|
var _dropdownListRef$curr, _dropdownListRef$curr2;
|
|
576
609
|
|
|
577
610
|
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));
|
|
@@ -582,7 +615,31 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
582
615
|
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));
|
|
583
616
|
}
|
|
584
617
|
}
|
|
585
|
-
}, [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]);
|
|
618
|
+
}, [isOpen, isMobile, 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]);
|
|
619
|
+
(0, _react.useEffect)(function () {
|
|
620
|
+
var setScrollTopValue = function setScrollTopValue(e) {
|
|
621
|
+
setScrollTop(e.target.scrollTop);
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
625
|
+
var _dropdownListRef$curr7;
|
|
626
|
+
|
|
627
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener('scroll', setScrollTopValue);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
return function () {
|
|
631
|
+
var _dropdownListRef$curr8;
|
|
632
|
+
|
|
633
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener('scroll', setScrollTopValue);
|
|
634
|
+
};
|
|
635
|
+
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
636
|
+
(0, _react.useEffect)(function () {
|
|
637
|
+
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
638
|
+
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
639
|
+
|
|
640
|
+
setScrollHeight((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));
|
|
641
|
+
}
|
|
642
|
+
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
586
643
|
var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
|
|
587
644
|
return option.value === value;
|
|
588
645
|
})) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
|
|
@@ -626,7 +683,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
626
683
|
}, postfixText)), /*#__PURE__*/_react.default.createElement("span", {
|
|
627
684
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen)),
|
|
628
685
|
onClick: toggleList
|
|
629
|
-
}, isMobile ? /*#__PURE__*/_react.default.createElement(
|
|
686
|
+
}, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, null) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && renderListContainer());
|
|
630
687
|
};
|
|
631
688
|
|
|
632
689
|
var _default = Dropdown;
|
|
@@ -283,6 +283,22 @@
|
|
|
283
283
|
|
|
284
284
|
@media (max-width: 767px) {
|
|
285
285
|
.dropdown {
|
|
286
|
+
&__arrow {
|
|
287
|
+
top: 50%!important;
|
|
288
|
+
transform: translateY(-50%) rotate(90deg)!important;
|
|
289
|
+
right: $spacing-m!important;
|
|
290
|
+
width: 16px;
|
|
291
|
+
height: 16px;
|
|
292
|
+
text-align: center;
|
|
293
|
+
|
|
294
|
+
svg {
|
|
295
|
+
display: flex;
|
|
296
|
+
position: relative!important;
|
|
297
|
+
top: 5px!important;
|
|
298
|
+
right: unset!important;
|
|
299
|
+
height: 12px;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
286
302
|
&__container {
|
|
287
303
|
overflow: hidden!important;
|
|
288
304
|
|
|
@@ -311,6 +327,23 @@
|
|
|
311
327
|
border-radius: $spacing-l!important;
|
|
312
328
|
overflow: hidden;
|
|
313
329
|
|
|
330
|
+
&--with-bottom-shadow::after {
|
|
331
|
+
content: "";
|
|
332
|
+
width: 100%;
|
|
333
|
+
height: 15px;
|
|
334
|
+
position: absolute;
|
|
335
|
+
bottom: 0;
|
|
336
|
+
background: linear-gradient(180deg, rgba(212, 218, 230, 0.50) 0%, rgba(212, 218, 230, 0.30) 21.35%, rgba(247, 248, 250, 0.00) 100%);
|
|
337
|
+
z-index: 6;
|
|
338
|
+
transform: rotate(180deg);
|
|
339
|
+
opacity: 1;
|
|
340
|
+
transition: all 0.2s;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
&--with-bottom-shadow-hidden::after {
|
|
344
|
+
opacity: 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
314
347
|
&--fixed-height {
|
|
315
348
|
height: 500px!important;
|
|
316
349
|
}
|
|
@@ -348,31 +381,63 @@
|
|
|
348
381
|
background: unset!important;
|
|
349
382
|
}
|
|
350
383
|
}
|
|
351
|
-
}
|
|
352
384
|
|
|
353
|
-
|
|
385
|
+
|
|
386
|
+
.input__close {
|
|
387
|
+
padding: $spacing-xs;
|
|
388
|
+
border-radius: 2px;
|
|
389
|
+
background: var(--bg-gray-box, #F0F1F4);
|
|
390
|
+
width: 24px;
|
|
391
|
+
min-width: 24px;
|
|
392
|
+
height: 24px;
|
|
393
|
+
box-sizing: border-box;
|
|
394
|
+
display: flex;
|
|
395
|
+
align-items: center;
|
|
396
|
+
|
|
397
|
+
&::before,
|
|
354
398
|
&::after {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
height: 15px;
|
|
361
|
-
background: linear-gradient(180deg, rgba(212, 218, 230, 0.50) 0%, rgba(212, 218, 230, 0.30) 21.35%, rgba(247, 248, 250, 0.00) 100%);
|
|
399
|
+
height: 12px;
|
|
400
|
+
top: 50%;
|
|
401
|
+
transform: translateY(-50%) rotate(45deg);
|
|
402
|
+
border-radius: 8px;
|
|
403
|
+
background-color: #171D33;
|
|
362
404
|
}
|
|
405
|
+
&::after {
|
|
406
|
+
transform: translateY(-50%) rotate(-45deg);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
&-with-shadow::after {
|
|
412
|
+
content: "";
|
|
413
|
+
position: absolute;
|
|
414
|
+
left: 0;
|
|
415
|
+
bottom: -15px;
|
|
416
|
+
width: 100%;
|
|
417
|
+
height: 15px;
|
|
418
|
+
background: linear-gradient(180deg, rgba(212, 218, 230, 0.50) 0%, rgba(212, 218, 230, 0.30) 21.35%, rgba(247, 248, 250, 0.00) 100%);
|
|
419
|
+
z-index: 10;
|
|
420
|
+
opacity: 1;
|
|
421
|
+
transition: all 0.2s;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
&-with-shadow-hidden::after {
|
|
425
|
+
opacity: 0;
|
|
363
426
|
}
|
|
364
427
|
}
|
|
365
428
|
|
|
366
429
|
&-close-icon {
|
|
367
430
|
display: flex;
|
|
368
431
|
align-items: center;
|
|
432
|
+
justify-content: center;
|
|
369
433
|
position: absolute;
|
|
370
434
|
top: 0;
|
|
371
435
|
right: 0;
|
|
372
436
|
height: 100%;
|
|
373
437
|
padding: $spacing-m;
|
|
374
|
-
width:
|
|
375
|
-
height:
|
|
438
|
+
width: 50px;
|
|
439
|
+
height: 50px;
|
|
440
|
+
box-sizing: border-box;
|
|
376
441
|
|
|
377
442
|
svg {
|
|
378
443
|
width: 16px;
|
|
@@ -406,6 +471,15 @@
|
|
|
406
471
|
padding: 10px $spacing-s!important;
|
|
407
472
|
line-height: 24px;
|
|
408
473
|
|
|
474
|
+
&-label {
|
|
475
|
+
white-space: wrap!important;
|
|
476
|
+
|
|
477
|
+
span.bg--yellow {
|
|
478
|
+
background-color: unset!important;
|
|
479
|
+
font-weight: 600;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
409
483
|
&_active {
|
|
410
484
|
border-radius: 6px;
|
|
411
485
|
background: var(--bg-gray-box, #F0F1F4)!important;
|
|
@@ -413,3 +487,4 @@
|
|
|
413
487
|
}
|
|
414
488
|
}
|
|
415
489
|
}
|
|
490
|
+
|
|
@@ -33,8 +33,6 @@ var _CheckboxInput = _interopRequireDefault(require("../../FormElements/Checkbox
|
|
|
33
33
|
|
|
34
34
|
var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
|
|
35
35
|
|
|
36
|
-
var _CustomIcons = require("../../../Molecular/CustomIcons");
|
|
37
|
-
|
|
38
36
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
39
37
|
|
|
40
38
|
var _useIsMobile2 = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
@@ -50,6 +48,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
50
48
|
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
49
|
|
|
52
50
|
var RC = 'tags-dropdown';
|
|
51
|
+
var MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
53
52
|
|
|
54
53
|
var TagsDropdown = function TagsDropdown(_ref) {
|
|
55
54
|
var _dropdownListWrapperR, _dropdownListWrapperR2, _dropdownListRef$curr5, _dropdownListRef$curr6;
|
|
@@ -106,11 +105,15 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
106
105
|
_ref$isSearchable = _ref.isSearchable,
|
|
107
106
|
isSearchable = _ref$isSearchable === void 0 ? true : _ref$isSearchable,
|
|
108
107
|
_ref$attributesOfNati = _ref.attributesOfNativeInput,
|
|
109
|
-
attributesOfNativeInput = _ref$attributesOfNati === void 0 ? {} : _ref$attributesOfNati
|
|
108
|
+
attributesOfNativeInput = _ref$attributesOfNati === void 0 ? {} : _ref$attributesOfNati,
|
|
109
|
+
withMobileLogic = _ref.withMobileLogic,
|
|
110
|
+
_ref$minItemsForShowM = _ref.minItemsForShowMobileSearch,
|
|
111
|
+
minItemsForShowMobileSearch = _ref$minItemsForShowM === void 0 ? MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH : _ref$minItemsForShowM;
|
|
110
112
|
|
|
111
113
|
var _useIsMobile = (0, _useIsMobile2.default)(),
|
|
112
|
-
|
|
114
|
+
isMobileProp = _useIsMobile.isMobile;
|
|
113
115
|
|
|
116
|
+
var isMobile = isMobileProp && withMobileLogic;
|
|
114
117
|
var dropdownId = fieldKey || id;
|
|
115
118
|
|
|
116
119
|
var _useState = (0, _react.useState)(false),
|
|
@@ -143,6 +146,16 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
143
146
|
isFixedMaxHeight = _useState10[0],
|
|
144
147
|
setIsFixedMaxHeight = _useState10[1];
|
|
145
148
|
|
|
149
|
+
var _useState11 = (0, _react.useState)(0),
|
|
150
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
151
|
+
scrollTop = _useState12[0],
|
|
152
|
+
setScrollTop = _useState12[1];
|
|
153
|
+
|
|
154
|
+
var _useState13 = (0, _react.useState)(1),
|
|
155
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
156
|
+
scrollHeight = _useState14[0],
|
|
157
|
+
setScrollHeight = _useState14[1];
|
|
158
|
+
|
|
146
159
|
var singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce(function (acc, item) {
|
|
147
160
|
return [].concat((0, _toConsumableArray2.default)(acc), (0, _toConsumableArray2.default)(item.groupName ? item.list : [item]));
|
|
148
161
|
}, []);
|
|
@@ -212,6 +225,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
212
225
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
213
226
|
key: title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, '_'),
|
|
214
227
|
onClick: function onClick(e) {
|
|
228
|
+
e.preventDefault();
|
|
215
229
|
e.stopPropagation();
|
|
216
230
|
onChangeHandler(item);
|
|
217
231
|
},
|
|
@@ -235,7 +249,10 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
235
249
|
}, description)), isMobile && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
236
250
|
value: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
237
251
|
return value === item.value;
|
|
238
|
-
})
|
|
252
|
+
}),
|
|
253
|
+
onChange: function onChange(v) {
|
|
254
|
+
onChangeHandler(item);
|
|
255
|
+
}
|
|
239
256
|
}));
|
|
240
257
|
};
|
|
241
258
|
|
|
@@ -281,6 +298,13 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
281
298
|
var dropdownList = document.createElement('div');
|
|
282
299
|
dropdownList.setAttribute('id', dropdownId);
|
|
283
300
|
dropdownList.classList.add('tags-dropdown__container');
|
|
301
|
+
|
|
302
|
+
if (isMobile) {
|
|
303
|
+
dropdownList.addEventListener('click', function (e) {
|
|
304
|
+
if (e.target.id === dropdownId) setIsOpen(false);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
284
308
|
getParentNode().append(dropdownList);
|
|
285
309
|
};
|
|
286
310
|
|
|
@@ -364,13 +388,29 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
364
388
|
}, []);
|
|
365
389
|
};
|
|
366
390
|
|
|
391
|
+
var getTotalOptions = (0, _react.useCallback)(function () {
|
|
392
|
+
return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
|
|
393
|
+
if (item !== null && item !== void 0 && item.list) {
|
|
394
|
+
var _item$list;
|
|
395
|
+
|
|
396
|
+
result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || 0;
|
|
397
|
+
} else {
|
|
398
|
+
++result;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return result;
|
|
402
|
+
}, 0);
|
|
403
|
+
}, [options]);
|
|
404
|
+
|
|
367
405
|
var getListMarkUp = function getListMarkUp() {
|
|
406
|
+
var _cn6, _cn7;
|
|
407
|
+
|
|
368
408
|
var filteredOptions = getFilteredOptions(options);
|
|
369
409
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
370
410
|
ref: dropdownListWrapperRef,
|
|
371
411
|
className: (0, _classnames.default)("".concat(RC, "__selector-wrapper"), (0, _defineProperty2.default)({}, "".concat(RC, "__selector-wrapper--fixed-height"), isFixedMaxHeight && isMobile))
|
|
372
412
|
}, headerContent || isMobile ? /*#__PURE__*/_react.default.createElement("div", {
|
|
373
|
-
className: (0, _classnames.default)("".concat(RC, "__header"), (0, _defineProperty2.default)(
|
|
413
|
+
className: (0, _classnames.default)("".concat(RC, "__header"), (_cn6 = {}, (0, _defineProperty2.default)(_cn6, "".concat(RC, "__header-with-shadow"), isScrollableList && isMobile), (0, _defineProperty2.default)(_cn6, "".concat(RC, "__header-with-shadow-hidden"), scrollTop === 0), _cn6))
|
|
374
414
|
}, isMobile && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
375
415
|
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
376
416
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -386,9 +426,9 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
386
426
|
e.stopPropagation();
|
|
387
427
|
setIsOpen(false);
|
|
388
428
|
}
|
|
389
|
-
}))),
|
|
429
|
+
}))), getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH) && /*#__PURE__*/_react.default.createElement("div", {
|
|
390
430
|
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
391
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
431
|
+
}, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
|
|
392
432
|
className: "".concat(RC, "__input"),
|
|
393
433
|
value: searchValue,
|
|
394
434
|
onChange: function onChange(v) {
|
|
@@ -396,13 +436,13 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
396
436
|
},
|
|
397
437
|
placeholder: mobileSearchPlaceholder || 'Search',
|
|
398
438
|
withDelete: true,
|
|
399
|
-
onMouseDown: function onMouseDown() {
|
|
439
|
+
onMouseDown: function onMouseDown(e) {
|
|
400
440
|
if (!isOpen) {
|
|
401
|
-
|
|
441
|
+
setIsSearchInputFocused(true);
|
|
402
442
|
setIsOpen(true);
|
|
403
443
|
}
|
|
404
444
|
}
|
|
405
|
-
}))), headerContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
445
|
+
}, attributesOfNativeInput)))), headerContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
406
446
|
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
407
447
|
}, headerContent)) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
408
448
|
ref: dropdownListRef,
|
|
@@ -421,7 +461,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
421
461
|
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
422
462
|
className: "".concat(RC, "__no-options")
|
|
423
463
|
}, noOptionsText)), footerContent || isMobile ? /*#__PURE__*/_react.default.createElement("div", {
|
|
424
|
-
className: (0, _classnames.default)("".concat(RC, "__footer"), (0, _defineProperty2.default)(
|
|
464
|
+
className: (0, _classnames.default)("".concat(RC, "__footer"), (_cn7 = {}, (0, _defineProperty2.default)(_cn7, "".concat(RC, "__footer-with-shadow"), isMobile && isScrollableList), (0, _defineProperty2.default)(_cn7, "".concat(RC, "__footer-with-shadow-hidden"), scrollTop === scrollHeight), _cn7))
|
|
425
465
|
}, footerContent, isMobile && /*#__PURE__*/_react.default.createElement("button", {
|
|
426
466
|
onClick: function onClick() {
|
|
427
467
|
return setIsOpen(false);
|
|
@@ -488,7 +528,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
488
528
|
}
|
|
489
529
|
}, [isOpen]);
|
|
490
530
|
(0, _react.useEffect)(function () {
|
|
491
|
-
if (isOpen && isMobile) {
|
|
531
|
+
if (isOpen && isMobile, dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
492
532
|
var _dropdownListRef$curr, _dropdownListRef$curr2;
|
|
493
533
|
|
|
494
534
|
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));
|
|
@@ -499,7 +539,31 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
499
539
|
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
540
|
}
|
|
501
541
|
}
|
|
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]);
|
|
542
|
+
}, [isOpen, isMobile, 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]);
|
|
543
|
+
(0, _react.useEffect)(function () {
|
|
544
|
+
var setScrollTopValue = function setScrollTopValue(e) {
|
|
545
|
+
setScrollTop(e.target.scrollTop);
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
549
|
+
var _dropdownListRef$curr7;
|
|
550
|
+
|
|
551
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener('scroll', setScrollTopValue);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return function () {
|
|
555
|
+
var _dropdownListRef$curr8;
|
|
556
|
+
|
|
557
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener('scroll', setScrollTopValue);
|
|
558
|
+
};
|
|
559
|
+
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
560
|
+
(0, _react.useEffect)(function () {
|
|
561
|
+
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
562
|
+
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
563
|
+
|
|
564
|
+
setScrollHeight((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));
|
|
565
|
+
}
|
|
566
|
+
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
503
567
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
504
568
|
className: (0, _classnames.default)(RC, className, (0, _defineProperty2.default)({}, "".concat(RC, "_disabled"), disabled)),
|
|
505
569
|
ref: dropdownRef
|
|
@@ -554,10 +618,15 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
554
618
|
placeholder: placeholder || 'Select from list',
|
|
555
619
|
onKeyDown: function onKeyDown(e) {
|
|
556
620
|
return onKeyPress(e, searchValue);
|
|
621
|
+
},
|
|
622
|
+
onFocus: function onFocus(e) {
|
|
623
|
+
var _e$target;
|
|
624
|
+
|
|
625
|
+
if (isMobile) e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.blur();
|
|
557
626
|
}
|
|
558
627
|
}, attributesOfNativeInput)) : '', isOpen && renderListContainer(), /*#__PURE__*/_react.default.createElement("span", {
|
|
559
628
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen))
|
|
560
|
-
}, isMobile ? /*#__PURE__*/_react.default.createElement(
|
|
629
|
+
}, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, null) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, {
|
|
561
630
|
className: "color--text"
|
|
562
631
|
}) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, {
|
|
563
632
|
className: "color--text"
|
|
@@ -353,6 +353,30 @@
|
|
|
353
353
|
background: unset!important;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
+
|
|
357
|
+
.input__close {
|
|
358
|
+
padding: $spacing-xs;
|
|
359
|
+
border-radius: 2px;
|
|
360
|
+
background: var(--bg-gray-box, #F0F1F4);
|
|
361
|
+
width: 24px;
|
|
362
|
+
min-width: 24px;
|
|
363
|
+
height: 24px;
|
|
364
|
+
box-sizing: border-box;
|
|
365
|
+
display: flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
|
|
368
|
+
&::before,
|
|
369
|
+
&::after {
|
|
370
|
+
height: 12px;
|
|
371
|
+
top: 50%;
|
|
372
|
+
transform: translateY(-50%) rotate(45deg);
|
|
373
|
+
border-radius: 8px;
|
|
374
|
+
background-color: #171D33;
|
|
375
|
+
}
|
|
376
|
+
&::after {
|
|
377
|
+
transform: translateY(-50%) rotate(-45deg);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
356
380
|
}
|
|
357
381
|
}
|
|
358
382
|
|
|
@@ -381,8 +405,9 @@
|
|
|
381
405
|
right: 0;
|
|
382
406
|
height: 100%;
|
|
383
407
|
padding: $spacing-m;
|
|
384
|
-
width:
|
|
385
|
-
height:
|
|
408
|
+
width: 50px;
|
|
409
|
+
height: 50px;
|
|
410
|
+
box-sizing: border-box;
|
|
386
411
|
|
|
387
412
|
svg {
|
|
388
413
|
width: 16px;
|
|
@@ -444,7 +469,17 @@
|
|
|
444
469
|
}
|
|
445
470
|
|
|
446
471
|
&__arrow {
|
|
447
|
-
top:
|
|
472
|
+
top: 11px!important;
|
|
473
|
+
width: 16px;
|
|
474
|
+
height: 16px;
|
|
475
|
+
display: flex;
|
|
476
|
+
align-items: center;
|
|
477
|
+
justify-content: center;
|
|
478
|
+
|
|
479
|
+
svg {
|
|
480
|
+
height: 12px;
|
|
481
|
+
transform: rotate(90deg);
|
|
482
|
+
}
|
|
448
483
|
}
|
|
449
484
|
|
|
450
485
|
&__no-options {
|