intelicoreact 1.3.19 → 1.3.21
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 +23 -15
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +23 -15
- package/dist/Atomic/FormElements/Calendar/Calendar.js +124 -69
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +36 -27
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +39 -23
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +246 -110
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +85 -44
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +414 -246
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +9 -5
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +165 -93
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +64 -39
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +132 -51
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +73 -34
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +75 -54
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +110 -67
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +83 -33
- package/dist/Atomic/FormElements/Input/Input.js +253 -161
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +102 -48
- package/dist/Atomic/FormElements/InputColor/InputColor.js +40 -27
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +58 -28
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +176 -108
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +57 -32
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +302 -184
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +157 -85
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +16 -11
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +193 -76
- package/dist/Atomic/FormElements/InputLink/InputLink.js +58 -34
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +12 -8
- package/dist/Atomic/FormElements/InputMask/InputMask.js +964 -554
- package/dist/Atomic/FormElements/InputMask/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +43 -17
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +404 -268
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +43 -17
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +459 -299
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask3/functions.js +43 -17
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +113 -53
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +118 -64
- package/dist/Atomic/FormElements/Label/Label.js +23 -13
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +349 -217
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +47 -25
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +207 -133
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +61 -29
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +42 -20
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +33 -22
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +43 -20
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +101 -54
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +102 -59
- package/dist/Atomic/FormElements/RangeList/RangeList.js +150 -89
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +29 -23
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +300 -135
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +571 -381
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +24 -14
- package/dist/Atomic/FormElements/Switcher/Switcher.js +29 -24
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +47 -25
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +32 -20
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +55 -32
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +42 -22
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +33 -23
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +120 -51
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +46 -23
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +417 -253
- package/dist/Atomic/FormElements/Text/Text.js +53 -47
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +31 -21
- package/dist/Atomic/FormElements/Textarea/Textarea.js +27 -16
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +128 -68
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +36 -25
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +70 -33
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +124 -58
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +80 -48
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +42 -32
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +60 -40
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +3 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +69 -50
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +48 -21
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +79 -36
- package/dist/Atomic/Layout/Spinner/Spinner.js +14 -8
- package/dist/Atomic/UI/Accordion/Accordion.js +48 -18
- package/dist/Atomic/UI/Accordion/AccordionItem.js +60 -35
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +106 -49
- package/dist/Atomic/UI/AccordionText/AccordionText.js +37 -13
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +94 -48
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +50 -22
- package/dist/Atomic/UI/Alert/Alert.js +44 -20
- package/dist/Atomic/UI/Arrow/Arrow.js +35 -15
- package/dist/Atomic/UI/Box/Box.js +21 -14
- package/dist/Atomic/UI/Button/Button.js +35 -26
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +31 -22
- package/dist/Atomic/UI/Chart/Chart.js +86 -45
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +24 -14
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +22 -13
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +113 -68
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +140 -158
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +42 -26
- package/dist/Atomic/UI/Chart/partial/utils.js +48 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +42 -22
- package/dist/Atomic/UI/DateTime/DateTime.js +38 -23
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +36 -12
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +21 -5
- package/dist/Atomic/UI/DoubleString/DoubleString.js +50 -27
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +63 -15
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +157 -62
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +110 -47
- package/dist/Atomic/UI/Hint/Hint.js +94 -49
- package/dist/Atomic/UI/Modal/Modal.js +179 -149
- package/dist/Atomic/UI/Modal/ModalHOC.js +21 -12
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +12 -7
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +21 -17
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +167 -94
- 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 +62 -32
- package/dist/Atomic/UI/NavLine/NavLine.js +211 -120
- package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.js +17 -13
- package/dist/Atomic/UI/PieChart/PieChart.js +21 -11
- package/dist/Atomic/UI/Price/Price.js +13 -10
- package/dist/Atomic/UI/PriceRange/PriceRange.js +11 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +56 -27
- package/dist/Atomic/UI/Status/Status.js +30 -19
- package/dist/Atomic/UI/Table/Partials/TdCell.js +71 -28
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +16 -7
- package/dist/Atomic/UI/Table/Partials/TdRow.js +65 -29
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +40 -16
- package/dist/Atomic/UI/Table/Table.js +47 -27
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +48 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +19 -9
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +8 -5
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +47 -25
- package/dist/Atomic/UI/Tag/Tag.js +48 -20
- package/dist/Atomic/UI/TagList/TagList.js +150 -80
- package/dist/Atomic/UI/UserBox/UserBox.js +26 -14
- package/dist/Classes/AbortableFetch.js +422 -283
- package/dist/Classes/AnimatedHandler.js +56 -44
- package/dist/Classes/RESTAPI/index.js +433 -154
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +428 -290
- package/dist/Classes/RESTAPI/partials/ApiBase.js +67 -24
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +275 -57
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +377 -146
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +403 -155
- package/dist/Classes/RESTAPI/partials/Utils.js +135 -81
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
- package/dist/Classes/RESTAPI/partials/_utils.js +395 -101
- package/dist/Constants/index.constants.js +15 -8
- package/dist/Functions/Portal.js +33 -14
- package/dist/Functions/customEventListener.js +20 -5
- package/dist/Functions/fieldValueFormatters.js +211 -148
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +137 -75
- package/dist/Functions/locale/createTranslator.js +27 -13
- package/dist/Functions/operations.js +49 -35
- package/dist/Functions/presets/inputMaskPresets.js +27 -25
- package/dist/Functions/presets/inputPresets.js +22 -19
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
- package/dist/Functions/schemas.js +15 -6
- package/dist/Functions/useClickOutside.js +7 -3
- package/dist/Functions/useDebounce.js +25 -11
- package/dist/Functions/useFieldFocus.js +67 -42
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +54 -35
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +95 -74
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +91 -55
- package/dist/Functions/useFormTools/functions/General.js +99 -80
- package/dist/Functions/useFormTools/functions/RenderFields.js +72 -45
- package/dist/Functions/useFormTools/functions/usePrevious.js +7 -3
- package/dist/Functions/useFormTools/index.js +598 -382
- package/dist/Functions/useInputHighlightError.js +52 -27
- package/dist/Functions/useIsMobile.js +36 -13
- package/dist/Functions/useLocalStorage.js +22 -7
- package/dist/Functions/useLocationParams.js +27 -16
- package/dist/Functions/useMetaInfo.js +50 -19
- package/dist/Functions/useMouseUpOutside.js +5 -2
- package/dist/Functions/useOnlineStatus.js +26 -7
- package/dist/Functions/usePasswordChecker.js +77 -42
- package/dist/Functions/usePrevious.js +7 -3
- package/dist/Functions/useResize.js +32 -12
- package/dist/Functions/useScrollTo.js +20 -6
- package/dist/Functions/useToggle.js +30 -10
- package/dist/Functions/utils.js +366 -186
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +32 -21
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +32 -21
- package/dist/Molecular/CustomIcons/components/AppStore.js +36 -25
- package/dist/Molecular/CustomIcons/components/Arrow.js +42 -31
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +24 -13
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +27 -16
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +27 -16
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +24 -13
- package/dist/Molecular/CustomIcons/components/Bell.js +22 -11
- package/dist/Molecular/CustomIcons/components/Button.js +22 -11
- package/dist/Molecular/CustomIcons/components/Campaigns.js +23 -12
- package/dist/Molecular/CustomIcons/components/Check.js +23 -12
- package/dist/Molecular/CustomIcons/components/Check2.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +37 -26
- package/dist/Molecular/CustomIcons/components/Close.js +24 -13
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +49 -38
- package/dist/Molecular/CustomIcons/components/Delete.js +23 -12
- package/dist/Molecular/CustomIcons/components/Edit.js +22 -11
- package/dist/Molecular/CustomIcons/components/Email.js +40 -29
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +30 -19
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +38 -27
- package/dist/Molecular/CustomIcons/components/Flows.js +22 -11
- package/dist/Molecular/CustomIcons/components/Gift.js +27 -16
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +36 -25
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +36 -25
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +25 -14
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +26 -15
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +25 -14
- package/dist/Molecular/CustomIcons/components/Home.js +25 -14
- package/dist/Molecular/CustomIcons/components/Home2.js +28 -17
- package/dist/Molecular/CustomIcons/components/Key.js +30 -19
- package/dist/Molecular/CustomIcons/components/Landers.js +26 -15
- package/dist/Molecular/CustomIcons/components/Lock.js +22 -11
- package/dist/Molecular/CustomIcons/components/Mail.js +30 -19
- package/dist/Molecular/CustomIcons/components/Mastercard.js +72 -61
- package/dist/Molecular/CustomIcons/components/Minus.js +35 -24
- package/dist/Molecular/CustomIcons/components/Offers.js +23 -12
- package/dist/Molecular/CustomIcons/components/Pause.js +35 -24
- package/dist/Molecular/CustomIcons/components/PayPal.js +49 -38
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +36 -25
- package/dist/Molecular/CustomIcons/components/Phone.js +37 -26
- package/dist/Molecular/CustomIcons/components/Play.js +35 -24
- package/dist/Molecular/CustomIcons/components/Plus.js +35 -24
- package/dist/Molecular/CustomIcons/components/Profile.js +27 -16
- package/dist/Molecular/CustomIcons/components/QRCode.js +37 -26
- package/dist/Molecular/CustomIcons/components/Rectangle.js +22 -11
- package/dist/Molecular/CustomIcons/components/Revert.js +25 -14
- package/dist/Molecular/CustomIcons/components/Star.js +21 -10
- package/dist/Molecular/CustomIcons/components/Star2.js +23 -12
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +25 -14
- package/dist/Molecular/CustomIcons/components/Trash.js +22 -11
- package/dist/Molecular/CustomIcons/components/TrashRed.js +22 -11
- package/dist/Molecular/CustomIcons/components/Triggers.js +22 -11
- package/dist/Molecular/CustomIcons/components/User.js +27 -16
- package/dist/Molecular/CustomIcons/components/Visa.js +38 -27
- package/dist/Molecular/CustomIcons/components/X.js +22 -11
- package/dist/Molecular/CustomIcons/index.js +183 -61
- package/dist/Molecular/FormElement/FormElement.js +27 -18
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +108 -86
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +34 -29
- package/dist/Molecular/InputAddress/InputAddress.js +312 -176
- package/dist/Molecular/InputPassword/InputPassword.js +39 -15
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,155 +1,254 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
4
7
|
Object.defineProperty(exports, "__esModule", {
|
|
5
8
|
value: true
|
|
6
9
|
});
|
|
7
10
|
exports.default = void 0;
|
|
11
|
+
|
|
8
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
+
|
|
18
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
+
|
|
9
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
10
22
|
var _reactDom = require("react-dom");
|
|
23
|
+
|
|
11
24
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
|
+
|
|
12
26
|
var _reactFeather = require("react-feather");
|
|
27
|
+
|
|
13
28
|
var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
|
|
29
|
+
|
|
14
30
|
var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
|
|
31
|
+
|
|
15
32
|
var _CheckboxInput = _interopRequireDefault(require("../../FormElements/CheckboxInput/CheckboxInput"));
|
|
33
|
+
|
|
16
34
|
var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
|
|
35
|
+
|
|
17
36
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
18
|
-
|
|
37
|
+
|
|
38
|
+
var _useIsMobile2 = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
39
|
+
|
|
19
40
|
require("./TagsDropdown.scss");
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
41
|
+
|
|
42
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
+
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
|
+
|
|
50
|
+
var RC = 'tags-dropdown';
|
|
51
|
+
var MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
52
|
+
|
|
53
|
+
var TagsDropdown = function TagsDropdown(_ref) {
|
|
54
|
+
var _dropdownListWrapperR, _dropdownListWrapperR2, _dropdownListRef$curr5, _dropdownListRef$curr6, _cn8;
|
|
55
|
+
|
|
56
|
+
var options = _ref.options,
|
|
57
|
+
_ref$chosenOptions = _ref.chosenOptions,
|
|
58
|
+
chosenOptions = _ref$chosenOptions === void 0 ? [] : _ref$chosenOptions,
|
|
59
|
+
onChange = _ref.onChange,
|
|
60
|
+
className = _ref.className,
|
|
61
|
+
tagClassname = _ref.tagClassname,
|
|
62
|
+
_ref$onKeyPress = _ref.onKeyPress,
|
|
63
|
+
onKeyPress = _ref$onKeyPress === void 0 ? function () {} : _ref$onKeyPress,
|
|
64
|
+
placeholder = _ref.placeholder,
|
|
65
|
+
label = _ref.label,
|
|
66
|
+
isLabelBold = _ref.isLabelBold,
|
|
67
|
+
hint = _ref.hint,
|
|
68
|
+
hintSide = _ref.hintSide,
|
|
69
|
+
disabled = _ref.disabled,
|
|
70
|
+
isValuesInTags = _ref.isValuesInTags,
|
|
71
|
+
error = _ref.error,
|
|
72
|
+
_ref$isNotValidateASC = _ref.isNotValidateASCII,
|
|
73
|
+
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
|
|
74
|
+
_ref$noTagsWrap = _ref.noTagsWrap,
|
|
75
|
+
noTagsWrap = _ref$noTagsWrap === void 0 ? false : _ref$noTagsWrap,
|
|
76
|
+
_ref$headerContent = _ref.headerContent,
|
|
77
|
+
headerContent = _ref$headerContent === void 0 ? null : _ref$headerContent,
|
|
78
|
+
_ref$footerContent = _ref.footerContent,
|
|
79
|
+
footerContent = _ref$footerContent === void 0 ? null : _ref$footerContent,
|
|
80
|
+
_ref$selectAllButtonR = _ref.selectAllButtonRef,
|
|
81
|
+
selectAllButtonRef = _ref$selectAllButtonR === void 0 ? null : _ref$selectAllButtonR,
|
|
82
|
+
_ref$unselectAllButto = _ref.unselectAllButtonRef,
|
|
83
|
+
unselectAllButtonRef = _ref$unselectAllButto === void 0 ? null : _ref$unselectAllButto,
|
|
84
|
+
_ref$closeOnSelect = _ref.closeOnSelect,
|
|
85
|
+
closeOnSelect = _ref$closeOnSelect === void 0 ? false : _ref$closeOnSelect,
|
|
86
|
+
_ref$closeOnRemove = _ref.closeOnRemove,
|
|
87
|
+
closeOnRemove = _ref$closeOnRemove === void 0 ? false : _ref$closeOnRemove,
|
|
88
|
+
_ref$closeOnRemoveAll = _ref.closeOnRemoveAll,
|
|
89
|
+
closeOnRemoveAll = _ref$closeOnRemoveAll === void 0 ? false : _ref$closeOnRemoveAll,
|
|
90
|
+
_ref$closeOnSelectAll = _ref.closeOnSelectAll,
|
|
91
|
+
closeOnSelectAll = _ref$closeOnSelectAll === void 0 ? false : _ref$closeOnSelectAll,
|
|
92
|
+
_ref$closeOnSelectMob = _ref.closeOnSelectMobile,
|
|
93
|
+
closeOnSelectMobile = _ref$closeOnSelectMob === void 0 ? false : _ref$closeOnSelectMob,
|
|
94
|
+
_ref$closeOnRemoveMob = _ref.closeOnRemoveMobile,
|
|
95
|
+
closeOnRemoveMobile = _ref$closeOnRemoveMob === void 0 ? false : _ref$closeOnRemoveMob,
|
|
96
|
+
_ref$closeOnRemoveAll2 = _ref.closeOnRemoveAllMobile,
|
|
97
|
+
closeOnRemoveAllMobile = _ref$closeOnRemoveAll2 === void 0 ? false : _ref$closeOnRemoveAll2,
|
|
98
|
+
_ref$closeOnSelectAll2 = _ref.closeOnSelectAllMobile,
|
|
99
|
+
closeOnSelectAllMobile = _ref$closeOnSelectAll2 === void 0 ? false : _ref$closeOnSelectAll2,
|
|
100
|
+
fieldKey = _ref.fieldKey,
|
|
101
|
+
id = _ref.id,
|
|
102
|
+
_ref$noOptionsText = _ref.noOptionsText,
|
|
103
|
+
noOptionsText = _ref$noOptionsText === void 0 ? 'No options available' : _ref$noOptionsText,
|
|
104
|
+
mobileSearchPlaceholder = _ref.mobileSearchPlaceholder,
|
|
105
|
+
_ref$isSearchable = _ref.isSearchable,
|
|
106
|
+
isSearchable = _ref$isSearchable === void 0 ? true : _ref$isSearchable,
|
|
107
|
+
_ref$attributesOfNati = _ref.attributesOfNativeInput,
|
|
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;
|
|
112
|
+
|
|
113
|
+
var _useIsMobile = (0, _useIsMobile2.default)(),
|
|
114
|
+
isMobileProp = _useIsMobile.isMobile;
|
|
115
|
+
|
|
116
|
+
var isMobile = isMobileProp && withMobileLogic;
|
|
117
|
+
|
|
118
|
+
var _useState = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2)),
|
|
119
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
120
|
+
dropdownId = _useState2[0],
|
|
121
|
+
setDropdownId = _useState2[1];
|
|
122
|
+
|
|
123
|
+
var _useState3 = (0, _react.useState)(false),
|
|
124
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
125
|
+
isOpen = _useState4[0],
|
|
126
|
+
setIsOpen = _useState4[1];
|
|
127
|
+
|
|
128
|
+
var _useState5 = (0, _react.useState)(''),
|
|
129
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
130
|
+
searchValue = _useState6[0],
|
|
131
|
+
setSearchValue = _useState6[1];
|
|
132
|
+
|
|
133
|
+
var dropdownRef = (0, _react.useRef)(null);
|
|
134
|
+
var dropdownListRef = (0, _react.useRef)(null);
|
|
135
|
+
var dropdownListWrapperRef = (0, _react.useRef)(null);
|
|
136
|
+
var inputRef = (0, _react.useRef)(null);
|
|
137
|
+
var wrapperRef = (0, _react.useRef)(null);
|
|
138
|
+
|
|
139
|
+
var _useState7 = (0, _react.useState)(null),
|
|
140
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
141
|
+
initListHeight = _useState8[0],
|
|
142
|
+
setInitListHeight = _useState8[1];
|
|
143
|
+
|
|
144
|
+
var _useState9 = (0, _react.useState)(null),
|
|
145
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
146
|
+
isScrollableList = _useState10[0],
|
|
147
|
+
setIsScrollableList = _useState10[1];
|
|
148
|
+
|
|
149
|
+
var _useState11 = (0, _react.useState)(false),
|
|
150
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
151
|
+
isFixedMaxHeight = _useState12[0],
|
|
152
|
+
setIsFixedMaxHeight = _useState12[1];
|
|
153
|
+
|
|
154
|
+
var _useState13 = (0, _react.useState)(0),
|
|
155
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
156
|
+
scrollTop = _useState14[0],
|
|
157
|
+
setScrollTop = _useState14[1];
|
|
158
|
+
|
|
159
|
+
var _useState15 = (0, _react.useState)(1),
|
|
160
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
161
|
+
scrollHeight = _useState16[0],
|
|
162
|
+
setScrollHeight = _useState16[1];
|
|
163
|
+
|
|
164
|
+
var singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce(function (acc, item) {
|
|
165
|
+
return [].concat((0, _toConsumableArray2.default)(acc), (0, _toConsumableArray2.default)(item.groupName ? item.list : [item]));
|
|
166
|
+
}, []);
|
|
167
|
+
|
|
168
|
+
var handleClickOutside = function handleClickOutside(_ref2) {
|
|
83
169
|
var _getListContainer;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target))
|
|
170
|
+
|
|
171
|
+
var target = _ref2.target;
|
|
172
|
+
|
|
173
|
+
if (!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target))
|
|
174
|
+
/* && !isTargetInParent(target) */
|
|
175
|
+
) {
|
|
88
176
|
setIsOpen(false);
|
|
89
177
|
setSearchValue('');
|
|
90
178
|
}
|
|
91
179
|
};
|
|
92
|
-
|
|
180
|
+
|
|
181
|
+
var deleteChosen = function deleteChosen(value) {
|
|
93
182
|
if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
|
|
94
|
-
onChange(chosenOptions.filter(
|
|
183
|
+
onChange(chosenOptions.filter(function (item) {
|
|
184
|
+
return item !== value;
|
|
185
|
+
}), 'chosenOptions');
|
|
95
186
|
};
|
|
96
|
-
|
|
187
|
+
|
|
188
|
+
var onChangeHandler = function onChangeHandler(item) {
|
|
97
189
|
if (item !== null && item !== void 0 && item.isFreezed) return false;
|
|
190
|
+
|
|
98
191
|
if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
|
|
99
192
|
if (item.closeOnOptionSelect) setIsOpen(false);
|
|
100
193
|
} else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
|
|
194
|
+
|
|
101
195
|
setSearchValue('');
|
|
102
|
-
|
|
196
|
+
|
|
197
|
+
if (chosenOptions.some(function (el) {
|
|
198
|
+
return el === item.value;
|
|
199
|
+
})) {
|
|
103
200
|
deleteChosen(item.value);
|
|
104
201
|
return null;
|
|
105
202
|
}
|
|
106
|
-
|
|
203
|
+
|
|
204
|
+
onChange([].concat((0, _toConsumableArray2.default)(chosenOptions), [item.value]), 'chosenOptions');
|
|
107
205
|
return null;
|
|
108
206
|
};
|
|
109
|
-
|
|
110
|
-
|
|
207
|
+
|
|
208
|
+
var onSearchHandler = function onSearchHandler(name) {
|
|
209
|
+
var inputValue = name;
|
|
111
210
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
112
211
|
setSearchValue(inputValue);
|
|
113
212
|
};
|
|
114
|
-
|
|
213
|
+
|
|
214
|
+
var onWrapperClick = function onWrapperClick(e) {
|
|
115
215
|
if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
|
|
116
216
|
e.stopPropagation();
|
|
117
217
|
e.preventDefault();
|
|
118
218
|
setIsOpen(false);
|
|
119
219
|
}
|
|
120
220
|
};
|
|
121
|
-
|
|
221
|
+
|
|
222
|
+
var getMarkupForElement = function getMarkupForElement(item) {
|
|
122
223
|
var _title$toString;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
224
|
+
|
|
225
|
+
var description = item.description;
|
|
226
|
+
var title = item.title || item.label;
|
|
227
|
+
|
|
228
|
+
var hightlightSearchValue = function hightlightSearchValue(title) {
|
|
128
229
|
var _title$toLowerCase;
|
|
129
|
-
|
|
230
|
+
|
|
231
|
+
var index = (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue.toLowerCase());
|
|
130
232
|
if (index === -1) return title;
|
|
131
233
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, title.substring(0, index), /*#__PURE__*/_react.default.createElement("span", {
|
|
132
234
|
className: "search-match"
|
|
133
235
|
}, title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))), title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length)));
|
|
134
236
|
};
|
|
237
|
+
|
|
135
238
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
136
|
-
key: title === null || title === void 0
|
|
137
|
-
onClick: e
|
|
239
|
+
key: title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, '_'),
|
|
240
|
+
onClick: function onClick(e) {
|
|
138
241
|
e.preventDefault();
|
|
139
242
|
e.stopPropagation();
|
|
140
243
|
onChangeHandler(item);
|
|
141
244
|
},
|
|
142
|
-
className: (0, _classnames.default)("".concat(RC, "__list-item"), {
|
|
143
|
-
|
|
144
|
-
}, {
|
|
145
|
-
["".concat(RC, "__list-item_disabled")]: item.disabled
|
|
146
|
-
}, {
|
|
147
|
-
["".concat(RC, "__list-item_freezed")]: item === null || item === void 0 ? void 0 : item.isFreezed
|
|
148
|
-
}, item.className)
|
|
245
|
+
className: (0, _classnames.default)("".concat(RC, "__list-item"), (0, _defineProperty2.default)({}, "".concat(RC, "__list-item_active"), chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
246
|
+
return value === item.value;
|
|
247
|
+
})), (0, _defineProperty2.default)({}, "".concat(RC, "__list-item_disabled"), item.disabled), (0, _defineProperty2.default)({}, "".concat(RC, "__list-item_freezed"), item === null || item === void 0 ? void 0 : item.isFreezed), item.className)
|
|
149
248
|
}, !isMobile && /*#__PURE__*/_react.default.createElement("span", {
|
|
150
|
-
className: (0, _classnames.default)("".concat(RC, "__active-icon"), {
|
|
151
|
-
|
|
152
|
-
})
|
|
249
|
+
className: (0, _classnames.default)("".concat(RC, "__active-icon"), (0, _defineProperty2.default)({}, "".concat(RC, "__active-icon_active"), chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
250
|
+
return value === item.value;
|
|
251
|
+
})))
|
|
153
252
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, {
|
|
154
253
|
width: 16,
|
|
155
254
|
height: 16,
|
|
@@ -161,63 +260,73 @@ const TagsDropdown = _ref => {
|
|
|
161
260
|
}, hightlightSearchValue(title)), description && /*#__PURE__*/_react.default.createElement("span", {
|
|
162
261
|
className: (0, _classnames.default)("".concat(RC, "__list-item-description"))
|
|
163
262
|
}, description)), isMobile && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
164
|
-
value: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(
|
|
165
|
-
|
|
263
|
+
value: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(function (value) {
|
|
264
|
+
return value === item.value;
|
|
265
|
+
}),
|
|
266
|
+
onChange: function onChange(v) {
|
|
166
267
|
onChangeHandler(item);
|
|
167
268
|
}
|
|
168
269
|
}));
|
|
169
270
|
};
|
|
170
|
-
|
|
171
|
-
|
|
271
|
+
|
|
272
|
+
var prepareOptions = function prepareOptions(options) {
|
|
273
|
+
return options === null || options === void 0 ? void 0 : options.map(function (option) {
|
|
274
|
+
return option !== null && option !== void 0 && option.groupName ? option === null || option === void 0 ? void 0 : option.list : option;
|
|
275
|
+
}).flat();
|
|
172
276
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
277
|
+
|
|
278
|
+
var selectAllItems = function selectAllItems(e) {
|
|
279
|
+
var _prepareOptions, _prepareOptions$filte;
|
|
280
|
+
|
|
281
|
+
onChange([].concat((0, _toConsumableArray2.default)(chosenOptions), (0, _toConsumableArray2.default)(((_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : (_prepareOptions$filte = _prepareOptions.filter(function (_ref3) {
|
|
282
|
+
var isFreezed = _ref3.isFreezed,
|
|
283
|
+
value = _ref3.value;
|
|
180
284
|
return !isFreezed && !(chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.includes(value)) && value !== 'open_modal';
|
|
181
|
-
})) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.map(_ref4
|
|
182
|
-
|
|
183
|
-
value
|
|
184
|
-
} = _ref4;
|
|
285
|
+
})) === null || _prepareOptions$filte === void 0 ? void 0 : _prepareOptions$filte.map(function (_ref4) {
|
|
286
|
+
var value = _ref4.value;
|
|
185
287
|
return value;
|
|
186
|
-
})) || [])
|
|
288
|
+
})) || [])), 'chosenOptions');
|
|
187
289
|
if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
|
|
188
290
|
};
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
291
|
+
|
|
292
|
+
var unselectAllItems = function unselectAllItems(e) {
|
|
293
|
+
onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter(function (item) {
|
|
294
|
+
var _prepareOptions2, _prepareOptions2$find;
|
|
295
|
+
|
|
296
|
+
return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 ? void 0 : (_prepareOptions2$find = _prepareOptions2.find(function (_ref5) {
|
|
297
|
+
var value = _ref5.value;
|
|
196
298
|
return value === item;
|
|
197
|
-
})) === null || _prepareOptions2 === void 0 ? void 0 : _prepareOptions2.isFreezed;
|
|
299
|
+
})) === null || _prepareOptions2$find === void 0 ? void 0 : _prepareOptions2$find.isFreezed;
|
|
198
300
|
}), 'chosenOptions');
|
|
199
301
|
if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
|
|
200
302
|
};
|
|
201
|
-
|
|
303
|
+
|
|
304
|
+
var getParentNode = function getParentNode() {
|
|
202
305
|
var _document$querySelect;
|
|
306
|
+
|
|
203
307
|
return (_document$querySelect = document.querySelector('div#root')) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('div#app');
|
|
204
308
|
};
|
|
205
|
-
|
|
206
|
-
|
|
309
|
+
|
|
310
|
+
var initListContainer = function initListContainer() {
|
|
311
|
+
var dropdownList = document.createElement('div');
|
|
207
312
|
dropdownList.setAttribute('id', dropdownId);
|
|
208
313
|
dropdownList.classList.add('tags-dropdown__container');
|
|
314
|
+
|
|
209
315
|
if (isMobile) {
|
|
210
|
-
dropdownList.addEventListener('click', e
|
|
316
|
+
dropdownList.addEventListener('click', function (e) {
|
|
211
317
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
212
318
|
});
|
|
213
319
|
}
|
|
320
|
+
|
|
214
321
|
if (isMobile) {
|
|
215
322
|
try {
|
|
216
323
|
var _document$getElementB;
|
|
217
|
-
|
|
324
|
+
|
|
325
|
+
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
|
|
218
326
|
} catch (e) {}
|
|
327
|
+
|
|
219
328
|
;
|
|
220
|
-
|
|
329
|
+
var dropdownMobileListWrapper = document.createElement('div');
|
|
221
330
|
dropdownMobileListWrapper.classList.add('tags-dropdown-mobile');
|
|
222
331
|
dropdownMobileListWrapper.setAttribute('id', "mlw-".concat(dropdownId));
|
|
223
332
|
dropdownMobileListWrapper.append(dropdownList);
|
|
@@ -226,113 +335,130 @@ const TagsDropdown = _ref => {
|
|
|
226
335
|
getParentNode().append(dropdownList);
|
|
227
336
|
}
|
|
228
337
|
};
|
|
229
|
-
|
|
338
|
+
|
|
339
|
+
var getListContainer = function getListContainer() {
|
|
230
340
|
return document.getElementById(dropdownId);
|
|
231
341
|
};
|
|
232
|
-
|
|
342
|
+
|
|
343
|
+
var getListContainerWrapper = function getListContainerWrapper() {
|
|
233
344
|
return document.getElementById("mlw-".concat(dropdownId));
|
|
234
345
|
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
346
|
+
|
|
347
|
+
var setListContainerStyles = function setListContainerStyles() {
|
|
348
|
+
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _dl$getBoundingClient, _sw$getBoundingClient, _sw$getBoundingClient2, _lh$getBoundingClient, _lf$getBoundingClient;
|
|
349
|
+
|
|
350
|
+
var lc = getListContainer();
|
|
238
351
|
if (!lc || !isOpen) return false;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
352
|
+
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
353
|
+
|
|
354
|
+
var _ref6 = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {},
|
|
355
|
+
width = _ref6.width,
|
|
356
|
+
height = _ref6.height,
|
|
357
|
+
left = _ref6.left,
|
|
358
|
+
top = _ref6.top;
|
|
359
|
+
|
|
360
|
+
var sw = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
|
|
361
|
+
var dl = lc.getElementsByClassName('tags-dropdown__list')[0];
|
|
362
|
+
var lh = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName('tags-dropdown__header')[0];
|
|
363
|
+
var lf = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName('tags-dropdown__footer')[0];
|
|
364
|
+
var margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle$mar2 = _getComputedStyle.marginTop) === null || _getComputedStyle$mar2 === void 0 ? void 0 : _getComputedStyle$mar2.replace('px', '')) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0);
|
|
365
|
+
var maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === null || _getComputedStyle2 === void 0 ? void 0 : (_getComputedStyle2$ma = _getComputedStyle2.maxHeight) === null || _getComputedStyle2$ma === void 0 ? void 0 : _getComputedStyle2$ma.replace('px', '')) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0);
|
|
252
366
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
367
|
+
var toTop = top - margin;
|
|
368
|
+
var toBottom = windowHeight - top - height - margin * 2;
|
|
369
|
+
var dlHeight = dl === null || dl === void 0 ? void 0 : (_dl$getBoundingClient = dl.getBoundingClientRect()) === null || _dl$getBoundingClient === void 0 ? void 0 : _dl$getBoundingClient.height;
|
|
370
|
+
var swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
371
|
+
var controlsHeight = swHeight - dlHeight;
|
|
258
372
|
if (swHeight > maxHeight) swHeight = maxHeight - 2 * margin;
|
|
259
|
-
|
|
260
|
-
|
|
373
|
+
var maxSwHeight = isMobile ? (sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient2 = sw.getBoundingClientRect()) === null || _sw$getBoundingClient2 === void 0 ? void 0 : _sw$getBoundingClient2.height) - (lh === null || lh === void 0 ? void 0 : (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) - (lf === null || lf === void 0 ? void 0 : (_lf$getBoundingClient = lf.getBoundingClientRect()) === null || _lf$getBoundingClient === void 0 ? void 0 : _lf$getBoundingClient.height) : toTop - margin >= maxHeight || toBottom - margin >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
374
|
+
var listPos = toTop < toBottom || toBottom >= swHeight ? 'bottom' : 'top';
|
|
261
375
|
if (swHeight > (listPos === 'top' ? toTop : toBottom)) swHeight = (listPos === 'top' ? toTop : toBottom) - 3 * margin;
|
|
262
376
|
lc.style.minWidth = "".concat(width, "px");
|
|
263
377
|
lc.style.left = "".concat(left, "px");
|
|
264
378
|
lc.style.top = "".concat(listPos === 'bottom' ? top + height : top - swHeight - 2 * margin, "px");
|
|
265
379
|
dl.style.maxHeight = "".concat(isMobile ? maxSwHeight : maxSwHeight - controlsHeight, "px");
|
|
266
380
|
};
|
|
267
|
-
|
|
268
|
-
|
|
381
|
+
|
|
382
|
+
var renderListContainer = function renderListContainer() {
|
|
383
|
+
var lc = getListContainer();
|
|
269
384
|
if (!lc) return null;
|
|
270
385
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
271
386
|
};
|
|
272
|
-
|
|
387
|
+
|
|
388
|
+
var isTargetInParent = function isTargetInParent(target) {
|
|
273
389
|
var _target$className, _target$className$ind, _target$className2, _target$className2$in;
|
|
390
|
+
|
|
274
391
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'svg' && (target === null || target === void 0 ? void 0 : target.parentNodclassName) === 'tag__button' || (target === null || target === void 0 ? void 0 : target.tagName) === 'line') return false;
|
|
275
|
-
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'svg' && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== 'tag__button' || (target === null || target === void 0
|
|
392
|
+
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'svg' && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== 'tag__button' || (target === null || target === void 0 ? void 0 : (_target$className = target.className) === null || _target$className === void 0 ? void 0 : (_target$className$ind = _target$className.indexOf) === null || _target$className$ind === void 0 ? void 0 : _target$className$ind.call(_target$className, 'tag__label')) !== -1 || (target === null || target === void 0 ? void 0 : (_target$className2 = target.className) === null || _target$className2 === void 0 ? void 0 : (_target$className2$in = _target$className2.indexOf) === null || _target$className2$in === void 0 ? void 0 : _target$className2$in.call(_target$className2, 'tag-list_wrapper')) !== -1 || (target === null || target === void 0 ? void 0 : target.className) === "".concat(RC, "__trigger") || (target === null || target === void 0 ? void 0 : target.className) === "tags-dropdown__arrow") return true;
|
|
276
393
|
return false;
|
|
277
394
|
};
|
|
278
|
-
|
|
279
|
-
|
|
395
|
+
|
|
396
|
+
var isItemMatchesSearch = function isItemMatchesSearch(item) {
|
|
397
|
+
var title = item.title || item.label;
|
|
280
398
|
return searchValue.length ? title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '') : true;
|
|
281
399
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
400
|
+
|
|
401
|
+
var getFilteredOptions = function getFilteredOptions(options) {
|
|
402
|
+
return options === null || options === void 0 ? void 0 : options.reduce(function (result, option) {
|
|
403
|
+
if (option.groupName) {
|
|
404
|
+
var _option$list;
|
|
405
|
+
|
|
406
|
+
var filteredGroupItems = option === null || option === void 0 ? void 0 : (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(function (item) {
|
|
407
|
+
return isItemMatchesSearch(item);
|
|
290
408
|
});
|
|
409
|
+
|
|
410
|
+
if (filteredGroupItems !== null && filteredGroupItems !== void 0 && filteredGroupItems.length) {
|
|
411
|
+
result.push(_objectSpread(_objectSpread({}, option), {}, {
|
|
412
|
+
list: filteredGroupItems
|
|
413
|
+
}));
|
|
414
|
+
}
|
|
415
|
+
} else if (isItemMatchesSearch(option)) {
|
|
416
|
+
result.push(option);
|
|
291
417
|
}
|
|
292
|
-
|
|
293
|
-
result
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return options === null || options === void 0 ? void 0 : options.reduce((result, item)
|
|
418
|
+
|
|
419
|
+
return result;
|
|
420
|
+
}, []);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
var getTotalOptions = (0, _react.useCallback)(function () {
|
|
424
|
+
return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
|
|
299
425
|
if (item !== null && item !== void 0 && item.list) {
|
|
300
426
|
var _item$list;
|
|
301
|
-
|
|
427
|
+
|
|
428
|
+
result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || 0;
|
|
302
429
|
} else {
|
|
303
430
|
++result;
|
|
304
431
|
}
|
|
432
|
+
|
|
305
433
|
return result;
|
|
306
434
|
}, 0);
|
|
307
435
|
}, [options]);
|
|
308
|
-
|
|
309
|
-
|
|
436
|
+
|
|
437
|
+
var getListMarkUp = function getListMarkUp() {
|
|
438
|
+
var _cn6, _filteredOptions$filt, _filteredOptions$filt2, _cn7;
|
|
439
|
+
|
|
440
|
+
var filteredOptions = getFilteredOptions(options);
|
|
310
441
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
311
442
|
className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
|
|
312
443
|
ref: wrapperRef,
|
|
313
|
-
onClick: isMobile ? onWrapperClick : ()
|
|
444
|
+
onClick: isMobile ? onWrapperClick : function () {}
|
|
314
445
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
315
446
|
ref: dropdownListWrapperRef,
|
|
316
|
-
className: (0, _classnames.default)("".concat(RC, "__selector-wrapper"), {
|
|
317
|
-
["".concat(RC, "__selector-wrapper--fixed-height")]: isFixedMaxHeight && isMobile
|
|
318
|
-
})
|
|
447
|
+
className: (0, _classnames.default)("".concat(RC, "__selector-wrapper"), (0, _defineProperty2.default)({}, "".concat(RC, "__selector-wrapper--fixed-height"), isFixedMaxHeight && isMobile))
|
|
319
448
|
}, headerContent || isMobile ? /*#__PURE__*/_react.default.createElement("div", {
|
|
320
|
-
className: (0, _classnames.default)("".concat(RC, "__header"), {
|
|
321
|
-
["".concat(RC, "__header-with-shadow")]: isScrollableList && isMobile,
|
|
322
|
-
["".concat(RC, "__header-with-shadow-hidden")]: scrollTop === 0
|
|
323
|
-
})
|
|
449
|
+
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))
|
|
324
450
|
}, isMobile && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
325
451
|
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
326
452
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
327
453
|
className: (0, _classnames.default)("".concat(RC, "__label"))
|
|
328
454
|
}, label), /*#__PURE__*/_react.default.createElement("div", {
|
|
329
455
|
className: (0, _classnames.default)("".concat(RC, "__close-icon")),
|
|
330
|
-
onClick: e
|
|
456
|
+
onClick: function onClick(e) {
|
|
331
457
|
e.stopPropagation();
|
|
332
458
|
setIsOpen(false);
|
|
333
459
|
}
|
|
334
460
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
|
|
335
|
-
onClick: e
|
|
461
|
+
onClick: function onClick(e) {
|
|
336
462
|
e.stopPropagation();
|
|
337
463
|
setIsOpen(false);
|
|
338
464
|
}
|
|
@@ -341,10 +467,12 @@ const TagsDropdown = _ref => {
|
|
|
341
467
|
}, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
|
|
342
468
|
className: "".concat(RC, "__input"),
|
|
343
469
|
value: searchValue,
|
|
344
|
-
onChange:
|
|
470
|
+
onChange: function onChange(v) {
|
|
471
|
+
return setSearchValue(v);
|
|
472
|
+
},
|
|
345
473
|
placeholder: mobileSearchPlaceholder || 'Search',
|
|
346
474
|
withDelete: true,
|
|
347
|
-
onMouseDown: e
|
|
475
|
+
onMouseDown: function onMouseDown(e) {
|
|
348
476
|
if (!isOpen) {
|
|
349
477
|
setIsSearchInputFocused(true);
|
|
350
478
|
setIsOpen(true);
|
|
@@ -355,34 +483,45 @@ const TagsDropdown = _ref => {
|
|
|
355
483
|
}, headerContent)) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
356
484
|
ref: dropdownListRef,
|
|
357
485
|
className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : '', " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : '')
|
|
358
|
-
},
|
|
359
|
-
var _option$groupName, _option$list2;
|
|
486
|
+
}, filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(function (option) {
|
|
487
|
+
var _option$groupName, _option$groupName$toS, _option$list2;
|
|
488
|
+
|
|
360
489
|
return option.groupName ? /*#__PURE__*/_react.default.createElement("div", {
|
|
361
|
-
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0
|
|
490
|
+
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0 ? void 0 : (_option$groupName$toS = _option$groupName.toString()) === null || _option$groupName$toS === void 0 ? void 0 : _option$groupName$toS.replace(/ /g, '_').concat(Date.now()),
|
|
362
491
|
className: (0, _classnames.default)("".concat(RC, "-group"), option.className)
|
|
363
492
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
364
493
|
className: "".concat(RC, "-group__name")
|
|
365
|
-
}, option.groupName), (_option$list2 = option.list) === null || _option$list2 === void 0 ? void 0 : _option$list2.map(
|
|
366
|
-
|
|
494
|
+
}, option.groupName), (_option$list2 = option.list) === null || _option$list2 === void 0 ? void 0 : _option$list2.map(function (item) {
|
|
495
|
+
return getMarkupForElement(item);
|
|
496
|
+
})) : getMarkupForElement(option);
|
|
497
|
+
}), ((_filteredOptions$filt = filteredOptions.filter(function (_ref7) {
|
|
498
|
+
var value = _ref7.value;
|
|
499
|
+
return value !== 'open_modal';
|
|
500
|
+
})) === null || _filteredOptions$filt === void 0 ? void 0 : _filteredOptions$filt.length) === 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
367
501
|
className: "".concat(RC, "__no-options")
|
|
368
|
-
}, noOptionsText)), footerContent || isMobile
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
})
|
|
502
|
+
}, noOptionsText) : null), (footerContent || isMobile) && ((_filteredOptions$filt2 = filteredOptions.filter(function (_ref8) {
|
|
503
|
+
var value = _ref8.value;
|
|
504
|
+
return value !== 'open_modal';
|
|
505
|
+
})) === null || _filteredOptions$filt2 === void 0 ? void 0 : _filteredOptions$filt2.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
506
|
+
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))
|
|
373
507
|
}, footerContent, isMobile && /*#__PURE__*/_react.default.createElement("button", {
|
|
374
|
-
onClick: ()
|
|
508
|
+
onClick: function onClick() {
|
|
509
|
+
return setIsOpen(false);
|
|
510
|
+
}
|
|
375
511
|
}, "Apply", chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.length ? "(".concat(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length, ")") : '')) : null));
|
|
376
512
|
};
|
|
377
|
-
|
|
513
|
+
|
|
514
|
+
var closeList = function closeList(e) {
|
|
378
515
|
var _inputRef$current;
|
|
516
|
+
|
|
379
517
|
handleClickOutside(e);
|
|
380
|
-
inputRef === null || inputRef === void 0
|
|
518
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
|
|
381
519
|
};
|
|
382
|
-
|
|
520
|
+
|
|
521
|
+
(0, _react.useLayoutEffect)(function () {
|
|
383
522
|
initListContainer();
|
|
384
523
|
}, []);
|
|
385
|
-
(0, _react.useLayoutEffect)(()
|
|
524
|
+
(0, _react.useLayoutEffect)(function () {
|
|
386
525
|
if (!isMobile) {
|
|
387
526
|
window.addEventListener('resize', setListContainerStyles);
|
|
388
527
|
window.addEventListener('mousewheel', closeList);
|
|
@@ -392,128 +531,151 @@ const TagsDropdown = _ref => {
|
|
|
392
531
|
window.removeEventListener('mousewheel', closeList);
|
|
393
532
|
window.removeEventListener('mouseup', handleClickOutside);
|
|
394
533
|
}
|
|
395
|
-
|
|
534
|
+
|
|
535
|
+
return function () {
|
|
396
536
|
window.removeEventListener('resize', setListContainerStyles);
|
|
397
537
|
window.removeEventListener('mousewheel', closeList);
|
|
398
538
|
window.removeEventListener('mouseup', handleClickOutside);
|
|
399
539
|
};
|
|
400
540
|
}, [getListContainer]);
|
|
401
|
-
(0, _react.useLayoutEffect)(()
|
|
541
|
+
(0, _react.useLayoutEffect)(function () {
|
|
402
542
|
setListContainerStyles();
|
|
403
|
-
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0
|
|
404
|
-
(0, _react.useEffect)(()
|
|
543
|
+
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : (_dropdownListWrapperR2 = _dropdownListWrapperR.getBoundingClientRect()) === null || _dropdownListWrapperR2 === void 0 ? void 0 : _dropdownListWrapperR2.height]);
|
|
544
|
+
(0, _react.useEffect)(function () {
|
|
405
545
|
if (!isMobile) {
|
|
406
546
|
document.addEventListener('click', handleClickOutside, true);
|
|
407
547
|
} else {
|
|
408
548
|
document.removeEventListener('click', handleClickOutside, true);
|
|
409
549
|
}
|
|
410
|
-
|
|
550
|
+
|
|
551
|
+
return function () {
|
|
552
|
+
return document.removeEventListener('click', handleClickOutside, true);
|
|
553
|
+
};
|
|
411
554
|
}, [isMobile]);
|
|
412
|
-
(0, _react.useEffect)(()
|
|
555
|
+
(0, _react.useEffect)(function () {
|
|
413
556
|
var _selectAllButtonRef$c, _unselectAllButtonRef;
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
557
|
+
|
|
558
|
+
var fn = isOpen ? 'addEventListener' : 'removeEventListener';
|
|
559
|
+
selectAllButtonRef === null || selectAllButtonRef === void 0 ? void 0 : (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 ? void 0 : _selectAllButtonRef$c[fn]('click', selectAllItems, true);
|
|
560
|
+
unselectAllButtonRef === null || unselectAllButtonRef === void 0 ? void 0 : (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 ? void 0 : _unselectAllButtonRef[fn]('click', unselectAllItems, true);
|
|
561
|
+
|
|
417
562
|
if (isOpen) {
|
|
418
563
|
var _getListContainer2;
|
|
419
|
-
|
|
564
|
+
|
|
565
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.classList.add('tags-dropdown__container--opened');
|
|
420
566
|
} else {
|
|
421
567
|
var _getListContainer3;
|
|
422
|
-
|
|
568
|
+
|
|
569
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.classList.remove('tags-dropdown__container--opened');
|
|
423
570
|
}
|
|
424
571
|
}, [isOpen]);
|
|
425
|
-
(0, _react.useEffect)(()
|
|
572
|
+
(0, _react.useEffect)(function () {
|
|
426
573
|
if (isOpen && isMobile, dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
427
574
|
var _dropdownListRef$curr, _dropdownListRef$curr2;
|
|
428
|
-
|
|
575
|
+
|
|
576
|
+
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));
|
|
577
|
+
|
|
429
578
|
if (isScrollableList === null) {
|
|
430
579
|
var _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
431
|
-
|
|
580
|
+
|
|
581
|
+
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));
|
|
432
582
|
}
|
|
433
583
|
}
|
|
434
|
-
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0
|
|
435
|
-
(0, _react.useEffect)(()
|
|
436
|
-
|
|
584
|
+
}, [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]);
|
|
585
|
+
(0, _react.useEffect)(function () {
|
|
586
|
+
var setScrollTopValue = function setScrollTopValue(e) {
|
|
437
587
|
setScrollTop(parseInt(e.target.scrollTop));
|
|
438
588
|
};
|
|
589
|
+
|
|
439
590
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
440
591
|
var _dropdownListRef$curr7;
|
|
441
|
-
|
|
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);
|
|
442
594
|
}
|
|
443
|
-
|
|
595
|
+
|
|
596
|
+
return function () {
|
|
444
597
|
var _dropdownListRef$curr8;
|
|
445
|
-
|
|
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);
|
|
446
600
|
};
|
|
447
601
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
448
|
-
(0, _react.useEffect)(()
|
|
602
|
+
(0, _react.useEffect)(function () {
|
|
449
603
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
450
604
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
451
|
-
|
|
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)));
|
|
452
607
|
}
|
|
453
608
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
454
|
-
(0, _react.useEffect)(()
|
|
455
|
-
return ()
|
|
609
|
+
(0, _react.useEffect)(function () {
|
|
610
|
+
return function () {
|
|
456
611
|
var _getListContainer4, _getListContainerWrap;
|
|
457
|
-
|
|
458
|
-
(
|
|
612
|
+
|
|
613
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.remove();
|
|
614
|
+
(_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
|
|
459
615
|
};
|
|
460
616
|
}, []);
|
|
461
617
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
462
|
-
className: (0, _classnames.default)(RC, className, {
|
|
463
|
-
["".concat(RC, "_disabled")]: disabled,
|
|
464
|
-
["".concat(RC, "-mobile")]: isMobile
|
|
465
|
-
}),
|
|
618
|
+
className: (0, _classnames.default)(RC, className, (_cn8 = {}, (0, _defineProperty2.default)(_cn8, "".concat(RC, "_disabled"), disabled), (0, _defineProperty2.default)(_cn8, "".concat(RC, "-mobile"), isMobile), _cn8)),
|
|
466
619
|
ref: dropdownRef
|
|
467
620
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
468
621
|
className: (0, _classnames.default)("".concat(RC, "__trigger"), {
|
|
469
622
|
'tags-dropdown__error': error
|
|
470
623
|
}),
|
|
471
|
-
onClick:
|
|
472
|
-
|
|
473
|
-
target
|
|
474
|
-
} = _ref6;
|
|
624
|
+
onClick: function onClick(_ref9) {
|
|
625
|
+
var target = _ref9.target;
|
|
475
626
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT') setIsOpen(true);else if (isTargetInParent(target)) {
|
|
476
|
-
setIsOpen(
|
|
627
|
+
setIsOpen(function (isOpen) {
|
|
628
|
+
return !isOpen;
|
|
629
|
+
});
|
|
477
630
|
}
|
|
478
631
|
}
|
|
479
632
|
}, noTagsWrap ? /*#__PURE__*/_react.default.createElement(_TagList.default, {
|
|
480
|
-
items: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map((value, i)
|
|
481
|
-
|
|
482
|
-
|
|
633
|
+
items: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value, i) {
|
|
634
|
+
var tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(function (el) {
|
|
635
|
+
return el.value === value;
|
|
636
|
+
});
|
|
637
|
+
var label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
|
|
483
638
|
return {
|
|
484
|
-
value,
|
|
485
|
-
label,
|
|
639
|
+
value: value,
|
|
640
|
+
label: label,
|
|
486
641
|
id: i
|
|
487
642
|
};
|
|
488
643
|
}),
|
|
489
644
|
disableShowMore: true
|
|
490
|
-
}) : chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(value
|
|
491
|
-
|
|
492
|
-
|
|
645
|
+
}) : chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value) {
|
|
646
|
+
var tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(function (el) {
|
|
647
|
+
return el.value === value;
|
|
648
|
+
});
|
|
649
|
+
var label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
|
|
493
650
|
return /*#__PURE__*/_react.default.createElement(_Tag.default, {
|
|
494
651
|
key: value,
|
|
495
652
|
className: (0, _classnames.default)(tagClassname, {
|
|
496
653
|
'tag_with-btn': !(tag !== null && tag !== void 0 && tag.isFreezed)
|
|
497
654
|
}),
|
|
498
655
|
label: label,
|
|
499
|
-
removeItem: tag !== null && tag !== void 0 && tag.isFreezed ? null : ()
|
|
656
|
+
removeItem: tag !== null && tag !== void 0 && tag.isFreezed ? null : function () {
|
|
657
|
+
return deleteChosen(value);
|
|
658
|
+
},
|
|
500
659
|
isNoDismiss: false
|
|
501
660
|
});
|
|
502
661
|
}), chosenOptions.length === 0 || !noTagsWrap ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
503
662
|
ref: inputRef,
|
|
504
663
|
className: "".concat(RC, "__input"),
|
|
505
664
|
value: searchValue,
|
|
506
|
-
onChange:
|
|
665
|
+
onChange: function onChange(e) {
|
|
666
|
+
return onSearchHandler(e.target.value);
|
|
667
|
+
},
|
|
507
668
|
placeholder: placeholder || 'Select from list',
|
|
508
|
-
onKeyDown:
|
|
509
|
-
|
|
669
|
+
onKeyDown: function onKeyDown(e) {
|
|
670
|
+
return onKeyPress(e, searchValue);
|
|
671
|
+
},
|
|
672
|
+
onFocus: function onFocus(e) {
|
|
510
673
|
var _e$target;
|
|
511
|
-
|
|
674
|
+
|
|
675
|
+
if (isMobile) e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.blur();
|
|
512
676
|
}
|
|
513
677
|
}, attributesOfNativeInput)) : '', isOpen && renderListContainer(), /*#__PURE__*/_react.default.createElement("span", {
|
|
514
|
-
className: (0, _classnames.default)("".concat(RC, "__arrow"), {
|
|
515
|
-
["".concat(RC, "__arrow_active")]: isOpen
|
|
516
|
-
})
|
|
678
|
+
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen))
|
|
517
679
|
}, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, {
|
|
518
680
|
className: "mobile-icon"
|
|
519
681
|
}) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, {
|
|
@@ -522,4 +684,6 @@ const TagsDropdown = _ref => {
|
|
|
522
684
|
className: "color--text"
|
|
523
685
|
}))));
|
|
524
686
|
};
|
|
525
|
-
|
|
687
|
+
|
|
688
|
+
var _default = TagsDropdown;
|
|
689
|
+
exports.default = _default;
|