intelicoreact 1.4.83 → 1.4.84
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 +14 -22
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +14 -22
- package/dist/Atomic/FormElements/Calendar/Calendar.js +67 -122
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +27 -36
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +23 -39
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +110 -246
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +44 -85
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +266 -430
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +5 -9
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +161 -283
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +39 -64
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +51 -132
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +34 -73
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +79 -138
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +55 -77
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +75 -126
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +33 -83
- package/dist/Atomic/FormElements/Input/Input.js +160 -256
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +48 -102
- package/dist/Atomic/FormElements/InputColor/InputColor.js +26 -41
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +38 -76
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +109 -177
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +32 -57
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +184 -302
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +85 -157
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +11 -16
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +77 -194
- package/dist/Atomic/FormElements/InputLink/InputLink.js +32 -58
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +8 -12
- package/dist/Atomic/FormElements/InputMask/InputMask.js +554 -964
- package/dist/Atomic/FormElements/InputMask/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +17 -43
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +268 -404
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +17 -43
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +299 -459
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask3/functions.js +17 -43
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +51 -113
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +64 -118
- package/dist/Atomic/FormElements/Label/Label.js +14 -24
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +217 -349
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +25 -47
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +133 -207
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +29 -61
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +20 -42
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +22 -33
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +20 -43
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +54 -101
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +59 -102
- package/dist/Atomic/FormElements/RangeList/RangeList.js +89 -150
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +23 -29
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +148 -326
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +389 -588
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +14 -24
- package/dist/Atomic/FormElements/Switcher/Switcher.js +24 -29
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +23 -41
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +20 -32
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +32 -55
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +22 -42
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +23 -33
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +51 -120
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +2 -3
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +23 -46
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +47 -98
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +485 -713
- package/dist/Atomic/FormElements/Text/Text.js +47 -53
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +21 -31
- package/dist/Atomic/FormElements/Textarea/Textarea.js +31 -47
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +68 -128
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +25 -36
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +33 -70
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +58 -123
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +48 -80
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +32 -42
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +40 -60
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -3
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +50 -69
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +21 -48
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +35 -77
- package/dist/Atomic/Layout/Spinner/Spinner.js +8 -14
- package/dist/Atomic/UI/Accordion/Accordion.js +18 -48
- package/dist/Atomic/UI/Accordion/AccordionItem.js +35 -60
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +48 -104
- package/dist/Atomic/UI/AccordionText/AccordionText.js +21 -54
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +47 -92
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +22 -50
- package/dist/Atomic/UI/Alert/Alert.js +22 -51
- package/dist/Atomic/UI/Arrow/Arrow.js +15 -35
- package/dist/Atomic/UI/Box/Box.js +14 -21
- package/dist/Atomic/UI/Button/Button.js +26 -35
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +22 -31
- package/dist/Atomic/UI/Chart/Chart.js +45 -86
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +14 -24
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +13 -22
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +68 -113
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +158 -140
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +26 -42
- package/dist/Atomic/UI/Chart/partial/utils.js +20 -48
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +22 -42
- package/dist/Atomic/UI/DateTime/DateTime.js +23 -38
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +13 -37
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +5 -21
- package/dist/Atomic/UI/DoubleString/DoubleString.js +34 -63
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +15 -63
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +62 -157
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +47 -110
- package/dist/Atomic/UI/Hint/Hint.js +67 -122
- package/dist/Atomic/UI/Hint/partial/_utils.js +52 -0
- package/dist/Atomic/UI/Hint/partials/_utils.js +14 -29
- package/dist/Atomic/UI/Modal/Modal.js +147 -184
- package/dist/Atomic/UI/Modal/ModalHOC.js +15 -26
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -12
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +17 -21
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +99 -161
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +32 -62
- package/dist/Atomic/UI/NavLine/NavLine.js +120 -211
- package/dist/Atomic/UI/NavLine/Tabs.js +2 -3
- package/dist/Atomic/UI/PageTitle/PageTitle.js +13 -17
- package/dist/Atomic/UI/PieChart/PieChart.js +11 -21
- package/dist/Atomic/UI/Price/Price.js +10 -13
- package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -11
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +28 -58
- package/dist/Atomic/UI/Status/Status.js +19 -30
- package/dist/Atomic/UI/Table/Partials/TdCell.js +28 -71
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +7 -16
- package/dist/Atomic/UI/Table/Partials/TdRow.js +29 -65
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +16 -40
- package/dist/Atomic/UI/Table/Table.js +27 -47
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -48
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -19
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +5 -6
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +22 -39
- package/dist/Atomic/UI/Tag/Tag.js +59 -94
- package/dist/Atomic/UI/TagList/TagList.js +81 -144
- package/dist/Atomic/UI/UserBox/UserBox.js +14 -26
- package/dist/Atomic/UI/WizardStepper/constructor.js +7 -15
- package/dist/Atomic/UI/WizardStepper/index.js +1 -5
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +20 -26
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +1 -4
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +26 -39
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +1 -5
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +23 -42
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +1 -5
- package/dist/Atomic/UI/WizardStepper/ui/icons.js +40 -49
- package/dist/Atomic/UI/WizardStepper/ui/index.js +1 -5
- package/dist/Classes/AbortableFetch.js +283 -422
- package/dist/Classes/AnimatedHandler.js +44 -56
- package/dist/Classes/RESTAPI/index.js +158 -441
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +290 -428
- package/dist/Classes/RESTAPI/partials/ApiBase.js +24 -67
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +83 -353
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +161 -403
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +159 -400
- package/dist/Classes/RESTAPI/partials/Utils.js +81 -135
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +2 -6
- package/dist/Classes/RESTAPI/partials/_utils.js +103 -398
- package/dist/Constants/index.constants.js +8 -15
- package/dist/Functions/Portal.js +14 -33
- package/dist/Functions/customEventListener.js +9 -24
- package/dist/Functions/fieldValueFormatters.js +147 -209
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +75 -137
- package/dist/Functions/locale/createTranslator.js +13 -28
- package/dist/Functions/operations.js +35 -49
- package/dist/Functions/presets/inputMaskPresets.js +25 -27
- package/dist/Functions/presets/inputPresets.js +19 -22
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +7 -9
- package/dist/Functions/schemas.js +6 -15
- package/dist/Functions/useBodyScrollLock.js +4 -9
- package/dist/Functions/useClickOutside.js +3 -7
- package/dist/Functions/useDebounce.js +11 -25
- package/dist/Functions/useFieldFocus.js +42 -67
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +35 -54
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +74 -95
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +55 -91
- package/dist/Functions/useFormTools/functions/General.js +80 -99
- package/dist/Functions/useFormTools/functions/RenderFields.js +45 -72
- package/dist/Functions/useFormTools/functions/usePrevious.js +3 -7
- package/dist/Functions/useFormTools/index.js +380 -592
- package/dist/Functions/useInputHighlightError.js +27 -52
- package/dist/Functions/useIsMobile.js +15 -39
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +10 -15
- package/dist/Functions/useKeyPress/useKeyPress.js +18 -35
- package/dist/Functions/useLocalStorage.js +7 -22
- package/dist/Functions/useLocationParams.js +16 -27
- package/dist/Functions/useMediaQuery.js +10 -27
- package/dist/Functions/useMetaInfo.js +19 -50
- package/dist/Functions/useMouseUpOutside.js +2 -5
- package/dist/Functions/useOnlineStatus.js +7 -26
- package/dist/Functions/usePasswordChecker.js +42 -77
- package/dist/Functions/usePrevious.js +3 -7
- package/dist/Functions/useResize.js +12 -32
- package/dist/Functions/useScrollTo.js +6 -20
- package/dist/Functions/useToggle.js +10 -30
- package/dist/Functions/utils.js +188 -386
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +21 -32
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +21 -32
- package/dist/Molecular/CustomIcons/components/AppStore.js +25 -36
- package/dist/Molecular/CustomIcons/components/Arrow.js +31 -42
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +13 -24
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +16 -27
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +16 -27
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +13 -24
- package/dist/Molecular/CustomIcons/components/Bell.js +11 -22
- package/dist/Molecular/CustomIcons/components/Button.js +11 -22
- package/dist/Molecular/CustomIcons/components/Campaigns.js +12 -23
- package/dist/Molecular/CustomIcons/components/Check.js +12 -23
- package/dist/Molecular/CustomIcons/components/Check2.js +11 -22
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +11 -22
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +11 -22
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +11 -22
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +11 -22
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +11 -22
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +26 -37
- package/dist/Molecular/CustomIcons/components/Close.js +13 -24
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +38 -49
- package/dist/Molecular/CustomIcons/components/Delete.js +12 -23
- package/dist/Molecular/CustomIcons/components/Edit.js +11 -22
- package/dist/Molecular/CustomIcons/components/Email.js +29 -40
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +19 -30
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +27 -38
- package/dist/Molecular/CustomIcons/components/Flows.js +11 -22
- package/dist/Molecular/CustomIcons/components/Gift.js +16 -27
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +25 -36
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +25 -36
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +14 -25
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +15 -26
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +14 -25
- package/dist/Molecular/CustomIcons/components/Home.js +14 -25
- package/dist/Molecular/CustomIcons/components/Home2.js +17 -28
- package/dist/Molecular/CustomIcons/components/Key.js +19 -30
- package/dist/Molecular/CustomIcons/components/Landers.js +15 -26
- package/dist/Molecular/CustomIcons/components/Lock.js +11 -22
- package/dist/Molecular/CustomIcons/components/Mail.js +19 -30
- package/dist/Molecular/CustomIcons/components/Mastercard.js +61 -72
- package/dist/Molecular/CustomIcons/components/Minus.js +24 -35
- package/dist/Molecular/CustomIcons/components/Offers.js +12 -23
- package/dist/Molecular/CustomIcons/components/Pause.js +24 -35
- package/dist/Molecular/CustomIcons/components/PayPal.js +38 -49
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +25 -36
- package/dist/Molecular/CustomIcons/components/Phone.js +26 -37
- package/dist/Molecular/CustomIcons/components/Play.js +24 -35
- package/dist/Molecular/CustomIcons/components/Plus.js +24 -35
- package/dist/Molecular/CustomIcons/components/Profile.js +16 -27
- package/dist/Molecular/CustomIcons/components/QRCode.js +26 -37
- package/dist/Molecular/CustomIcons/components/Rectangle.js +11 -22
- package/dist/Molecular/CustomIcons/components/Revert.js +14 -25
- package/dist/Molecular/CustomIcons/components/Star.js +10 -21
- package/dist/Molecular/CustomIcons/components/Star2.js +12 -23
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +14 -25
- package/dist/Molecular/CustomIcons/components/Trash.js +11 -22
- package/dist/Molecular/CustomIcons/components/TrashRed.js +11 -22
- package/dist/Molecular/CustomIcons/components/Triggers.js +11 -22
- package/dist/Molecular/CustomIcons/components/User.js +16 -27
- package/dist/Molecular/CustomIcons/components/Visa.js +27 -38
- package/dist/Molecular/CustomIcons/components/X.js +11 -22
- package/dist/Molecular/CustomIcons/index.js +61 -183
- package/dist/Molecular/FormElement/FormElement.js +19 -28
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +91 -112
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +35 -37
- package/dist/Molecular/InputAddress/InputAddress.js +176 -312
- package/dist/Molecular/InputPassword/InputPassword.js +15 -39
- package/dist/index.js +1 -3
- package/package.json +1 -1
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +0 -119
- package/dist/Atomic/UI/ModalBackup/Modal.js +0 -174
- package/dist/Atomic/UI/ModalBackup/Modal.scss +0 -333
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +0 -51
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +0 -24
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +0 -41
- package/dist/Functions/presets/inputMaskPreset.js +0 -176
|
@@ -1,209 +1,127 @@
|
|
|
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
|
-
|
|
7
4
|
Object.defineProperty(exports, "__esModule", {
|
|
8
5
|
value: true
|
|
9
6
|
});
|
|
10
7
|
exports.default = void 0;
|
|
11
|
-
|
|
12
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
-
|
|
22
11
|
var _reactDom = require("react-dom");
|
|
23
|
-
|
|
24
12
|
var _reactFeather = require("react-feather");
|
|
25
|
-
|
|
26
13
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
27
|
-
|
|
28
14
|
var _useDebounce = require("../../../Functions/useDebounce");
|
|
29
|
-
|
|
30
|
-
var _useIsMobile2 = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
31
|
-
|
|
15
|
+
var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
32
16
|
var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
|
|
33
|
-
|
|
34
17
|
var _RadioInput = _interopRequireDefault(require("../RadioInput/RadioInput"));
|
|
35
|
-
|
|
36
18
|
require("./DropdownLiveSearch.scss");
|
|
37
|
-
|
|
38
|
-
function
|
|
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
|
-
var _useState = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2)),
|
|
73
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
74
|
-
dropdownId = _useState2[0];
|
|
75
|
-
|
|
76
|
-
var _useState3 = (0, _react.useState)(false),
|
|
77
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
78
|
-
isOpen = _useState4[0],
|
|
79
|
-
setIsOpenState = _useState4[1];
|
|
80
|
-
|
|
81
|
-
var _useState5 = (0, _react.useState)(false),
|
|
82
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
83
|
-
isValueDeleted = _useState6[0],
|
|
84
|
-
setIsValueDeleted = _useState6[1];
|
|
85
|
-
|
|
86
|
-
var _useIsMobile = (0, _useIsMobile2.default)(),
|
|
87
|
-
isMobileProp = _useIsMobile.isMobile;
|
|
88
|
-
|
|
89
|
-
var isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
|
|
90
|
-
var labelByValue = (0, _react.useMemo)(function () {
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
const RC = "dropdown-live-search";
|
|
22
|
+
const DropdownLiveSearch = _ref => {
|
|
23
|
+
var _dropdownListRef$curr5, _dropdownListRef$curr6, _tabIndex$toString;
|
|
24
|
+
let {
|
|
25
|
+
label,
|
|
26
|
+
value,
|
|
27
|
+
error,
|
|
28
|
+
disabled,
|
|
29
|
+
onChange,
|
|
30
|
+
placeholder,
|
|
31
|
+
className,
|
|
32
|
+
isSearchable,
|
|
33
|
+
testId,
|
|
34
|
+
doRequest,
|
|
35
|
+
isLoading,
|
|
36
|
+
options = [],
|
|
37
|
+
fieldKey,
|
|
38
|
+
id,
|
|
39
|
+
isListTop,
|
|
40
|
+
isNotValidateASCII = false,
|
|
41
|
+
noOptionsText = "No options available",
|
|
42
|
+
attributesOfNativeInput = {},
|
|
43
|
+
withMobileLogic,
|
|
44
|
+
tabIndex
|
|
45
|
+
} = _ref;
|
|
46
|
+
const [dropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
|
|
47
|
+
const [isOpen, setIsOpenState] = (0, _react.useState)(false);
|
|
48
|
+
const [isValueDeleted, setIsValueDeleted] = (0, _react.useState)(false);
|
|
49
|
+
const {
|
|
50
|
+
isMobile: isMobileProp
|
|
51
|
+
} = (0, _useIsMobile.default)();
|
|
52
|
+
const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
|
|
53
|
+
const labelByValue = (0, _react.useMemo)(() => {
|
|
91
54
|
var _options$find$label, _options$find;
|
|
92
|
-
|
|
93
|
-
return (_options$find$label = options === null || options === void 0 ? void 0 : (_options$find = options.find(function (item) {
|
|
94
|
-
return item.value === value;
|
|
95
|
-
})) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : "";
|
|
55
|
+
return (_options$find$label = options === null || options === void 0 || (_options$find = options.find(item => item.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : "";
|
|
96
56
|
}, [value]);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var searchValueRef = (0, _react.useRef)(null);
|
|
115
|
-
var wrapperRef = (0, _react.useRef)(null);
|
|
116
|
-
|
|
117
|
-
var _useState11 = (0, _react.useState)(false),
|
|
118
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
119
|
-
isFocusedByClick = _useState12[0],
|
|
120
|
-
setIsFocusedByClick = _useState12[1];
|
|
121
|
-
|
|
122
|
-
var _useState13 = (0, _react.useState)(null),
|
|
123
|
-
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
124
|
-
isScrollableList = _useState14[0],
|
|
125
|
-
setIsScrollableList = _useState14[1];
|
|
126
|
-
|
|
127
|
-
var _useState15 = (0, _react.useState)(false),
|
|
128
|
-
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
129
|
-
isFixedMaxHeight = _useState16[0],
|
|
130
|
-
setIsFixedMaxHeight = _useState16[1];
|
|
131
|
-
|
|
132
|
-
var _useState17 = (0, _react.useState)(0),
|
|
133
|
-
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
134
|
-
scrollTop = _useState18[0],
|
|
135
|
-
setScrollTop = _useState18[1];
|
|
136
|
-
|
|
137
|
-
var _useState19 = (0, _react.useState)(1),
|
|
138
|
-
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
139
|
-
scrollHeight = _useState20[0],
|
|
140
|
-
setScrollHeight = _useState20[1];
|
|
141
|
-
|
|
142
|
-
var debouncedSearchTerm = (0, _useDebounce.useDebounce)({
|
|
143
|
-
searchValue: searchValue,
|
|
57
|
+
const [searchValue, setSV] = (0, _react.useState)("");
|
|
58
|
+
const [isSearchValueChangedAfterOpen, setIsSearchValueChangedAfterOpen] = (0, _react.useState)(false);
|
|
59
|
+
const dropdownLiveSearchRef = (0, _react.useRef)(null);
|
|
60
|
+
const dropdownListBoxRef = (0, _react.useRef)(null);
|
|
61
|
+
const dropdownListRef = (0, _react.useRef)(null);
|
|
62
|
+
const dropdownListHeaderRef = (0, _react.useRef)(null);
|
|
63
|
+
const searchInputRef = (0, _react.useRef)(null);
|
|
64
|
+
const searchInputModalRef = (0, _react.useRef)(null);
|
|
65
|
+
const searchValueRef = (0, _react.useRef)(null);
|
|
66
|
+
const wrapperRef = (0, _react.useRef)(null);
|
|
67
|
+
const [isFocusedByClick, setIsFocusedByClick] = (0, _react.useState)(false);
|
|
68
|
+
const [isScrollableList, setIsScrollableList] = (0, _react.useState)(null);
|
|
69
|
+
const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
|
|
70
|
+
const [scrollTop, setScrollTop] = (0, _react.useState)(0);
|
|
71
|
+
const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
|
|
72
|
+
const debouncedSearchTerm = (0, _useDebounce.useDebounce)({
|
|
73
|
+
searchValue,
|
|
144
74
|
delay: 600
|
|
145
75
|
});
|
|
146
|
-
|
|
76
|
+
const doScrollCallback = (0, _react.useCallback)(e => {
|
|
147
77
|
if (doRequest && typeof doRequest === "function") {
|
|
148
78
|
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
|
|
149
79
|
doRequest(searchValueRef.current, true);
|
|
150
80
|
}
|
|
151
81
|
}
|
|
152
82
|
}, [options]);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var isChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
83
|
+
const setSearchValue = function (val) {
|
|
84
|
+
let isChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
156
85
|
if (isChanged) setIsSearchValueChangedAfterOpen(true);
|
|
157
86
|
setSV(val);
|
|
158
87
|
searchValueRef.current = val;
|
|
159
88
|
};
|
|
160
|
-
|
|
161
|
-
var setIsOpen = function setIsOpen(v) {
|
|
89
|
+
const setIsOpen = v => {
|
|
162
90
|
setIsOpenState(v);
|
|
163
91
|
setSearchValue("", false);
|
|
164
92
|
if (!v) setIsSearchValueChangedAfterOpen(false);
|
|
165
93
|
};
|
|
166
|
-
|
|
167
|
-
var getParentNode = function getParentNode() {
|
|
94
|
+
const getParentNode = () => {
|
|
168
95
|
var _ref2, _document$querySelect;
|
|
169
|
-
|
|
170
96
|
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");
|
|
171
97
|
};
|
|
172
|
-
|
|
173
|
-
var getListContainer = function getListContainer() {
|
|
98
|
+
const getListContainer = () => {
|
|
174
99
|
return document.getElementById(dropdownId);
|
|
175
100
|
};
|
|
176
|
-
|
|
177
|
-
var onWrapperClick = function onWrapperClick(e) {
|
|
101
|
+
const onWrapperClick = e => {
|
|
178
102
|
if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
|
|
179
103
|
e.stopPropagation();
|
|
180
104
|
e.preventDefault();
|
|
181
105
|
setIsOpen(false);
|
|
182
106
|
}
|
|
183
107
|
};
|
|
184
|
-
|
|
185
|
-
var onSearchableInputFocus = function onSearchableInputFocus(e) {
|
|
108
|
+
const onSearchableInputFocus = e => {
|
|
186
109
|
if (!isOpen) {
|
|
187
110
|
e.preventDefault();
|
|
188
111
|
e.stopPropagation();
|
|
189
112
|
}
|
|
190
113
|
};
|
|
191
|
-
|
|
192
|
-
var handleClickOutside = function handleClickOutside(event) {
|
|
114
|
+
const handleClickOutside = event => {
|
|
193
115
|
var _getListContainer;
|
|
194
|
-
|
|
195
116
|
if (!dropdownLiveSearchRef.current.contains(event.target) && (!getListContainer() || !((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(event.target)))) setIsOpen(false);
|
|
196
117
|
};
|
|
197
|
-
|
|
198
|
-
var closeListViaEsc = function closeListViaEsc(e) {
|
|
118
|
+
const closeListViaEsc = e => {
|
|
199
119
|
if ([27].includes(e.keyCode)) setIsOpen(false);
|
|
200
120
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
onInputClick: function onInputClick(e) {
|
|
121
|
+
const closeList = isOpen ? handleClickOutside : () => {};
|
|
122
|
+
const handle = {
|
|
123
|
+
onInputClick: e => {
|
|
205
124
|
if (!isOpen) setIsOpen(true);
|
|
206
|
-
|
|
207
125
|
if (isMobile && withMobileLogic) {
|
|
208
126
|
e.preventDefault();
|
|
209
127
|
e.stopPropagation();
|
|
@@ -212,11 +130,10 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
212
130
|
e.target.select();
|
|
213
131
|
}
|
|
214
132
|
},
|
|
215
|
-
onInputChange:
|
|
216
|
-
|
|
133
|
+
onInputChange: e => {
|
|
134
|
+
let inputValue = e.target.value;
|
|
217
135
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
218
136
|
setSearchValue(inputValue);
|
|
219
|
-
|
|
220
137
|
if ((searchValue || !isSearchValueChangedAfterOpen) && !e.target.value) {
|
|
221
138
|
onChange("");
|
|
222
139
|
setSearchValue("");
|
|
@@ -224,18 +141,12 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
224
141
|
} else setIsValueDeleted(false);
|
|
225
142
|
}
|
|
226
143
|
};
|
|
227
|
-
|
|
228
|
-
var highlightedText = function highlightedText(text, postfix) {
|
|
144
|
+
const highlightedText = (text, postfix) => {
|
|
229
145
|
if (!isSearchable) return text;else {
|
|
230
146
|
var _text;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var prepare = function prepare(text) {
|
|
235
|
-
return text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
text = text.replace(/["&<>]/g, function (a) {
|
|
147
|
+
const preparedSearchValue = isSearchValueChangedAfterOpen || isMobile && withMobileLogic ? searchValue : labelByValue;
|
|
148
|
+
const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
149
|
+
text = text.replace(/["&<>]/g, a => {
|
|
239
150
|
return {
|
|
240
151
|
'"': """,
|
|
241
152
|
"&": "&",
|
|
@@ -243,29 +154,30 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
243
154
|
">": ">"
|
|
244
155
|
}[a];
|
|
245
156
|
});
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}) : text;
|
|
249
|
-
var postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : "";
|
|
157
|
+
const main = preparedSearchValue ? (_text = text) === null || _text === void 0 ? void 0 : _text.replace(new RegExp(prepare(preparedSearchValue), "i"), match => "<span class=\"bg--yellow\">".concat(match, "</span>")) : text;
|
|
158
|
+
const postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : "";
|
|
250
159
|
return main + postfixPart;
|
|
251
160
|
}
|
|
252
161
|
};
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
var lowerLabel = item.label.toLowerCase();
|
|
258
|
-
var lowerSearchValue = searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase();
|
|
162
|
+
const getMarkupForElement = (item, index, optTestId) => {
|
|
163
|
+
var _item$value, _item$value2, _item$customMobileIco;
|
|
164
|
+
const lowerLabel = item.label.toLowerCase();
|
|
165
|
+
const lowerSearchValue = searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase();
|
|
259
166
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
260
|
-
"data-testid": "dropdown-live-search--button--key-".concat(optTestId || (item === null || item === void 0
|
|
261
|
-
key: (_item$value2 = item.value) === null || _item$value2 === void 0
|
|
262
|
-
onClick:
|
|
167
|
+
"data-testid": "dropdown-live-search--button--key-".concat(optTestId || (item === null || item === void 0 || (_item$value = item.value) === null || _item$value === void 0 || (_item$value = _item$value.toString()) === null || _item$value === void 0 ? void 0 : _item$value.replace(/\s/, "-")) || (item === null || item === void 0 ? void 0 : item.key) || "item", "--option"),
|
|
168
|
+
key: (_item$value2 = item.value) === null || _item$value2 === void 0 || (_item$value2 = _item$value2.toString()) === null || _item$value2 === void 0 ? void 0 : _item$value2.replace(/ /g, "_"),
|
|
169
|
+
onClick: () => {
|
|
263
170
|
onChange(item.value);
|
|
264
171
|
setIsOpen(false);
|
|
265
172
|
},
|
|
266
|
-
className: (0, _classnames.default)("".concat(RC, "__list-item"),
|
|
173
|
+
className: (0, _classnames.default)("".concat(RC, "__list-item"), {
|
|
174
|
+
["".concat(RC, "__list-item_active")]: item.value === value,
|
|
175
|
+
["".concat(RC, "__list-item_disabled")]: item.disabled
|
|
176
|
+
}, item.className)
|
|
267
177
|
}, !isMobile || isMobile && !withMobileLogic && /*#__PURE__*/_react.default.createElement("span", {
|
|
268
|
-
className: (0, _classnames.default)("".concat(RC, "__active-icon"),
|
|
178
|
+
className: (0, _classnames.default)("".concat(RC, "__active-icon"), {
|
|
179
|
+
["".concat(RC, "__active-icon_active")]: lowerLabel === lowerSearchValue
|
|
180
|
+
})
|
|
269
181
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("p", {
|
|
270
182
|
title: item.label,
|
|
271
183
|
className: item.labelClassName || "",
|
|
@@ -277,36 +189,38 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
277
189
|
checked: value
|
|
278
190
|
}) : "");
|
|
279
191
|
};
|
|
280
|
-
|
|
281
|
-
var getListMarkUp = function getListMarkUp() {
|
|
282
|
-
var _cn3, _cn5;
|
|
283
|
-
|
|
192
|
+
const getListMarkUp = () => {
|
|
284
193
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
285
194
|
className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
|
|
286
195
|
ref: wrapperRef,
|
|
287
|
-
onClick: isMobile ? onWrapperClick :
|
|
196
|
+
onClick: isMobile ? onWrapperClick : () => {}
|
|
288
197
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
289
|
-
className: (0, _classnames.default)("".concat(RC, "__list-wrapper"),
|
|
198
|
+
className: (0, _classnames.default)("".concat(RC, "__list-wrapper"), {
|
|
199
|
+
["".concat(RC, "__list-wrapper--fixed-height")]: isFixedMaxHeight,
|
|
200
|
+
["".concat(RC, "__list-wrapper--with-bottom-shadow")]: isScrollableList && isMobile,
|
|
201
|
+
["".concat(RC, "__list-wrapper--with-bottom-shadow-hidden")]: scrollTop === scrollHeight
|
|
202
|
+
})
|
|
290
203
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
291
204
|
id: "dropdown-live-search-list",
|
|
292
|
-
className: (0, _classnames.default)("".concat(RC, "__container"),
|
|
205
|
+
className: (0, _classnames.default)("".concat(RC, "__container"), {
|
|
206
|
+
["".concat(RC, "__list-top")]: isListTop
|
|
207
|
+
}),
|
|
293
208
|
ref: dropdownListBoxRef
|
|
294
209
|
}, isMobile && /*#__PURE__*/_react.default.createElement("div", {
|
|
295
210
|
ref: dropdownListHeaderRef,
|
|
296
|
-
className: (0, _classnames.default)("".concat(RC, "__list-header"),
|
|
211
|
+
className: (0, _classnames.default)("".concat(RC, "__list-header"), {
|
|
212
|
+
["".concat(RC, "__list-header-with-shadow")]: isScrollableList && isMobile,
|
|
213
|
+
["".concat(RC, "__list-header-with-shadow-hidden")]: scrollTop === 0
|
|
214
|
+
})
|
|
297
215
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
298
216
|
className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
|
|
299
217
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
300
218
|
className: (0, _classnames.default)("".concat(RC, "__list-label"))
|
|
301
219
|
}, label), /*#__PURE__*/_react.default.createElement("div", {
|
|
302
220
|
className: (0, _classnames.default)("".concat(RC, "__list-close-icon")),
|
|
303
|
-
onClick:
|
|
304
|
-
return setIsOpen(false);
|
|
305
|
-
}
|
|
221
|
+
onClick: () => setIsOpen(false)
|
|
306
222
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
|
|
307
|
-
onClick:
|
|
308
|
-
return setIsOpen(false);
|
|
309
|
-
}
|
|
223
|
+
onClick: () => setIsOpen(false)
|
|
310
224
|
}))), isSearchable && /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
311
225
|
ref: searchInputModalRef,
|
|
312
226
|
className: "".concat(RC, "__input"),
|
|
@@ -320,130 +234,107 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
320
234
|
disabled: isLoading
|
|
321
235
|
}),
|
|
322
236
|
ref: dropdownListRef
|
|
323
|
-
}, options.map(
|
|
324
|
-
return getMarkupForElement(option);
|
|
325
|
-
}), !options.length && /*#__PURE__*/_react.default.createElement("div", {
|
|
237
|
+
}, options.map(option => getMarkupForElement(option)), !options.length && /*#__PURE__*/_react.default.createElement("div", {
|
|
326
238
|
className: "".concat(RC, "__list-item ").concat(RC, "__list-item--no-options")
|
|
327
239
|
}, noOptionsText)), isLoading && isOpen && /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
328
240
|
size: options.length <= 3 ? "small" : null
|
|
329
241
|
}))));
|
|
330
242
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var dropdownList = document.createElement("div");
|
|
243
|
+
const initListContainer = () => {
|
|
244
|
+
const dropdownList = document.createElement("div");
|
|
334
245
|
dropdownList.setAttribute("id", dropdownId);
|
|
335
246
|
dropdownList.classList.add("dropdown__container");
|
|
336
|
-
|
|
337
247
|
if (isMobile) {
|
|
338
|
-
dropdownList.addEventListener("click",
|
|
248
|
+
dropdownList.addEventListener("click", e => {
|
|
339
249
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
340
250
|
});
|
|
341
251
|
}
|
|
342
|
-
|
|
343
252
|
try {
|
|
344
253
|
var _getListContainer2;
|
|
345
|
-
|
|
346
|
-
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
|
|
254
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
|
|
347
255
|
} finally {
|
|
348
256
|
if (isMobile) {
|
|
349
257
|
var _getParentNode;
|
|
350
|
-
|
|
351
258
|
try {
|
|
352
259
|
var _document$getElementB;
|
|
353
|
-
|
|
354
|
-
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
|
|
260
|
+
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
|
355
261
|
} catch (e) {}
|
|
356
|
-
|
|
357
|
-
var dropdownMobileListWrapper = document.createElement("div");
|
|
262
|
+
const dropdownMobileListWrapper = document.createElement("div");
|
|
358
263
|
dropdownMobileListWrapper.classList.add("dropdown-live-search-mobile");
|
|
359
264
|
dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
|
|
360
|
-
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0
|
|
361
|
-
(_getParentNode = getParentNode()) === null || _getParentNode === void 0
|
|
265
|
+
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
|
|
266
|
+
(_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
|
|
362
267
|
} else {
|
|
363
268
|
var _getParentNode2;
|
|
364
|
-
|
|
365
|
-
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
|
|
269
|
+
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
|
|
366
270
|
}
|
|
367
271
|
}
|
|
368
272
|
};
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var lc = getListContainer();
|
|
273
|
+
const renderListContainer = () => {
|
|
274
|
+
const lc = getListContainer();
|
|
372
275
|
if (!lc) return null;
|
|
373
276
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
374
277
|
};
|
|
375
|
-
|
|
376
|
-
(0, _react.useEffect)(function () {
|
|
278
|
+
(0, _react.useEffect)(() => {
|
|
377
279
|
document.addEventListener("click", handleClickOutside, true);
|
|
378
|
-
return
|
|
379
|
-
return document.removeEventListener("click", handleClickOutside, true);
|
|
380
|
-
};
|
|
280
|
+
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
381
281
|
}, []);
|
|
382
|
-
(0, _react.useEffect)(
|
|
282
|
+
(0, _react.useEffect)(() => {
|
|
383
283
|
if (options.length === 1 && searchValue === options[0].label) {
|
|
384
284
|
setSearchValue(options[0].label);
|
|
385
285
|
onChange(options[0].value);
|
|
386
286
|
}
|
|
387
287
|
}, [options]);
|
|
388
|
-
(0, _react.useEffect)(
|
|
288
|
+
(0, _react.useEffect)(() => {
|
|
389
289
|
if (isSearchable && (debouncedSearchTerm || isValueDeleted)) {
|
|
390
290
|
doRequest(debouncedSearchTerm);
|
|
391
291
|
if (isValueDeleted) setIsValueDeleted(false);
|
|
392
292
|
}
|
|
393
293
|
}, [debouncedSearchTerm, isValueDeleted]);
|
|
394
|
-
(0, _react.useEffect)(
|
|
294
|
+
(0, _react.useEffect)(() => {
|
|
395
295
|
if (isMobile && withMobileLogic) {
|
|
396
296
|
initListContainer();
|
|
397
297
|
}
|
|
398
298
|
}, [isMobile, withMobileLogic]);
|
|
399
|
-
(0, _react.useEffect)(
|
|
299
|
+
(0, _react.useEffect)(() => {
|
|
400
300
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
|
|
401
301
|
var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
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));
|
|
302
|
+
setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
|
|
303
|
+
setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
|
|
405
304
|
}
|
|
406
|
-
}, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0
|
|
407
|
-
(0, _react.useLayoutEffect)(
|
|
408
|
-
|
|
409
|
-
|
|
305
|
+
}, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
|
|
306
|
+
(0, _react.useLayoutEffect)(() => {
|
|
307
|
+
const list = document.getElementById("dropdown-live-search-list");
|
|
410
308
|
if ((list || isOpen) && (!withMobileLogic || !isMobile)) {
|
|
411
309
|
var _dropdownLiveSearchRe;
|
|
412
|
-
|
|
413
|
-
var dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 ? void 0 : (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
|
|
310
|
+
const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 || (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
|
|
414
311
|
list.style.minWidth = "".concat(dropdownWidth, "px");
|
|
415
312
|
}
|
|
416
313
|
}, [dropdownLiveSearchRef, isOpen, withMobileLogic]);
|
|
417
|
-
(0, _react.useEffect)(
|
|
314
|
+
(0, _react.useEffect)(() => {
|
|
418
315
|
if (!isOpen) {
|
|
419
316
|
setIsFocusedByClick(false);
|
|
420
317
|
if (withMobileLogic && isMobile) setSearchValue("");
|
|
421
318
|
}
|
|
422
|
-
|
|
423
319
|
if (isOpen && dropdownListRef && dropdownListRef.current) {
|
|
424
320
|
if (isMobile && withMobileLogic) {
|
|
425
321
|
var _searchInputModalRef$;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
dropdownListRef.current.style.maxHeight = "".concat((dropdownListBoxRef === null || dropdownListBoxRef === void 0 ? void 0 : (_dropdownListBoxRef$c = dropdownListBoxRef.current) === null || _dropdownListBoxRef$c === void 0 ? void 0 : (_dropdownListBoxRef$c2 = _dropdownListBoxRef$c.getBoundingClientRect()) === null || _dropdownListBoxRef$c2 === void 0 ? void 0 : _dropdownListBoxRef$c2.height) - (dropdownListHeaderRef === null || dropdownListHeaderRef === void 0 ? void 0 : (_dropdownListHeaderRe = dropdownListHeaderRef.current) === null || _dropdownListHeaderRe === void 0 ? void 0 : (_dropdownListHeaderRe2 = _dropdownListHeaderRe.getBoundingClientRect()) === null || _dropdownListHeaderRe2 === void 0 ? void 0 : _dropdownListHeaderRe2.height), "px");
|
|
322
|
+
doRequest("").then(() => {
|
|
323
|
+
setTimeout(() => {
|
|
324
|
+
var _dropdownListBoxRef$c, _dropdownListHeaderRe;
|
|
325
|
+
dropdownListRef.current.style.maxHeight = "".concat((dropdownListBoxRef === null || dropdownListBoxRef === void 0 || (_dropdownListBoxRef$c = dropdownListBoxRef.current) === null || _dropdownListBoxRef$c === void 0 || (_dropdownListBoxRef$c = _dropdownListBoxRef$c.getBoundingClientRect()) === null || _dropdownListBoxRef$c === void 0 ? void 0 : _dropdownListBoxRef$c.height) - (dropdownListHeaderRef === null || dropdownListHeaderRef === void 0 || (_dropdownListHeaderRe = dropdownListHeaderRef.current) === null || _dropdownListHeaderRe === void 0 || (_dropdownListHeaderRe = _dropdownListHeaderRe.getBoundingClientRect()) === null || _dropdownListHeaderRe === void 0 ? void 0 : _dropdownListHeaderRe.height), "px");
|
|
432
326
|
}, 1);
|
|
433
327
|
});
|
|
434
|
-
searchInputModalRef === null || searchInputModalRef === void 0
|
|
328
|
+
searchInputModalRef === null || searchInputModalRef === void 0 || (_searchInputModalRef$ = searchInputModalRef.current) === null || _searchInputModalRef$ === void 0 || _searchInputModalRef$.focus();
|
|
435
329
|
}
|
|
436
|
-
|
|
437
330
|
dropdownListRef.current.addEventListener("scroll", doScrollCallback);
|
|
438
331
|
}
|
|
439
|
-
|
|
440
|
-
return function () {
|
|
332
|
+
return () => {
|
|
441
333
|
removeEventListener("scroll", doScrollCallback);
|
|
442
334
|
};
|
|
443
335
|
}, [isOpen, dropdownListRef]);
|
|
444
|
-
(0, _react.useLayoutEffect)(
|
|
336
|
+
(0, _react.useLayoutEffect)(() => {
|
|
445
337
|
var _getListContainer3;
|
|
446
|
-
|
|
447
338
|
if (!isMobile) {
|
|
448
339
|
window.addEventListener("mousewheel", closeList);
|
|
449
340
|
window.addEventListener("scroll", closeList);
|
|
@@ -453,62 +344,51 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
453
344
|
window.removeEventListener("scroll", closeList);
|
|
454
345
|
window.removeEventListener("touchmove", closeList);
|
|
455
346
|
}
|
|
456
|
-
|
|
457
|
-
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
|
|
347
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
|
|
458
348
|
window.addEventListener("keyup", closeListViaEsc);
|
|
459
|
-
return
|
|
349
|
+
return () => {
|
|
460
350
|
var _getListContainer4;
|
|
461
|
-
|
|
462
351
|
window.removeEventListener("mousewheel", closeList);
|
|
463
352
|
window.removeEventListener("scroll", closeList);
|
|
464
353
|
window.removeEventListener("touchmove", closeList);
|
|
465
354
|
window.removeEventListener("keyup", closeListViaEsc);
|
|
466
|
-
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0
|
|
355
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
|
|
467
356
|
};
|
|
468
357
|
}, [getListContainer]);
|
|
469
|
-
(0, _react.useEffect)(
|
|
470
|
-
|
|
358
|
+
(0, _react.useEffect)(() => {
|
|
359
|
+
const setScrollTopValue = e => {
|
|
471
360
|
setScrollTop(parseInt(e.target.scrollTop, 10));
|
|
472
361
|
};
|
|
473
|
-
|
|
474
362
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
475
363
|
var _dropdownListRef$curr7;
|
|
476
|
-
|
|
477
|
-
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
364
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
478
365
|
}
|
|
479
|
-
|
|
480
|
-
return function () {
|
|
366
|
+
return () => {
|
|
481
367
|
var _dropdownListRef$curr8;
|
|
482
|
-
|
|
483
|
-
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
368
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
484
369
|
};
|
|
485
370
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
486
|
-
(0, _react.useEffect)(
|
|
371
|
+
(0, _react.useEffect)(() => {
|
|
487
372
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
488
373
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
489
|
-
|
|
490
|
-
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));
|
|
374
|
+
setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
|
|
491
375
|
}
|
|
492
376
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
493
377
|
if (!options) return null;
|
|
494
378
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
495
|
-
className: (0, _classnames.default)(RC, className,
|
|
496
|
-
disabled
|
|
497
|
-
|
|
379
|
+
className: (0, _classnames.default)(RC, className, {
|
|
380
|
+
disabled,
|
|
381
|
+
["".concat(RC, "-mobile")]: isMobile,
|
|
382
|
+
["".concat(RC, "--focused")]: isOpen
|
|
383
|
+
}),
|
|
498
384
|
ref: dropdownLiveSearchRef
|
|
499
385
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
500
386
|
"data-testid": "dropdown-live-search--".concat(testId || "", "--container"),
|
|
501
387
|
className: "".concat(RC, "__trigger input__wrap ").concat(isOpen ? "input__wrap--focus" : "", " ").concat(!value ? "placeholder" : "", " ").concat(error ? "error" : ""),
|
|
502
|
-
onClick:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
return setIsFocusedByClick(true);
|
|
507
|
-
},
|
|
508
|
-
onFocus: function onFocus() {
|
|
509
|
-
return !isFocusedByClick ? setIsOpen(true) : null;
|
|
510
|
-
},
|
|
511
|
-
tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
|
|
388
|
+
onClick: () => !isSearchable ? setIsOpen(!isOpen) : null,
|
|
389
|
+
onMouseDown: () => setIsFocusedByClick(true),
|
|
390
|
+
onFocus: () => !isFocusedByClick ? setIsOpen(true) : null,
|
|
391
|
+
tabIndex: tabIndex === null || tabIndex === void 0 || (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
|
|
512
392
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
513
393
|
ref: searchInputRef,
|
|
514
394
|
className: "".concat(RC, "__input"),
|
|
@@ -521,14 +401,12 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
521
401
|
}, attributesOfNativeInput)) : /*#__PURE__*/_react.default.createElement("span", {
|
|
522
402
|
className: "text"
|
|
523
403
|
}, labelByValue || placeholder), /*#__PURE__*/_react.default.createElement("span", {
|
|
524
|
-
className: (0, _classnames.default)("".concat(RC, "__arrow"),
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
404
|
+
className: (0, _classnames.default)("".concat(RC, "__arrow"), {
|
|
405
|
+
["".concat(RC, "__arrow_active")]: isOpen
|
|
406
|
+
}),
|
|
407
|
+
onClick: () => setIsOpen(!isOpen)
|
|
528
408
|
}, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, {
|
|
529
409
|
className: "mobile-icon"
|
|
530
410
|
}) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && (isMobile && withMobileLogic ? renderListContainer() : getListMarkUp()));
|
|
531
411
|
};
|
|
532
|
-
|
|
533
|
-
var _default = DropdownLiveSearch;
|
|
534
|
-
exports.default = _default;
|
|
412
|
+
var _default = exports.default = DropdownLiveSearch;
|