intelicoreact 1.3.54 → 1.3.56
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/ActionAlert/ActionAlert.js +9 -1
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +10 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.js +24 -4
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +10 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +14 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +54 -5
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +21 -3
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +153 -56
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +7 -1
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +52 -11
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +15 -3
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +29 -15
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +15 -5
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +26 -6
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +35 -19
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
- package/dist/Atomic/FormElements/Input/Input.js +57 -24
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
- package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +27 -6
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +42 -7
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +44 -14
- package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
- package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
- package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
- package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
- package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
- package/dist/Atomic/FormElements/Label/Label.js +9 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
- package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +72 -14
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +124 -40
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
- package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +156 -58
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +6 -0
- package/dist/Atomic/FormElements/Text/Text.js +16 -10
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +9 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -3
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +35 -6
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +13 -4
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +21 -7
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +35 -8
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +18 -5
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +10 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +11 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +12 -5
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +15 -3
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +20 -3
- package/dist/Atomic/Layout/Spinner/Spinner.js +8 -1
- package/dist/Atomic/UI/Accordion/Accordion.js +19 -3
- package/dist/Atomic/UI/Accordion/AccordionItem.js +23 -9
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +32 -7
- package/dist/Atomic/UI/AccordionText/AccordionText.js +15 -3
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +21 -4
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +15 -3
- package/dist/Atomic/UI/Alert/Alert.js +16 -3
- package/dist/Atomic/UI/Arrow/Arrow.js +16 -3
- package/dist/Atomic/UI/Box/Box.js +9 -3
- package/dist/Atomic/UI/Button/Button.js +11 -2
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +10 -1
- package/dist/Atomic/UI/Chart/Chart.js +29 -4
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +19 -11
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +12 -1
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -11
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +56 -82
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +19 -15
- package/dist/Atomic/UI/Chart/partial/utils.js +20 -6
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +13 -3
- package/dist/Atomic/UI/DateTime/DateTime.js +14 -3
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +16 -4
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +11 -3
- package/dist/Atomic/UI/DoubleString/DoubleString.js +17 -5
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +10 -3
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +52 -17
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +29 -1
- package/dist/Atomic/UI/Hint/Hint.js +30 -5
- package/dist/Atomic/UI/Modal/Modal.js +28 -6
- package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
- package/dist/Atomic/UI/ModalBackup/Modal.js +90 -65
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +21 -12
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +11 -6
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +19 -15
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
- package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
- package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
- package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
- package/dist/Atomic/UI/Price/Price.js +8 -3
- package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
- package/dist/Atomic/UI/Status/Status.js +8 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
- package/dist/Atomic/UI/Table/Table.js +12 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
- package/dist/Atomic/UI/Tag/Tag.js +14 -3
- package/dist/Atomic/UI/TagList/TagList.js +35 -19
- package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
- package/dist/Classes/AbortableFetch.js +93 -36
- package/dist/Classes/AnimatedHandler.js +7 -3
- package/dist/Classes/RESTAPI/index.js +43 -39
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
- package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +19 -7
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +35 -28
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +44 -21
- package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
- package/dist/Classes/RESTAPI/partials/_utils.js +36 -13
- package/dist/Constants/index.constants.js +15 -8
- package/dist/Functions/Portal.js +16 -5
- package/dist/Functions/customEventListener.js +17 -4
- package/dist/Functions/fieldValueFormatters.js +83 -43
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
- package/dist/Functions/locale/createTranslator.js +9 -4
- package/dist/Functions/operations.js +22 -12
- package/dist/Functions/presets/inputMaskPresets.js +11 -9
- package/dist/Functions/presets/inputPresets.js +11 -8
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
- package/dist/Functions/schemas.js +13 -6
- package/dist/Functions/useBodyScrollLock.js +6 -1
- package/dist/Functions/useClickOutside.js +4 -0
- package/dist/Functions/useDebounce.js +7 -2
- package/dist/Functions/useFieldFocus.js +18 -6
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
- package/dist/Functions/useFormTools/functions/General.js +28 -18
- package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
- package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
- package/dist/Functions/useFormTools/index.js +144 -85
- package/dist/Functions/useInputHighlightError.js +12 -3
- package/dist/Functions/useIsMobile.js +12 -7
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
- package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
- package/dist/Functions/useLocalStorage.js +9 -1
- package/dist/Functions/useLocationParams.js +5 -4
- package/dist/Functions/useMetaInfo.js +10 -3
- package/dist/Functions/useMouseUpOutside.js +3 -0
- package/dist/Functions/useOnlineStatus.js +9 -1
- package/dist/Functions/usePasswordChecker.js +20 -4
- package/dist/Functions/usePrevious.js +5 -1
- package/dist/Functions/useResize.js +10 -2
- package/dist/Functions/useScrollTo.js +7 -2
- package/dist/Functions/useToggle.js +5 -1
- package/dist/Functions/utils.js +128 -49
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
- package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
- package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
- package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
- package/dist/Molecular/CustomIcons/components/Button.js +9 -2
- package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
- package/dist/Molecular/CustomIcons/components/Check.js +9 -2
- package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/Close.js +9 -2
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
- package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
- package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
- package/dist/Molecular/CustomIcons/components/Email.js +9 -2
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
- package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
- package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
- package/dist/Molecular/CustomIcons/components/Home.js +9 -2
- package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
- package/dist/Molecular/CustomIcons/components/Key.js +9 -2
- package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
- package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
- package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
- package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
- package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
- package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
- package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
- package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
- package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
- package/dist/Molecular/CustomIcons/components/Play.js +9 -2
- package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
- package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
- package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
- package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
- package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
- package/dist/Molecular/CustomIcons/components/Star.js +9 -2
- package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
- package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
- package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
- package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
- package/dist/Molecular/CustomIcons/components/User.js +9 -2
- package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
- package/dist/Molecular/CustomIcons/components/X.js +9 -2
- package/dist/Molecular/CustomIcons/index.js +122 -0
- package/dist/Molecular/FormElement/FormElement.js +12 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
- package/dist/Molecular/InputAddress/InputAddress.js +114 -65
- package/dist/Molecular/InputPassword/InputPassword.js +19 -5
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,28 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
9
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
10
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
11
16
|
var _reactDom = require("react-dom");
|
|
17
|
+
|
|
12
18
|
var _reactFeather = require("react-feather");
|
|
19
|
+
|
|
13
20
|
var _Input = _interopRequireDefault(require("../../../Atomic/FormElements/Input/Input"));
|
|
21
|
+
|
|
14
22
|
var _RadioInput = _interopRequireDefault(require("../../../Atomic/FormElements/RadioInput/RadioInput"));
|
|
23
|
+
|
|
15
24
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
25
|
+
|
|
16
26
|
var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
27
|
+
|
|
17
28
|
var _utils = require("../../../Functions/utils");
|
|
29
|
+
|
|
18
30
|
var _DropdownLoader = _interopRequireDefault(require("./components/DropdownLoader"));
|
|
31
|
+
|
|
19
32
|
require("./Dropdown.scss");
|
|
20
|
-
|
|
21
|
-
function
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
22
38
|
const RC = "dropdown";
|
|
23
39
|
const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
40
|
+
|
|
24
41
|
const Dropdown = _ref => {
|
|
25
|
-
var _options$find,
|
|
42
|
+
var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find, _tabIndex$toString;
|
|
43
|
+
|
|
26
44
|
let {
|
|
27
45
|
label,
|
|
28
46
|
options = [],
|
|
@@ -73,22 +91,31 @@ const Dropdown = _ref => {
|
|
|
73
91
|
return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
|
|
74
92
|
if (item !== null && item !== void 0 && item.list || item !== null && item !== void 0 && item.items) {
|
|
75
93
|
var _item$list, _item$items;
|
|
76
|
-
|
|
94
|
+
|
|
95
|
+
result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || (item === null || item === void 0 ? void 0 : (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.length) || 0;
|
|
77
96
|
} else {
|
|
78
97
|
++result;
|
|
79
98
|
}
|
|
99
|
+
|
|
80
100
|
return result;
|
|
81
101
|
}, 0);
|
|
82
102
|
}, [options]);
|
|
83
|
-
|
|
103
|
+
|
|
104
|
+
if (isMobile) {
|
|
105
|
+
isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
|
|
106
|
+
}
|
|
107
|
+
|
|
84
108
|
const moveOtherToEnd = options => {
|
|
85
109
|
const otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => (option === null || option === void 0 ? void 0 : option.value) === "other");
|
|
110
|
+
|
|
86
111
|
if (otherIndex > -1) {
|
|
87
112
|
const other = options === null || options === void 0 ? void 0 : options.splice(otherIndex, 1);
|
|
88
113
|
options.push(...other);
|
|
89
114
|
}
|
|
115
|
+
|
|
90
116
|
return options;
|
|
91
117
|
};
|
|
118
|
+
|
|
92
119
|
const optionsWithOtherAtTheEnd = moveOtherToEnd(options);
|
|
93
120
|
options.map(option => {
|
|
94
121
|
if (option.items) {
|
|
@@ -97,40 +124,48 @@ const Dropdown = _ref => {
|
|
|
97
124
|
});
|
|
98
125
|
const filteredGroups = optionsWithOtherAtTheEnd.map(item => {
|
|
99
126
|
var _item$items2;
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
|
|
128
|
+
return { ...item,
|
|
102
129
|
items: !isSearchable || !isSearchChanged ? item === null || item === void 0 ? void 0 : item.items : (_item$items2 = item.items) === null || _item$items2 === void 0 ? void 0 : _item$items2.slice().filter(el => {
|
|
103
130
|
var _el$label;
|
|
104
|
-
|
|
131
|
+
|
|
132
|
+
return (el === null || el === void 0 ? void 0 : (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
|
|
105
133
|
})
|
|
106
134
|
};
|
|
107
135
|
}).filter(item => {
|
|
108
136
|
var _item$items3;
|
|
137
|
+
|
|
109
138
|
return ((_item$items3 = item.items) === null || _item$items3 === void 0 ? void 0 : _item$items3.length) > 0;
|
|
110
139
|
});
|
|
111
140
|
const filteredItems = optionsWithOtherAtTheEnd.filter(item => {
|
|
112
141
|
var _item$items4;
|
|
142
|
+
|
|
113
143
|
return !((_item$items4 = item.items) !== null && _item$items4 !== void 0 && _item$items4.length);
|
|
114
144
|
}).filter(item => {
|
|
115
145
|
var _item$label;
|
|
146
|
+
|
|
116
147
|
if (!isSearchable || !isSearchChanged) return true;
|
|
117
|
-
return (item === null || item === void 0
|
|
148
|
+
return (item === null || item === void 0 ? void 0 : (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === "";
|
|
118
149
|
});
|
|
119
150
|
const filteredOptions = [...filteredItems, ...filteredGroups];
|
|
120
151
|
const modalBtnTrigger = entity && entity !== "" && typeof entity === "string";
|
|
152
|
+
|
|
121
153
|
const onChangeHandler = item => {
|
|
122
154
|
setIsOpen(false);
|
|
123
155
|
onChange(item.value);
|
|
124
156
|
};
|
|
157
|
+
|
|
125
158
|
const onKeyDown = e => {
|
|
126
159
|
if (![9, 13].includes(e.keyCode)) return false;
|
|
127
160
|
setIsOpen(false);
|
|
128
161
|
};
|
|
162
|
+
|
|
129
163
|
const onKeyUp = e => {
|
|
130
164
|
if (![9, 13].includes(e.keyCode)) return false;
|
|
131
165
|
setIsOpen(true);
|
|
132
|
-
};
|
|
133
|
-
|
|
166
|
+
}; // decorator
|
|
167
|
+
|
|
168
|
+
|
|
134
169
|
const getDepends = getDependsTrigger => {
|
|
135
170
|
const newOnChange = e => {
|
|
136
171
|
if (e.value === "open_modal") {
|
|
@@ -138,9 +173,9 @@ const Dropdown = _ref => {
|
|
|
138
173
|
} else {
|
|
139
174
|
onChangeHandler(e);
|
|
140
175
|
}
|
|
141
|
-
};
|
|
176
|
+
}; // add pseudo option
|
|
177
|
+
|
|
142
178
|
|
|
143
|
-
// add pseudo option
|
|
144
179
|
const newOptions = [{
|
|
145
180
|
label: "New ".concat(entity),
|
|
146
181
|
value: "open_modal",
|
|
@@ -153,18 +188,22 @@ const Dropdown = _ref => {
|
|
|
153
188
|
options: getDependsTrigger ? newOptions : options
|
|
154
189
|
};
|
|
155
190
|
};
|
|
191
|
+
|
|
156
192
|
const handleClickOutside = event => {
|
|
157
193
|
var _getListContainer;
|
|
194
|
+
|
|
158
195
|
if (!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(event === null || event === void 0 ? void 0 : event.target)) && !(dropdownRef !== null && dropdownRef !== void 0 && dropdownRef.current.contains(event === null || event === void 0 ? void 0 : event.target))) {
|
|
159
196
|
setIsOpen(false);
|
|
160
197
|
}
|
|
161
198
|
};
|
|
199
|
+
|
|
162
200
|
const onSearchHandler = name => {
|
|
163
201
|
let inputValue = name;
|
|
164
202
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
165
203
|
setIsSearchChanged(true);
|
|
166
204
|
setSearchValue(inputValue);
|
|
167
205
|
};
|
|
206
|
+
|
|
168
207
|
const onWrapperClick = e => {
|
|
169
208
|
if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
|
|
170
209
|
e.stopPropagation();
|
|
@@ -172,10 +211,13 @@ const Dropdown = _ref => {
|
|
|
172
211
|
setIsOpen(false);
|
|
173
212
|
}
|
|
174
213
|
};
|
|
214
|
+
|
|
175
215
|
const hightlightedText = (text, postfix, description) => {
|
|
176
216
|
var _text;
|
|
217
|
+
|
|
177
218
|
const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
178
|
-
|
|
219
|
+
|
|
220
|
+
text = text.replace(/["&<>]/g, a => {
|
|
179
221
|
return {
|
|
180
222
|
'"': """,
|
|
181
223
|
"&": "&",
|
|
@@ -188,12 +230,15 @@ const Dropdown = _ref => {
|
|
|
188
230
|
const descriptionPart = description ? "<span class=\"dropdown__list-item-description\">".concat(description, "</span>") : "";
|
|
189
231
|
return main + postfixPart + descriptionPart;
|
|
190
232
|
};
|
|
233
|
+
|
|
191
234
|
const depend = getDepends(modalBtnTrigger);
|
|
235
|
+
|
|
192
236
|
const getMarkupForElement = (item, index, optTestId) => {
|
|
193
|
-
var _item$value, _item$value2, _item$customMobileIco;
|
|
237
|
+
var _item$value, _item$value$toString, _item$value2, _item$value2$toString, _item$customMobileIco;
|
|
238
|
+
|
|
194
239
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
195
|
-
"data-testid": "dropdown--button--key-".concat(optTestId || (item === null || item === void 0
|
|
196
|
-
key: (_item$value2 = item.value) === null || _item$value2 === void 0
|
|
240
|
+
"data-testid": "dropdown--button--key-".concat(optTestId || (item === null || item === void 0 ? void 0 : (_item$value = item.value) === null || _item$value === void 0 ? void 0 : (_item$value$toString = _item$value.toString()) === null || _item$value$toString === void 0 ? void 0 : _item$value$toString.replace(/\s/, "-")) || (item === null || item === void 0 ? void 0 : item.key) || "item", "--option"),
|
|
241
|
+
key: (_item$value2 = item.value) === null || _item$value2 === void 0 ? void 0 : (_item$value2$toString = _item$value2.toString()) === null || _item$value2$toString === void 0 ? void 0 : _item$value2$toString.replace(/ /g, "_"),
|
|
197
242
|
onMouseDown: () => depend.onChange(item),
|
|
198
243
|
className: (0, _classnames.default)("".concat(RC, "__list-item"), {
|
|
199
244
|
["".concat(RC, "__list-item_active")]: item.value === value,
|
|
@@ -213,18 +258,22 @@ const Dropdown = _ref => {
|
|
|
213
258
|
checked: value
|
|
214
259
|
}) : "");
|
|
215
260
|
};
|
|
261
|
+
|
|
216
262
|
const filteredOptionList = filteredOption => {
|
|
217
|
-
var _filteredOption$items, _filteredOption$label;
|
|
263
|
+
var _filteredOption$items, _filteredOption$label, _filteredOption$label2;
|
|
264
|
+
|
|
218
265
|
return ((_filteredOption$items = filteredOption.items) === null || _filteredOption$items === void 0 ? void 0 : _filteredOption$items.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
219
|
-
key: (_filteredOption$label = filteredOption.label) === null || _filteredOption$label === void 0
|
|
266
|
+
key: (_filteredOption$label = filteredOption.label) === null || _filteredOption$label === void 0 ? void 0 : (_filteredOption$label2 = _filteredOption$label.toString()) === null || _filteredOption$label2 === void 0 ? void 0 : _filteredOption$label2.replace(/ /g, "_").concat(Date.now()),
|
|
220
267
|
className: (0, _classnames.default)("".concat(RC, "-group"), filteredOption.className)
|
|
221
268
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
222
269
|
className: "".concat(RC, "-group__name")
|
|
223
270
|
}, filteredOption.label), filteredOption.items.map((el, index) => getMarkupForElement(el, index, el === null || el === void 0 ? void 0 : el.testId))) : null;
|
|
224
271
|
};
|
|
272
|
+
|
|
225
273
|
const selectedLabel = ((_options$find = options.find(el => el.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) || options.reduce((acc, item) => {
|
|
226
|
-
var _item$items5;
|
|
227
|
-
|
|
274
|
+
var _item$items5, _item$items5$find;
|
|
275
|
+
|
|
276
|
+
return acc || ((_item$items5 = item.items) === null || _item$items5 === void 0 ? void 0 : (_item$items5$find = _item$items5.find(el => el.value === value)) === null || _item$items5$find === void 0 ? void 0 : _item$items5$find.label);
|
|
228
277
|
}, null);
|
|
229
278
|
const doScrollCallback = (0, _react.useCallback)(e => {
|
|
230
279
|
const {
|
|
@@ -232,53 +281,70 @@ const Dropdown = _ref => {
|
|
|
232
281
|
isWithAnyScrolling,
|
|
233
282
|
scrollingInaccuracy = 0
|
|
234
283
|
} = scrollReactionObj || {};
|
|
284
|
+
|
|
235
285
|
if (callback && typeof callback === "function") {
|
|
236
|
-
if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight)
|
|
286
|
+
if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) {
|
|
287
|
+
callback(e);
|
|
288
|
+
}
|
|
237
289
|
}
|
|
238
290
|
}, [filteredOptions]);
|
|
291
|
+
|
|
239
292
|
const getParentNode = () => {
|
|
240
293
|
var _ref2, _document$querySelect;
|
|
294
|
+
|
|
241
295
|
if (isDoNotPullOutListOfMainContainer) return dropdownRef.current;
|
|
242
296
|
return (_ref2 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref2 !== void 0 ? _ref2 : document.querySelector("div#storybook-root");
|
|
243
297
|
};
|
|
298
|
+
|
|
244
299
|
const initListContainer = () => {
|
|
245
300
|
const dropdownList = document.createElement("div");
|
|
246
301
|
dropdownList.setAttribute("id", dropdownId);
|
|
247
302
|
dropdownList.classList.add("dropdown__container");
|
|
303
|
+
|
|
248
304
|
if (isMobile) {
|
|
249
305
|
dropdownList.addEventListener("click", e => {
|
|
250
306
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
251
307
|
});
|
|
252
308
|
}
|
|
309
|
+
|
|
253
310
|
try {
|
|
254
311
|
var _getListContainer2;
|
|
255
|
-
|
|
312
|
+
|
|
313
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
|
|
256
314
|
} finally {
|
|
257
315
|
if (isMobile) {
|
|
258
316
|
var _getParentNode;
|
|
317
|
+
|
|
259
318
|
try {
|
|
260
319
|
var _document$getElementB;
|
|
261
|
-
|
|
320
|
+
|
|
321
|
+
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
|
|
262
322
|
} catch (e) {}
|
|
323
|
+
|
|
263
324
|
const dropdownMobileListWrapper = document.createElement("div");
|
|
264
325
|
dropdownMobileListWrapper.classList.add("dropdown-mobile");
|
|
265
326
|
dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
|
|
266
|
-
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0
|
|
267
|
-
(_getParentNode = getParentNode()) === null || _getParentNode === void 0
|
|
327
|
+
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
|
|
328
|
+
(_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
|
|
268
329
|
} else {
|
|
269
330
|
var _getParentNode2;
|
|
270
|
-
|
|
331
|
+
|
|
332
|
+
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
|
|
271
333
|
}
|
|
272
334
|
}
|
|
273
335
|
};
|
|
336
|
+
|
|
274
337
|
const getListContainer = () => {
|
|
275
338
|
return document.getElementById(dropdownId);
|
|
276
339
|
};
|
|
340
|
+
|
|
277
341
|
const getListContainerWrapper = () => {
|
|
278
342
|
return document.getElementById("mlw-".concat(dropdownId));
|
|
279
343
|
};
|
|
344
|
+
|
|
280
345
|
const setListContainerStyles = () => {
|
|
281
|
-
var _dropdownRef$current$, _dropdownListWrapperR, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$max, _getComputedStyle2, _sw$getBoundingClient, _dropdownListWrapperR2, _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;
|
|
347
|
+
|
|
282
348
|
const lc = getListContainer();
|
|
283
349
|
if (!lc || !isOpen) return false;
|
|
284
350
|
const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
@@ -289,27 +355,30 @@ const Dropdown = _ref => {
|
|
|
289
355
|
top
|
|
290
356
|
} = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
|
|
291
357
|
const sw = lc.getElementsByClassName("dropdown__list")[0];
|
|
292
|
-
const lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0
|
|
293
|
-
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(
|
|
294
|
-
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(sw)) === null || _getComputedStyle2 === void 0
|
|
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];
|
|
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);
|
|
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);
|
|
295
361
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
296
362
|
const toTop = top - margin;
|
|
297
363
|
const toBottom = windowHeight - top - height - margin * 2;
|
|
298
|
-
const swHeight = sw === null || sw === void 0
|
|
299
|
-
const maxSwHeight = isMobile ? (dropdownListWrapperRef === null || dropdownListWrapperRef === void 0
|
|
364
|
+
const swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
365
|
+
const maxSwHeight = isMobile ? (dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR2 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR2 === void 0 ? void 0 : (_dropdownListWrapperR3 = _dropdownListWrapperR2.getBoundingClientRect()) === null || _dropdownListWrapperR3 === void 0 ? void 0 : _dropdownListWrapperR3.height) - (lh === null || lh === void 0 ? void 0 : (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) : toTop >= maxHeight || toBottom >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
300
366
|
const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
|
|
301
367
|
lc.style.minWidth = "".concat(width, "px");
|
|
302
368
|
lc.style.left = "".concat(left, "px");
|
|
303
|
-
lc.style.top = "".concat(listPos === "bottom" ? top + height : top -
|
|
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");
|
|
304
370
|
sw.style.maxHeight = "".concat(maxSwHeight, "px");
|
|
305
371
|
};
|
|
372
|
+
|
|
306
373
|
const renderListContainer = () => {
|
|
307
374
|
const lc = getListContainer();
|
|
308
375
|
if (!lc) return null;
|
|
309
376
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
310
377
|
};
|
|
378
|
+
|
|
311
379
|
const getSortedOptions = data => {
|
|
312
380
|
let newData = [...data];
|
|
381
|
+
|
|
313
382
|
if (sortAlphabetical) {
|
|
314
383
|
const openModalOption = newData.filter(_ref3 => {
|
|
315
384
|
let {
|
|
@@ -333,13 +402,17 @@ const Dropdown = _ref => {
|
|
|
333
402
|
if (item !== null && item !== void 0 && item.items) {
|
|
334
403
|
item.items = [...item.items].sort(_utils.compareAlphabetical);
|
|
335
404
|
}
|
|
405
|
+
|
|
336
406
|
return item;
|
|
337
407
|
});
|
|
338
408
|
}
|
|
409
|
+
|
|
339
410
|
return newData;
|
|
340
411
|
};
|
|
412
|
+
|
|
341
413
|
const getListMarkUp = () => {
|
|
342
414
|
var _getSortedOptions;
|
|
415
|
+
|
|
343
416
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
344
417
|
className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
|
|
345
418
|
ref: wrapperRef,
|
|
@@ -388,17 +461,19 @@ const Dropdown = _ref => {
|
|
|
388
461
|
ref: dropdownListRef
|
|
389
462
|
}, (_getSortedOptions = getSortedOptions(depend.options)) === null || _getSortedOptions === void 0 ? void 0 : _getSortedOptions.map(option => {
|
|
390
463
|
var _option$items, _option$label;
|
|
464
|
+
|
|
391
465
|
if (option !== null && option !== void 0 && (_option$items = option.items) !== null && _option$items !== void 0 && _option$items.length) {
|
|
392
466
|
if (!isSearchable || !isSearchChanged) {
|
|
393
467
|
return filteredOptionList(option);
|
|
394
468
|
} else {
|
|
395
469
|
var _option$items2;
|
|
470
|
+
|
|
396
471
|
const items = (_option$items2 = option.items) === null || _option$items2 === void 0 ? void 0 : _option$items2.slice().filter(el => {
|
|
397
472
|
var _el$label2;
|
|
398
|
-
|
|
473
|
+
|
|
474
|
+
return (el === null || el === void 0 ? void 0 : (_el$label2 = el.label) === null || _el$label2 === void 0 ? void 0 : _el$label2.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
|
|
399
475
|
});
|
|
400
|
-
if (items !== null && items !== void 0 && items.length) return filteredOptionList({
|
|
401
|
-
...option,
|
|
476
|
+
if (items !== null && items !== void 0 && items.length) return filteredOptionList({ ...option,
|
|
402
477
|
items
|
|
403
478
|
});
|
|
404
479
|
return null;
|
|
@@ -410,12 +485,14 @@ const Dropdown = _ref => {
|
|
|
410
485
|
className: "".concat(RC, "__list-item ").concat(RC, "__list-item--no-options")
|
|
411
486
|
}, noOptionsText), disabled && isOpen && /*#__PURE__*/_react.default.createElement(_DropdownLoader.default, null))));
|
|
412
487
|
};
|
|
488
|
+
|
|
413
489
|
const toggleList = e => {
|
|
414
|
-
e === null || e === void 0
|
|
490
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
415
491
|
setIsOpen(isOpen => {
|
|
416
492
|
return !isOpen;
|
|
417
493
|
});
|
|
418
494
|
};
|
|
495
|
+
|
|
419
496
|
const closeList = isOpen ? handleClickOutside : () => {};
|
|
420
497
|
(0, _react.useEffect)(() => {
|
|
421
498
|
if (!isDoNotPullOutListOfMainContainer || dropdownRef.current) {
|
|
@@ -424,6 +501,7 @@ const Dropdown = _ref => {
|
|
|
424
501
|
}, [isDoNotPullOutListOfMainContainer, dropdownRef.current]);
|
|
425
502
|
(0, _react.useLayoutEffect)(() => {
|
|
426
503
|
var _getListContainer3;
|
|
504
|
+
|
|
427
505
|
if (!isMobile) {
|
|
428
506
|
window.addEventListener("resize", setListContainerStyles);
|
|
429
507
|
window.addEventListener("mousewheel", closeList);
|
|
@@ -435,30 +513,34 @@ const Dropdown = _ref => {
|
|
|
435
513
|
window.removeEventListener("scroll", closeList);
|
|
436
514
|
window.removeEventListener("touchmove", closeList);
|
|
437
515
|
}
|
|
438
|
-
|
|
516
|
+
|
|
517
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
|
|
439
518
|
return () => {
|
|
440
519
|
var _getListContainer4;
|
|
520
|
+
|
|
441
521
|
window.removeEventListener("resize", setListContainerStyles);
|
|
442
522
|
window.removeEventListener("mousewheel", closeList);
|
|
443
523
|
window.removeEventListener("scroll", closeList);
|
|
444
524
|
window.removeEventListener("touchmove", closeList);
|
|
445
|
-
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0
|
|
525
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener("click", closeList);
|
|
446
526
|
};
|
|
447
527
|
}, [getListContainer]);
|
|
448
528
|
(0, _react.useLayoutEffect)(() => {
|
|
449
529
|
setListContainerStyles();
|
|
450
|
-
}, [isOpen, searchValue, isMobile, options, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0
|
|
530
|
+
}, [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]);
|
|
451
531
|
(0, _react.useEffect)(() => {
|
|
452
532
|
document.addEventListener("click", handleClickOutside, true);
|
|
453
533
|
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
454
|
-
}, [
|
|
534
|
+
}, []);
|
|
455
535
|
(0, _react.useEffect)(() => {
|
|
456
536
|
if (!isOpen) {
|
|
457
537
|
setIsSearchChanged(false);
|
|
458
538
|
}
|
|
539
|
+
|
|
459
540
|
if (scrollReactionObj && typeof scrollReactionObj === "object" && isOpen && dropdownListRef && dropdownListRef.current) {
|
|
460
541
|
dropdownListRef.current.addEventListener("scroll", doScrollCallback);
|
|
461
542
|
}
|
|
543
|
+
|
|
462
544
|
return () => {
|
|
463
545
|
if (scrollReactionObj && typeof scrollReactionObj === "object") removeEventListener("scroll", doScrollCallback);
|
|
464
546
|
};
|
|
@@ -468,20 +550,26 @@ const Dropdown = _ref => {
|
|
|
468
550
|
setSearchValue(selectedLabel);
|
|
469
551
|
setTimeout(() => searchInputRef.current.select(), 1);
|
|
470
552
|
}
|
|
553
|
+
|
|
471
554
|
if (!isSearchInputFocused && !isOpen) {
|
|
472
555
|
setSearchValue(null);
|
|
473
556
|
}
|
|
474
557
|
}, [isSearchInputFocused]);
|
|
475
558
|
(0, _react.useEffect)(() => {
|
|
476
559
|
var _searchInputRef$curre;
|
|
477
|
-
|
|
560
|
+
|
|
561
|
+
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();
|
|
562
|
+
|
|
478
563
|
if (isOpen) {
|
|
479
564
|
var _getListContainer5;
|
|
480
|
-
|
|
565
|
+
|
|
566
|
+
(_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.classList.add("dropdown__container--opened");
|
|
481
567
|
} else {
|
|
482
568
|
var _getListContainer6;
|
|
483
|
-
|
|
569
|
+
|
|
570
|
+
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove("dropdown__container--opened");
|
|
484
571
|
}
|
|
572
|
+
|
|
485
573
|
if (!isOpen && isMobile) {
|
|
486
574
|
setSearchValue(null);
|
|
487
575
|
}
|
|
@@ -489,34 +577,41 @@ const Dropdown = _ref => {
|
|
|
489
577
|
(0, _react.useEffect)(() => {
|
|
490
578
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
|
|
491
579
|
var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
492
|
-
|
|
493
|
-
|
|
580
|
+
|
|
581
|
+
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
|
+
setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
|
|
494
583
|
}
|
|
495
|
-
}, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0
|
|
584
|
+
}, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
|
|
496
585
|
(0, _react.useEffect)(() => {
|
|
497
586
|
const setScrollTopValue = e => {
|
|
498
587
|
setScrollTop(parseInt(e.target.scrollTop, 10));
|
|
499
588
|
};
|
|
589
|
+
|
|
500
590
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
501
591
|
var _dropdownListRef$curr7;
|
|
502
|
-
|
|
592
|
+
|
|
593
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
503
594
|
}
|
|
595
|
+
|
|
504
596
|
return () => {
|
|
505
597
|
var _dropdownListRef$curr8;
|
|
506
|
-
|
|
598
|
+
|
|
599
|
+
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
507
600
|
};
|
|
508
601
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
509
602
|
(0, _react.useEffect)(() => {
|
|
510
603
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
511
604
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
512
|
-
|
|
605
|
+
|
|
606
|
+
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), 10));
|
|
513
607
|
}
|
|
514
608
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
515
609
|
(0, _react.useEffect)(() => {
|
|
516
610
|
return () => {
|
|
517
611
|
var _getListContainer7, _getListContainerWrap;
|
|
518
|
-
|
|
519
|
-
(
|
|
612
|
+
|
|
613
|
+
(_getListContainer7 = getListContainer()) === null || _getListContainer7 === void 0 ? void 0 : _getListContainer7.remove();
|
|
614
|
+
(_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
|
|
520
615
|
};
|
|
521
616
|
}, []);
|
|
522
617
|
const postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(option => option.value === value)) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
|
|
@@ -531,10 +626,10 @@ const Dropdown = _ref => {
|
|
|
531
626
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
532
627
|
"data-testid": "dropdown--".concat(testId || "", "--container"),
|
|
533
628
|
className: "".concat(RC, "__trigger input__wrap ").concat(isOpen ? "input__wrap--focus" : "", " ").concat(!value ? "placeholder" : "", " ").concat(error ? "error" : ""),
|
|
534
|
-
onClick:
|
|
629
|
+
onClick: () => setIsOpen(true),
|
|
535
630
|
onKeyDown: onKeyDown,
|
|
536
631
|
onKeyUp: onKeyUp,
|
|
537
|
-
tabIndex: tabIndex === null || tabIndex === void 0
|
|
632
|
+
tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
|
|
538
633
|
}, customTrigger || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isSearchable && !isMobile ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
539
634
|
ref: searchInputRef,
|
|
540
635
|
className: "".concat(RC, "__input"),
|
|
@@ -563,4 +658,6 @@ const Dropdown = _ref => {
|
|
|
563
658
|
className: "mobile-icon"
|
|
564
659
|
}) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null)))), isOpen && renderListContainer());
|
|
565
660
|
};
|
|
566
|
-
|
|
661
|
+
|
|
662
|
+
var _default = Dropdown;
|
|
663
|
+
exports.default = _default;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
9
12
|
require("./DropdownLoader.scss");
|
|
13
|
+
|
|
10
14
|
const DropdownLoader = function (_ref) {
|
|
11
15
|
let {
|
|
12
16
|
variant
|
|
@@ -17,4 +21,6 @@ const DropdownLoader = function (_ref) {
|
|
|
17
21
|
className: "lds-ring".concat(variant === "little" ? " lds-ring_little" : "")
|
|
18
22
|
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null)));
|
|
19
23
|
};
|
|
20
|
-
|
|
24
|
+
|
|
25
|
+
var _default = DropdownLoader;
|
|
26
|
+
exports.default = _default;
|