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