intelicoreact 1.3.22 → 1.3.24
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 +5 -8
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.scss +9 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +6 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.scss +8 -10
- package/dist/Atomic/FormElements/Calendar/Calendar.js +31 -33
- package/dist/Atomic/FormElements/Calendar/Calendar.scss +23 -27
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +4 -4
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +16 -19
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +1 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.scss +2 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +53 -53
- package/dist/Atomic/FormElements/Datepicker/Datepicker.scss +0 -8
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +20 -20
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +81 -83
- package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +141 -95
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -1
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.scss +3 -3
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +30 -28
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.scss +54 -18
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +4 -4
- package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +31 -30
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +12 -12
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +3 -3
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +8 -8
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.scss +44 -29
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +17 -15
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +15 -15
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.scss +24 -21
- package/dist/Atomic/FormElements/Input/Input.js +43 -45
- package/dist/Atomic/FormElements/Input/Input.scss +18 -18
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +19 -19
- package/dist/Atomic/FormElements/InputColor/InputColor.js +7 -9
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +12 -12
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.scss +9 -6
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +42 -42
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +95 -95
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +10 -10
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -81
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +14 -14
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +4 -4
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +54 -54
- package/dist/Atomic/FormElements/InputLink/InputLink.js +11 -13
- package/dist/Atomic/FormElements/InputLink/InputLink.scss +5 -5
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +2 -2
- package/dist/Atomic/FormElements/InputMask/InputMask.js +66 -67
- package/dist/Atomic/FormElements/InputMask/InputMask.scss +10 -10
- package/dist/Atomic/FormElements/InputMask/config.js +9 -9
- package/dist/Atomic/FormElements/InputMask/functions.js +8 -7
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +42 -42
- package/dist/Atomic/FormElements/InputMask2/InputMask2.scss +13 -12
- package/dist/Atomic/FormElements/InputMask2/config.js +9 -9
- package/dist/Atomic/FormElements/InputMask2/functions.js +8 -7
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +50 -50
- package/dist/Atomic/FormElements/InputMask3/InputMask3.scss +13 -12
- package/dist/Atomic/FormElements/InputMask3/config.js +9 -9
- package/dist/Atomic/FormElements/InputMask3/functions.js +8 -7
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +7 -9
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.scss +34 -31
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +23 -23
- package/dist/Atomic/FormElements/InputsRow/InputsRow.scss +4 -5
- package/dist/Atomic/FormElements/Label/Label.js +2 -2
- package/dist/Atomic/FormElements/Label/Label.scss +2 -2
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +69 -69
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +8 -9
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +2 -2
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.scss +2 -2
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +27 -27
- package/dist/Atomic/FormElements/NumericInput/NumericInput.scss +18 -18
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +3 -3
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.scss +1 -0
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +6 -6
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.scss +1 -0
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +2 -2
- package/dist/Atomic/FormElements/RadioInput/RadioInput.scss +4 -8
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +7 -7
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.scss +26 -25
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +24 -24
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +17 -19
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +30 -30
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.scss +5 -5
- package/dist/Atomic/FormElements/RangeList/RangeList.js +27 -27
- package/dist/Atomic/FormElements/RangeList/RangeList.scss +23 -23
- package/dist/Atomic/FormElements/RangeList/partial/AnyOuterClass.scss +5 -4
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +1 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +31 -31
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.scss +19 -24
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.stories.scss +7 -7
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider.stories.scss +8 -8
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +22 -22
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.scss +165 -91
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +1 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.scss +2 -2
- package/dist/Atomic/FormElements/Switcher/Switcher.js +1 -1
- package/dist/Atomic/FormElements/Switcher/Switcher.scss +10 -12
- package/dist/Atomic/FormElements/Switcher/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +4 -6
- package/dist/Atomic/FormElements/SwitcherCheckbox/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +2 -2
- package/dist/Atomic/FormElements/SwitcherHide/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +4 -4
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.scss +1 -1
- package/dist/Atomic/FormElements/SwitcherRadio/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +5 -5
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +2 -2
- package/dist/Atomic/FormElements/SwitcherRangeList/partial/AnyOuterClass.scss +6 -6
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +9 -9
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.scss +2 -3
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +100 -100
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +5 -5
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.scss +2 -3
- package/dist/Atomic/FormElements/SwitcherTextarea/partial/AnyOuterClass.scss +4 -4
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +67 -68
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +103 -64
- package/dist/Atomic/FormElements/Text/Text.js +13 -13
- package/dist/Atomic/FormElements/Text/Text.scss +0 -1
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +4 -4
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.scss +15 -15
- package/dist/Atomic/FormElements/Textarea/Textarea.js +2 -2
- package/dist/Atomic/FormElements/Textarea/Textarea.scss +7 -8
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +3 -3
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.scss +5 -6
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +9 -9
- package/dist/Atomic/FormElements/TimeRange/TimeRange.scss +1 -1
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +36 -37
- package/dist/Atomic/FormElements/UserContacts/partial/AnyOuterClass.scss +5 -6
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +3 -3
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.scss +77 -59
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +3 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.scss +9 -10
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/AnyOuterClass.scss +16 -14
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +18 -18
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +6 -6
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.scss +9 -10
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/AnyOuterClass.scss +16 -14
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +14 -14
- package/dist/Atomic/Layout/Header/Header.js +11 -11
- package/dist/Atomic/Layout/Header/Header.scss +9 -10
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +17 -18
- package/dist/Atomic/Layout/MainMenu/MainMenu.scss +14 -17
- package/dist/Atomic/Layout/Spinner/Spinner.js +4 -4
- package/dist/Atomic/Layout/Spinner/Spinner.scss +3 -3
- package/dist/Atomic/UI/Accordion/Accordion.js +7 -7
- package/dist/Atomic/UI/Accordion/Accordion.scss +11 -11
- package/dist/Atomic/UI/Accordion/AccordionItem.js +12 -12
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +22 -23
- package/dist/Atomic/UI/AccordionTable/AccordionTable.scss +33 -38
- package/dist/Atomic/UI/AccordionText/AccordionText.js +3 -3
- package/dist/Atomic/UI/AccordionText/AccordionText.scss +18 -10
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +31 -32
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +5 -5
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.scss +19 -18
- package/dist/Atomic/UI/Alert/Alert.js +5 -5
- package/dist/Atomic/UI/Alert/Alert.scss +21 -21
- package/dist/Atomic/UI/Arrow/Arrow.js +5 -5
- package/dist/Atomic/UI/Box/Box.js +10 -10
- package/dist/Atomic/UI/Box/Box.scss +2 -4
- package/dist/Atomic/UI/Button/Button.js +9 -9
- package/dist/Atomic/UI/Button/Button.scss +34 -34
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +4 -4
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.scss +1 -1
- package/dist/Atomic/UI/Chart/Chart.js +16 -16
- package/dist/Atomic/UI/Chart/Chart.scss +4 -4
- package/dist/Atomic/UI/Chart/partial/AnyOuterClass.scss +10 -14
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +30 -30
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +3 -3
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.scss +1 -1
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +15 -15
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +28 -28
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +2 -2
- package/dist/Atomic/UI/Chart/partial/utils.js +4 -4
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +9 -9
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.scss +7 -9
- package/dist/Atomic/UI/DateTime/DateTime.js +6 -6
- package/dist/Atomic/UI/DateTime/DateTime.scss +1 -1
- package/dist/Atomic/UI/DateTime/partial/AnyOuterClass.scss +2 -2
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +4 -4
- package/dist/Atomic/UI/DebugContainer/DebugContainer.scss +15 -9
- package/dist/Atomic/UI/DoubleString/DoubleString.js +6 -6
- package/dist/Atomic/UI/DoubleString/DoubleString.scss +11 -5
- package/dist/Atomic/UI/DoubleString/partial/AnyOuterClass.scss +4 -4
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +1 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +48 -48
- package/dist/Atomic/UI/ExampleChartIntegration/partial/AnyOuterClass.scss +10 -15
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +18 -18
- package/dist/Atomic/UI/Hint/Hint.js +40 -41
- package/dist/Atomic/UI/Hint/Hint.scss +12 -11
- package/dist/Atomic/UI/Modal/Modal.js +28 -36
- package/dist/Atomic/UI/Modal/Modal.scss +42 -43
- package/dist/Atomic/UI/Modal/ModalHOC.js +2 -5
- package/dist/Atomic/UI/Modal/ModalMobile.scss +18 -11
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +2 -2
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +6 -6
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +8 -8
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +1 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.scss +5 -5
- package/dist/Atomic/UI/MonoAccordion/partial/AnyOuterClass.scss +4 -5
- package/dist/Atomic/UI/NavLine/NavLine.js +26 -26
- package/dist/Atomic/UI/NavLine/NavLine.scss +34 -36
- package/dist/Atomic/UI/NavLine/Tabs.js +38 -38
- package/dist/Atomic/UI/PageTitle/PageTitle.js +1 -1
- package/dist/Atomic/UI/PageTitle/PageTitle.scss +7 -7
- package/dist/Atomic/UI/PieChart/PieChart.js +4 -4
- package/dist/Atomic/UI/PieChart/PieChart.scss +21 -10
- package/dist/Atomic/UI/Price/Price.js +2 -2
- package/dist/Atomic/UI/PriceRange/PriceRange.js +2 -2
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +10 -10
- package/dist/Atomic/UI/ProgressLine/ProgressLine.scss +36 -40
- package/dist/Atomic/UI/Status/Status.js +6 -6
- package/dist/Atomic/UI/Status/Status.scss +19 -19
- package/dist/Atomic/UI/Table/Partials/TdCell.js +11 -11
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +3 -3
- package/dist/Atomic/UI/Table/Partials/TdRow.js +6 -6
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +1 -1
- package/dist/Atomic/UI/Table/Table.js +3 -3
- package/dist/Atomic/UI/Table/Table.scss +11 -13
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +8 -8
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +2 -2
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +1 -3
- package/dist/Atomic/UI/Table/TdTypes/TdTypes.scss +9 -8
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +10 -13
- package/dist/Atomic/UI/Tag/Tag.js +6 -6
- package/dist/Atomic/UI/Tag/Tag.scss +12 -11
- package/dist/Atomic/UI/TagList/TagList.js +8 -8
- package/dist/Atomic/UI/TagList/TagList.scss +1 -1
- package/dist/Atomic/UI/UserBox/UserBox.js +5 -5
- package/dist/Atomic/UI/UserBox/UserBox.scss +9 -9
- package/dist/Classes/AbortableFetch.js +35 -35
- package/dist/Classes/AnimatedHandler.js +3 -3
- package/dist/Classes/RESTAPI/index.js +9 -9
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +37 -37
- package/dist/Classes/RESTAPI/partials/ApiBase.js +7 -7
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +4 -4
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +4 -4
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +31 -31
- package/dist/Classes/RESTAPI/partials/Utils.js +15 -15
- package/dist/Classes/RESTAPI/partials/_utils.js +14 -14
- package/dist/Constants/index.constants.js +10 -10
- package/dist/Functions/Portal.js +1 -1
- package/dist/Functions/customEventListener.js +5 -5
- package/dist/Functions/fieldValueFormatters.js +66 -82
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +4 -4
- package/dist/Functions/locale/createTranslator.js +4 -15
- package/dist/Functions/operations.js +14 -14
- package/dist/Functions/presets/inputMaskPresets.js +34 -34
- package/dist/Functions/presets/inputPresets.js +3 -3
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +2 -2
- package/dist/Functions/schemas.js +8 -8
- package/dist/Functions/useBodyScrollLock.js +20 -0
- package/dist/Functions/useClickOutside.js +2 -2
- package/dist/Functions/useFieldFocus.js +3 -7
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +1 -1
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +11 -11
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +1 -1
- package/dist/Functions/useFormTools/functions/General.js +9 -9
- package/dist/Functions/useFormTools/functions/RenderFields.js +6 -6
- package/dist/Functions/useFormTools/index.js +18 -20
- package/dist/Functions/useInputHighlightError.js +5 -5
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +44 -0
- package/dist/Functions/useKeyPress/useKeyPress.js +38 -0
- package/dist/Functions/useLocalStorage.js +2 -13
- package/dist/Functions/useLocationParams.js +2 -2
- package/dist/Functions/useMetaInfo.js +7 -7
- package/dist/Functions/useMouseUpOutside.js +2 -2
- package/dist/Functions/useOnlineStatus.js +5 -14
- package/dist/Functions/usePasswordChecker.js +26 -26
- package/dist/Functions/usePrevious.js +0 -12
- package/dist/Functions/useResize.js +6 -24
- package/dist/Functions/useScrollTo.js +1 -1
- package/dist/Functions/useToggle.js +1 -1
- package/dist/Functions/utils.js +64 -143
- package/dist/Molecular/FormElement/FormElement.js +1 -1
- package/dist/Molecular/FormElement/FormElement.scss +4 -3
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +14 -14
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +2 -2
- package/dist/Molecular/InputAddress/InputAddress.js +47 -46
- package/dist/Molecular/InputAddress/InputAddress.scss +176 -112
- package/dist/Molecular/InputPassword/InputPassword.js +11 -15
- package/dist/Molecular/InputPassword/InputPassword.scss +8 -7
- package/dist/scss/_fonts.scss +60 -36
- package/dist/scss/_vars.scss +18 -18
- package/dist/scss/main.scss +4 -4
- package/package.json +1 -1
|
@@ -7,19 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactDom = require("react-dom");
|
|
11
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _reactDom = require("react-dom");
|
|
12
12
|
var _reactFeather = require("react-feather");
|
|
13
|
-
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
14
|
-
var _utils = require("../../../Functions/utils");
|
|
15
|
-
var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
16
13
|
var _Input = _interopRequireDefault(require("../../../Atomic/FormElements/Input/Input"));
|
|
17
14
|
var _RadioInput = _interopRequireDefault(require("../../../Atomic/FormElements/RadioInput/RadioInput"));
|
|
15
|
+
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
16
|
+
var _useBodyScrollLock = _interopRequireDefault(require("../../../Functions/useBodyScrollLock"));
|
|
17
|
+
var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
18
|
+
var _utils = require("../../../Functions/utils");
|
|
18
19
|
var _DropdownLoader = _interopRequireDefault(require("./components/DropdownLoader"));
|
|
19
20
|
require("./Dropdown.scss");
|
|
20
21
|
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); }
|
|
21
22
|
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; }
|
|
22
|
-
const RC =
|
|
23
|
+
const RC = "dropdown";
|
|
23
24
|
const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
24
25
|
const Dropdown = _ref => {
|
|
25
26
|
var _options$find, _dropdownListWrapperR3, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find, _tabIndex$toString;
|
|
@@ -41,7 +42,7 @@ const Dropdown = _ref => {
|
|
|
41
42
|
sortAlphabetical = true,
|
|
42
43
|
fieldKey,
|
|
43
44
|
id,
|
|
44
|
-
noOptionsText =
|
|
45
|
+
noOptionsText = "No options available",
|
|
45
46
|
attributesOfNativeInput = {},
|
|
46
47
|
isDoNotPullOutListOfMainContainer,
|
|
47
48
|
withMobileLogic,
|
|
@@ -68,6 +69,7 @@ const Dropdown = _ref => {
|
|
|
68
69
|
const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
|
|
69
70
|
const [scrollTop, setScrollTop] = (0, _react.useState)(0);
|
|
70
71
|
const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
|
|
72
|
+
(0, _useBodyScrollLock.default)(isOpen);
|
|
71
73
|
if (!options) return null;
|
|
72
74
|
const getTotalOptions = (0, _react.useCallback)(() => {
|
|
73
75
|
return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
|
|
@@ -82,7 +84,7 @@ const Dropdown = _ref => {
|
|
|
82
84
|
}, [options]);
|
|
83
85
|
if (isMobile) isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
|
|
84
86
|
const moveOtherToEnd = options => {
|
|
85
|
-
const otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => (option === null || option === void 0 ? void 0 : option.value) ===
|
|
87
|
+
const otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => (option === null || option === void 0 ? void 0 : option.value) === "other");
|
|
86
88
|
if (otherIndex > -1) {
|
|
87
89
|
const other = options === null || options === void 0 ? void 0 : options.splice(otherIndex, 1);
|
|
88
90
|
options.push(...other);
|
|
@@ -101,7 +103,7 @@ const Dropdown = _ref => {
|
|
|
101
103
|
...item,
|
|
102
104
|
items: !isSearchable || !isSearchChanged ? item === null || item === void 0 ? void 0 : item.items : (_item$items2 = item.items) === null || _item$items2 === void 0 ? void 0 : _item$items2.slice().filter(el => {
|
|
103
105
|
var _el$label;
|
|
104
|
-
return (el === null || el === void 0 || (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) ||
|
|
106
|
+
return (el === null || el === void 0 || (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
|
|
105
107
|
})
|
|
106
108
|
};
|
|
107
109
|
}).filter(item => {
|
|
@@ -114,10 +116,10 @@ const Dropdown = _ref => {
|
|
|
114
116
|
}).filter(item => {
|
|
115
117
|
var _item$label;
|
|
116
118
|
if (!isSearchable || !isSearchChanged) return true;
|
|
117
|
-
return (item === null || item === void 0 || (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) ||
|
|
119
|
+
return (item === null || item === void 0 || (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === "";
|
|
118
120
|
});
|
|
119
121
|
const filteredOptions = [...filteredItems, ...filteredGroups];
|
|
120
|
-
const modalBtnTrigger = entity && entity !==
|
|
122
|
+
const modalBtnTrigger = entity && entity !== "" && typeof entity === "string";
|
|
121
123
|
const onChangeHandler = item => {
|
|
122
124
|
setIsOpen(false);
|
|
123
125
|
onChange(item.value);
|
|
@@ -133,8 +135,8 @@ const Dropdown = _ref => {
|
|
|
133
135
|
// decorator
|
|
134
136
|
const getDepends = getDependsTrigger => {
|
|
135
137
|
const newOnChange = e => {
|
|
136
|
-
if (e.value ===
|
|
137
|
-
onChange(
|
|
138
|
+
if (e.value === "open_modal") {
|
|
139
|
+
onChange("open_modal");
|
|
138
140
|
} else {
|
|
139
141
|
onChangeHandler(e);
|
|
140
142
|
}
|
|
@@ -143,8 +145,8 @@ const Dropdown = _ref => {
|
|
|
143
145
|
// add pseudo option
|
|
144
146
|
const newOptions = [{
|
|
145
147
|
label: "New ".concat(entity),
|
|
146
|
-
value:
|
|
147
|
-
className:
|
|
148
|
+
value: "open_modal",
|
|
149
|
+
className: "dropdown__list-item--modal"
|
|
148
150
|
}, ...filteredOptions];
|
|
149
151
|
return {
|
|
150
152
|
onChange: changeItem => {
|
|
@@ -174,26 +176,26 @@ const Dropdown = _ref => {
|
|
|
174
176
|
};
|
|
175
177
|
const hightlightedText = (text, postfix, description) => {
|
|
176
178
|
var _text;
|
|
177
|
-
const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g,
|
|
179
|
+
const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
178
180
|
text = text.replace(/["&<>]/g, function (a) {
|
|
179
181
|
return {
|
|
180
|
-
'"':
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
'"': """,
|
|
183
|
+
"&": "&",
|
|
184
|
+
"<": "<",
|
|
185
|
+
">": ">"
|
|
184
186
|
}[a];
|
|
185
187
|
});
|
|
186
|
-
const main = isSearchable && searchValue ? (_text = text) === null || _text === void 0 ? void 0 : _text.replace(new RegExp(prepare(searchValue),
|
|
187
|
-
const postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") :
|
|
188
|
-
const descriptionPart = description ? "<span class=\"dropdown__list-item-description\">".concat(description, "</span>") :
|
|
188
|
+
const main = isSearchable && searchValue ? (_text = text) === null || _text === void 0 ? void 0 : _text.replace(new RegExp(prepare(searchValue), "i"), match => "<span class=\"bg--yellow\">".concat(match, "</span>")) : text;
|
|
189
|
+
const postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : "";
|
|
190
|
+
const descriptionPart = description ? "<span class=\"dropdown__list-item-description\">".concat(description, "</span>") : "";
|
|
189
191
|
return main + postfixPart + descriptionPart;
|
|
190
192
|
};
|
|
191
193
|
const depend = getDepends(modalBtnTrigger);
|
|
192
194
|
const getMarkupForElement = (item, index, optTestId) => {
|
|
193
195
|
var _item$value, _item$value2, _item$customMobileIco;
|
|
194
196
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
195
|
-
"data-testid": "dropdown--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/,
|
|
196
|
-
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,
|
|
197
|
+
"data-testid": "dropdown--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"),
|
|
198
|
+
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, "_"),
|
|
197
199
|
onMouseDown: () => depend.onChange(item),
|
|
198
200
|
className: (0, _classnames.default)("".concat(RC, "__list-item"), {
|
|
199
201
|
["".concat(RC, "__list-item_active")]: item.value === value,
|
|
@@ -204,19 +206,19 @@ const Dropdown = _ref => {
|
|
|
204
206
|
["".concat(RC, "__active-icon_active")]: item.value === value
|
|
205
207
|
})
|
|
206
208
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
207
|
-
className: (0, _classnames.default)("".concat(RC, "__list-item-label"), item.labelClassName ||
|
|
209
|
+
className: (0, _classnames.default)("".concat(RC, "__list-item-label"), item.labelClassName || ""),
|
|
208
210
|
dangerouslySetInnerHTML: {
|
|
209
211
|
__html: hightlightedText(item.label, item.postfix, item.description)
|
|
210
212
|
}
|
|
211
|
-
}), (item === null || item === void 0 ? void 0 : item.icon) ||
|
|
213
|
+
}), (item === null || item === void 0 ? void 0 : item.icon) || "", isMobile ? (_item$customMobileIco = item === null || item === void 0 ? void 0 : item.customMobileIcon) !== null && _item$customMobileIco !== void 0 ? _item$customMobileIco : /*#__PURE__*/_react.default.createElement(_RadioInput.default, {
|
|
212
214
|
value: item.value,
|
|
213
215
|
checked: value
|
|
214
|
-
}) :
|
|
216
|
+
}) : "");
|
|
215
217
|
};
|
|
216
218
|
const filteredOptionList = filteredOption => {
|
|
217
219
|
var _filteredOption$items, _filteredOption$label;
|
|
218
220
|
return ((_filteredOption$items = filteredOption.items) === null || _filteredOption$items === void 0 ? void 0 : _filteredOption$items.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
219
|
-
key: (_filteredOption$label = filteredOption.label) === null || _filteredOption$label === void 0 || (_filteredOption$label = _filteredOption$label.toString()) === null || _filteredOption$label === void 0 ? void 0 : _filteredOption$label.replace(/ /g,
|
|
221
|
+
key: (_filteredOption$label = filteredOption.label) === null || _filteredOption$label === void 0 || (_filteredOption$label = _filteredOption$label.toString()) === null || _filteredOption$label === void 0 ? void 0 : _filteredOption$label.replace(/ /g, "_").concat(Date.now()),
|
|
220
222
|
className: (0, _classnames.default)("".concat(RC, "-group"), filteredOption.className)
|
|
221
223
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
222
224
|
className: "".concat(RC, "-group__name")
|
|
@@ -232,21 +234,21 @@ const Dropdown = _ref => {
|
|
|
232
234
|
isWithAnyScrolling,
|
|
233
235
|
scrollingInaccuracy = 0
|
|
234
236
|
} = scrollReactionObj || {};
|
|
235
|
-
if (callback && typeof callback ===
|
|
237
|
+
if (callback && typeof callback === "function") {
|
|
236
238
|
if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) callback(e);
|
|
237
239
|
}
|
|
238
240
|
}, [filteredOptions]);
|
|
239
241
|
const getParentNode = () => {
|
|
240
242
|
var _document$querySelect;
|
|
241
243
|
if (isDoNotPullOutListOfMainContainer) return dropdownRef.current;
|
|
242
|
-
return (_document$querySelect = document.querySelector(
|
|
244
|
+
return (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app");
|
|
243
245
|
};
|
|
244
246
|
const initListContainer = () => {
|
|
245
|
-
const dropdownList = document.createElement(
|
|
246
|
-
dropdownList.setAttribute(
|
|
247
|
-
dropdownList.classList.add(
|
|
247
|
+
const dropdownList = document.createElement("div");
|
|
248
|
+
dropdownList.setAttribute("id", dropdownId);
|
|
249
|
+
dropdownList.classList.add("dropdown__container");
|
|
248
250
|
if (isMobile) {
|
|
249
|
-
dropdownList.addEventListener(
|
|
251
|
+
dropdownList.addEventListener("click", e => {
|
|
250
252
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
251
253
|
});
|
|
252
254
|
}
|
|
@@ -259,10 +261,9 @@ const Dropdown = _ref => {
|
|
|
259
261
|
var _document$getElementB;
|
|
260
262
|
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
|
261
263
|
} catch (e) {}
|
|
262
|
-
;
|
|
263
|
-
|
|
264
|
-
dropdownMobileListWrapper.
|
|
265
|
-
dropdownMobileListWrapper.setAttribute('id', "mlw-".concat(dropdownId));
|
|
264
|
+
const dropdownMobileListWrapper = document.createElement("div");
|
|
265
|
+
dropdownMobileListWrapper.classList.add("dropdown-mobile");
|
|
266
|
+
dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
|
|
266
267
|
dropdownMobileListWrapper.append(dropdownList);
|
|
267
268
|
getParentNode().append(dropdownMobileListWrapper);
|
|
268
269
|
} else {
|
|
@@ -287,19 +288,19 @@ const Dropdown = _ref => {
|
|
|
287
288
|
left,
|
|
288
289
|
top
|
|
289
290
|
} = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
|
|
290
|
-
const sw = lc.getElementsByClassName(
|
|
291
|
-
const lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getElementsByClassName(
|
|
292
|
-
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 || (_getComputedStyle = _getComputedStyle.marginTop) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.replace(
|
|
293
|
-
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(sw)) === null || _getComputedStyle2 === void 0 || (_getComputedStyle2 = _getComputedStyle2.maxHeight) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.replace(
|
|
291
|
+
const sw = lc.getElementsByClassName("dropdown__list")[0];
|
|
292
|
+
const lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getElementsByClassName("dropdown__list-header")[0];
|
|
293
|
+
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 || (_getComputedStyle = _getComputedStyle.marginTop) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
|
|
294
|
+
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(sw)) === null || _getComputedStyle2 === void 0 || (_getComputedStyle2 = _getComputedStyle2.maxHeight) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.replace("px", "")) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0, 10);
|
|
294
295
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
295
296
|
const toTop = top - margin;
|
|
296
297
|
const toBottom = windowHeight - top - height - margin * 2;
|
|
297
298
|
const swHeight = sw === null || sw === void 0 || (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
298
299
|
const maxSwHeight = isMobile ? (dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR2 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR2 === void 0 || (_dropdownListWrapperR2 = _dropdownListWrapperR2.getBoundingClientRect()) === null || _dropdownListWrapperR2 === void 0 ? void 0 : _dropdownListWrapperR2.height) - (lh === null || lh === void 0 || (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) : toTop >= maxHeight || toBottom >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
299
|
-
const listPos = toTop < toBottom || toBottom >= swHeight ?
|
|
300
|
+
const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
|
|
300
301
|
lc.style.minWidth = "".concat(width, "px");
|
|
301
302
|
lc.style.left = "".concat(left, "px");
|
|
302
|
-
lc.style.top = "".concat(listPos ===
|
|
303
|
+
lc.style.top = "".concat(listPos === "bottom" ? top + height : top - swHeight - 3 * margin, "px");
|
|
303
304
|
sw.style.maxHeight = "".concat(maxSwHeight, "px");
|
|
304
305
|
};
|
|
305
306
|
const renderListContainer = () => {
|
|
@@ -314,19 +315,19 @@ const Dropdown = _ref => {
|
|
|
314
315
|
let {
|
|
315
316
|
value
|
|
316
317
|
} = _ref2;
|
|
317
|
-
return value ===
|
|
318
|
+
return value === "open_modal";
|
|
318
319
|
});
|
|
319
320
|
const emptyOption = newData.filter(_ref3 => {
|
|
320
321
|
let {
|
|
321
322
|
value
|
|
322
323
|
} = _ref3;
|
|
323
|
-
return value ===
|
|
324
|
+
return value === "";
|
|
324
325
|
});
|
|
325
326
|
const restOfOptions = newData.filter(_ref4 => {
|
|
326
327
|
let {
|
|
327
328
|
value
|
|
328
329
|
} = _ref4;
|
|
329
|
-
return value !==
|
|
330
|
+
return value !== "open_modal" && value !== "";
|
|
330
331
|
}).sort(_utils.compareAlphabetical);
|
|
331
332
|
newData = [...openModalOption, ...emptyOption, ...restOfOptions].map(item => {
|
|
332
333
|
if (item !== null && item !== void 0 && item.items) {
|
|
@@ -371,7 +372,7 @@ const Dropdown = _ref => {
|
|
|
371
372
|
className: "".concat(RC, "__input"),
|
|
372
373
|
value: searchValue !== null && searchValue !== void 0 ? searchValue : selectedLabel,
|
|
373
374
|
onChange: v => onSearchHandler(v),
|
|
374
|
-
placeholder: placeholder ||
|
|
375
|
+
placeholder: placeholder || "Search",
|
|
375
376
|
withDelete: true,
|
|
376
377
|
onFocus: () => setIsSearchInputFocused(true),
|
|
377
378
|
onBlur: () => setIsSearchInputFocused(false),
|
|
@@ -387,7 +388,7 @@ const Dropdown = _ref => {
|
|
|
387
388
|
}),
|
|
388
389
|
ref: dropdownListRef
|
|
389
390
|
}, (_getSortedOptions = getSortedOptions(depend.options)) === null || _getSortedOptions === void 0 ? void 0 : _getSortedOptions.map(option => {
|
|
390
|
-
var _option$items;
|
|
391
|
+
var _option$items, _option$label;
|
|
391
392
|
if (option !== null && option !== void 0 && (_option$items = option.items) !== null && _option$items !== void 0 && _option$items.length) {
|
|
392
393
|
if (!isSearchable || !isSearchChanged) {
|
|
393
394
|
return filteredOptionList(option);
|
|
@@ -395,7 +396,7 @@ const Dropdown = _ref => {
|
|
|
395
396
|
var _option$items2;
|
|
396
397
|
const items = (_option$items2 = option.items) === null || _option$items2 === void 0 ? void 0 : _option$items2.slice().filter(el => {
|
|
397
398
|
var _el$label2;
|
|
398
|
-
return (el === null || el === void 0 || (_el$label2 = el.label) === null || _el$label2 === void 0 ? void 0 : _el$label2.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) ||
|
|
399
|
+
return (el === null || el === void 0 || (_el$label2 = el.label) === null || _el$label2 === void 0 ? void 0 : _el$label2.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
|
|
399
400
|
});
|
|
400
401
|
if (items !== null && items !== void 0 && items.length) return filteredOptionList({
|
|
401
402
|
...option,
|
|
@@ -403,11 +404,8 @@ const Dropdown = _ref => {
|
|
|
403
404
|
});
|
|
404
405
|
return null;
|
|
405
406
|
}
|
|
406
|
-
} else {
|
|
407
|
-
|
|
408
|
-
if (!isSearchable || !isSearchChanged || option !== null && option !== void 0 && (_option$label = option.label) !== null && _option$label !== void 0 && _option$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '') || !(option !== null && option !== void 0 && option.value) || (option === null || option === void 0 ? void 0 : option.value) === '') {
|
|
409
|
-
return getMarkupForElement(option);
|
|
410
|
-
}
|
|
407
|
+
} else if (!isSearchable || !isSearchChanged || option !== null && option !== void 0 && (_option$label = option.label) !== null && _option$label !== void 0 && _option$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") || !(option !== null && option !== void 0 && option.value) || (option === null || option === void 0 ? void 0 : option.value) === "") {
|
|
408
|
+
return getMarkupForElement(option);
|
|
411
409
|
}
|
|
412
410
|
}), !filteredItems.length && !filteredGroups.length && /*#__PURE__*/_react.default.createElement("div", {
|
|
413
411
|
className: "".concat(RC, "__list-item ").concat(RC, "__list-item--no-options")
|
|
@@ -426,42 +424,42 @@ const Dropdown = _ref => {
|
|
|
426
424
|
(0, _react.useLayoutEffect)(() => {
|
|
427
425
|
var _getListContainer3;
|
|
428
426
|
if (!isMobile) {
|
|
429
|
-
window.addEventListener(
|
|
430
|
-
window.addEventListener(
|
|
431
|
-
window.addEventListener(
|
|
432
|
-
window.addEventListener(
|
|
427
|
+
window.addEventListener("resize", setListContainerStyles);
|
|
428
|
+
window.addEventListener("mousewheel", closeList);
|
|
429
|
+
window.addEventListener("scroll", closeList);
|
|
430
|
+
window.addEventListener("touchmove", closeList);
|
|
433
431
|
} else {
|
|
434
|
-
window.removeEventListener(
|
|
435
|
-
window.removeEventListener(
|
|
436
|
-
window.removeEventListener(
|
|
437
|
-
window.removeEventListener(
|
|
432
|
+
window.removeEventListener("resize", setListContainerStyles);
|
|
433
|
+
window.removeEventListener("mousewheel", closeList);
|
|
434
|
+
window.removeEventListener("scroll", closeList);
|
|
435
|
+
window.removeEventListener("touchmove", closeList);
|
|
438
436
|
}
|
|
439
|
-
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener(
|
|
437
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
|
|
440
438
|
return () => {
|
|
441
439
|
var _getListContainer4;
|
|
442
|
-
window.removeEventListener(
|
|
443
|
-
window.removeEventListener(
|
|
444
|
-
window.removeEventListener(
|
|
445
|
-
window.removeEventListener(
|
|
446
|
-
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener(
|
|
440
|
+
window.removeEventListener("resize", setListContainerStyles);
|
|
441
|
+
window.removeEventListener("mousewheel", closeList);
|
|
442
|
+
window.removeEventListener("scroll", closeList);
|
|
443
|
+
window.removeEventListener("touchmove", closeList);
|
|
444
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
|
|
447
445
|
};
|
|
448
446
|
}, [getListContainer]);
|
|
449
447
|
(0, _react.useLayoutEffect)(() => {
|
|
450
448
|
setListContainerStyles();
|
|
451
449
|
}, [isOpen, searchValue, isMobile, options, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR3 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR3 === void 0 || (_dropdownListWrapperR3 = _dropdownListWrapperR3.getBoundingClientRect()) === null || _dropdownListWrapperR3 === void 0 ? void 0 : _dropdownListWrapperR3.height]);
|
|
452
450
|
(0, _react.useEffect)(() => {
|
|
453
|
-
document.addEventListener(
|
|
454
|
-
return () => document.removeEventListener(
|
|
451
|
+
document.addEventListener("click", handleClickOutside, true);
|
|
452
|
+
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
455
453
|
}, [value]);
|
|
456
454
|
(0, _react.useEffect)(() => {
|
|
457
455
|
if (!isOpen) {
|
|
458
456
|
setIsSearchChanged(false);
|
|
459
457
|
}
|
|
460
|
-
if (scrollReactionObj && typeof scrollReactionObj ===
|
|
461
|
-
dropdownListRef.current.addEventListener(
|
|
458
|
+
if (scrollReactionObj && typeof scrollReactionObj === "object" && isOpen && dropdownListRef && dropdownListRef.current) {
|
|
459
|
+
dropdownListRef.current.addEventListener("scroll", doScrollCallback);
|
|
462
460
|
}
|
|
463
461
|
return () => {
|
|
464
|
-
if (scrollReactionObj && typeof scrollReactionObj ===
|
|
462
|
+
if (scrollReactionObj && typeof scrollReactionObj === "object") removeEventListener("scroll", doScrollCallback);
|
|
465
463
|
};
|
|
466
464
|
}, [isOpen, dropdownListRef]);
|
|
467
465
|
(0, _react.useEffect)(() => {
|
|
@@ -478,10 +476,10 @@ const Dropdown = _ref => {
|
|
|
478
476
|
if (isOpen && !isSearchInputFocused && searchInputRef !== null && searchInputRef !== void 0 && searchInputRef.current && !isMobile) searchInputRef === null || searchInputRef === void 0 || (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 || _searchInputRef$curre.focus();
|
|
479
477
|
if (isOpen) {
|
|
480
478
|
var _getListContainer5;
|
|
481
|
-
(_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.classList.add(
|
|
479
|
+
(_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.classList.add("dropdown__container--opened");
|
|
482
480
|
} else {
|
|
483
481
|
var _getListContainer6;
|
|
484
|
-
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 || _getListContainer6.classList.remove(
|
|
482
|
+
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 || _getListContainer6.classList.remove("dropdown__container--opened");
|
|
485
483
|
}
|
|
486
484
|
if (!isOpen && isMobile) {
|
|
487
485
|
setSearchValue(null);
|
|
@@ -496,21 +494,21 @@ const Dropdown = _ref => {
|
|
|
496
494
|
}, [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]);
|
|
497
495
|
(0, _react.useEffect)(() => {
|
|
498
496
|
const setScrollTopValue = e => {
|
|
499
|
-
setScrollTop(parseInt(e.target.scrollTop));
|
|
497
|
+
setScrollTop(parseInt(e.target.scrollTop, 10));
|
|
500
498
|
};
|
|
501
499
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
502
500
|
var _dropdownListRef$curr7;
|
|
503
|
-
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener(
|
|
501
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
504
502
|
}
|
|
505
503
|
return () => {
|
|
506
504
|
var _dropdownListRef$curr8;
|
|
507
|
-
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener(
|
|
505
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
508
506
|
};
|
|
509
507
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
510
508
|
(0, _react.useEffect)(() => {
|
|
511
509
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
512
510
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
513
|
-
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)));
|
|
511
|
+
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));
|
|
514
512
|
}
|
|
515
513
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
516
514
|
(0, _react.useEffect)(() => {
|
|
@@ -530,8 +528,8 @@ const Dropdown = _ref => {
|
|
|
530
528
|
onKeyDown: onKeyDown,
|
|
531
529
|
onKeyUp: onKeyUp
|
|
532
530
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
533
|
-
"data-testid": "dropdown--".concat(testId ||
|
|
534
|
-
className: "".concat(RC, "__trigger input__wrap ").concat(isOpen ?
|
|
531
|
+
"data-testid": "dropdown--".concat(testId || "", "--container"),
|
|
532
|
+
className: "".concat(RC, "__trigger input__wrap ").concat(isOpen ? "input__wrap--focus" : "", " ").concat(!value ? "placeholder" : "", " ").concat(error ? "error" : ""),
|
|
535
533
|
onClick: toggleList,
|
|
536
534
|
onKeyDown: onKeyDown,
|
|
537
535
|
onKeyUp: onKeyUp,
|
|
@@ -539,7 +537,7 @@ const Dropdown = _ref => {
|
|
|
539
537
|
}, customTrigger || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isSearchable && !isMobile ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
540
538
|
ref: searchInputRef,
|
|
541
539
|
className: "".concat(RC, "__input"),
|
|
542
|
-
value: isOpen ? searchValue !== null && searchValue !== void 0 ? searchValue :
|
|
540
|
+
value: isOpen ? searchValue !== null && searchValue !== void 0 ? searchValue : "" : selectedLabel || "",
|
|
543
541
|
onChange: e => onSearchHandler(e.target.value),
|
|
544
542
|
placeholder: placeholder,
|
|
545
543
|
onFocus: () => setIsSearchInputFocused(true),
|