intelicoreact 1.4.81 → 1.4.83
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 +13 -13
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +12 -13
- package/dist/Atomic/FormElements/Calendar/Calendar.js +103 -68
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +26 -26
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +27 -23
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +201 -114
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +69 -46
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +301 -230
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +2 -4
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +201 -145
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +54 -41
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +112 -45
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +63 -34
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +153 -81
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +59 -57
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +98 -66
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +48 -27
- package/dist/Atomic/FormElements/Input/Input.js +209 -148
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +77 -50
- package/dist/Atomic/FormElements/InputColor/InputColor.js +28 -23
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +53 -38
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +139 -106
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +38 -31
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +230 -135
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +122 -85
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -10
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +159 -72
- package/dist/Atomic/FormElements/InputLink/InputLink.js +39 -30
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +8 -8
- package/dist/Atomic/FormElements/InputMask/InputMask.js +800 -521
- package/dist/Atomic/FormElements/InputMask/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +15 -15
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +294 -234
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +15 -15
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +332 -265
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask3/functions.js +15 -15
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +101 -53
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +99 -64
- package/dist/Atomic/FormElements/Label/Label.js +15 -13
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +284 -190
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +34 -24
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +170 -117
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +50 -28
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +29 -18
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +24 -22
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +31 -19
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +83 -56
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +75 -49
- package/dist/Atomic/FormElements/RangeList/RangeList.js +129 -87
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +18 -22
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +250 -143
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +477 -367
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +15 -14
- package/dist/Atomic/FormElements/Switcher/Switcher.js +20 -24
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +30 -24
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +23 -20
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +40 -32
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +31 -25
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +22 -22
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +98 -52
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +34 -22
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +81 -47
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +525 -415
- package/dist/Atomic/FormElements/Text/Text.js +39 -39
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +23 -21
- package/dist/Atomic/FormElements/Textarea/Textarea.js +33 -28
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +98 -67
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +24 -22
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +57 -34
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +94 -56
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +102 -74
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +69 -50
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +33 -30
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +50 -38
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +1 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +59 -47
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +1 -1
- package/dist/Atomic/Layout/Header/Header.js +37 -22
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +59 -34
- package/dist/Atomic/Layout/Spinner/Spinner.js +6 -7
- package/dist/Atomic/UI/Accordion/Accordion.js +31 -17
- package/dist/Atomic/UI/Accordion/AccordionItem.js +41 -30
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +81 -50
- package/dist/Atomic/UI/AccordionText/AccordionText.js +39 -20
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +74 -46
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +37 -21
- package/dist/Atomic/UI/Alert/Alert.js +36 -23
- package/dist/Atomic/UI/Arrow/Arrow.js +21 -14
- package/dist/Atomic/UI/Box/Box.js +12 -11
- package/dist/Atomic/UI/Button/Button.js +26 -26
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +21 -21
- package/dist/Atomic/UI/Chart/Chart.js +60 -44
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +13 -11
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +10 -12
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +82 -60
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +124 -116
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +30 -18
- package/dist/Atomic/UI/Chart/partial/utils.js +30 -16
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +31 -21
- package/dist/Atomic/UI/DateTime/DateTime.js +29 -25
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +23 -11
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +12 -4
- package/dist/Atomic/UI/DoubleString/DoubleString.js +53 -36
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +55 -14
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +114 -54
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +88 -53
- package/dist/Atomic/UI/Hint/Hint.js +87 -58
- package/dist/Atomic/UI/Hint/partials/_utils.js +10 -10
- package/dist/Atomic/UI/Modal/Modal.js +159 -144
- package/dist/Atomic/UI/Modal/ModalHOC.js +17 -14
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +5 -6
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +13 -16
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +118 -73
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +48 -33
- package/dist/Atomic/UI/NavLine/NavLine.js +166 -104
- package/dist/Atomic/UI/PageTitle/PageTitle.js +8 -12
- package/dist/Atomic/UI/PieChart/PieChart.js +11 -10
- package/dist/Atomic/UI/Price/Price.js +5 -7
- package/dist/Atomic/UI/PriceRange/PriceRange.js +4 -6
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +42 -27
- package/dist/Atomic/UI/Status/Status.js +22 -18
- package/dist/Atomic/UI/Table/Partials/TdCell.js +47 -28
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +5 -6
- package/dist/Atomic/UI/Table/Partials/TdRow.js +53 -29
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +28 -15
- package/dist/Atomic/UI/Table/Table.js +36 -27
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +32 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +10 -8
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +2 -4
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +26 -21
- package/dist/Atomic/UI/Tag/Tag.js +72 -52
- package/dist/Atomic/UI/TagList/TagList.js +102 -65
- package/dist/Atomic/UI/UserBox/UserBox.js +13 -13
- package/dist/Atomic/UI/WizardStepper/constructor.js +6 -6
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +16 -20
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +25 -27
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +27 -22
- package/dist/Atomic/UI/WizardStepper/ui/icons.js +41 -39
- package/dist/Classes/AbortableFetch.js +393 -311
- package/dist/Classes/AnimatedHandler.js +53 -45
- package/dist/Classes/RESTAPI/index.js +431 -152
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +400 -320
- package/dist/Classes/RESTAPI/partials/ApiBase.js +59 -24
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +338 -76
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +378 -143
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +375 -159
- package/dist/Classes/RESTAPI/partials/Utils.js +128 -87
- package/dist/Classes/RESTAPI/partials/_utils.js +388 -116
- package/dist/Constants/index.constants.js +7 -7
- package/dist/Functions/Portal.js +19 -11
- package/dist/Functions/customEventListener.js +7 -5
- package/dist/Functions/fieldValueFormatters.js +131 -109
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +128 -69
- package/dist/Functions/locale/createTranslator.js +21 -11
- package/dist/Functions/operations.js +27 -23
- package/dist/Functions/presets/inputMaskPreset.js +176 -0
- package/dist/Functions/presets/inputMaskPresets.js +17 -17
- package/dist/Functions/presets/inputPresets.js +15 -15
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +3 -3
- package/dist/Functions/schemas.js +7 -5
- package/dist/Functions/useBodyScrollLock.js +3 -3
- package/dist/Functions/useClickOutside.js +3 -3
- package/dist/Functions/useDebounce.js +20 -11
- package/dist/Functions/useFieldFocus.js +51 -38
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +46 -36
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +78 -68
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +81 -54
- package/dist/Functions/useFormTools/functions/General.js +80 -71
- package/dist/Functions/useFormTools/functions/RenderFields.js +63 -45
- package/dist/Functions/useFormTools/functions/usePrevious.js +2 -2
- package/dist/Functions/useFormTools/index.js +467 -314
- package/dist/Functions/useInputHighlightError.js +42 -26
- package/dist/Functions/useIsMobile.js +29 -11
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +8 -9
- package/dist/Functions/useKeyPress/useKeyPress.js +26 -17
- package/dist/Functions/useLocalStorage.js +13 -6
- package/dist/Functions/useLocationParams.js +24 -14
- package/dist/Functions/useMediaQuery.js +18 -7
- package/dist/Functions/useMetaInfo.js +40 -16
- package/dist/Functions/useMouseUpOutside.js +2 -2
- package/dist/Functions/useOnlineStatus.js +17 -6
- package/dist/Functions/usePasswordChecker.js +61 -42
- package/dist/Functions/usePrevious.js +2 -2
- package/dist/Functions/useResize.js +24 -12
- package/dist/Functions/useScrollTo.js +13 -4
- package/dist/Functions/useToggle.js +25 -9
- package/dist/Functions/utils.js +272 -147
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +27 -23
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +27 -23
- package/dist/Molecular/CustomIcons/components/AppStore.js +31 -27
- package/dist/Molecular/CustomIcons/components/Arrow.js +37 -33
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +19 -15
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +22 -18
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +22 -18
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +19 -15
- package/dist/Molecular/CustomIcons/components/Bell.js +17 -13
- package/dist/Molecular/CustomIcons/components/Button.js +17 -13
- package/dist/Molecular/CustomIcons/components/Campaigns.js +18 -14
- package/dist/Molecular/CustomIcons/components/Check.js +18 -14
- package/dist/Molecular/CustomIcons/components/Check2.js +17 -13
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +17 -13
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +17 -13
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +17 -13
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +17 -13
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +17 -13
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +32 -28
- package/dist/Molecular/CustomIcons/components/Close.js +19 -15
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +44 -40
- package/dist/Molecular/CustomIcons/components/Delete.js +18 -14
- package/dist/Molecular/CustomIcons/components/Edit.js +17 -13
- package/dist/Molecular/CustomIcons/components/Email.js +35 -31
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +25 -21
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +33 -29
- package/dist/Molecular/CustomIcons/components/Flows.js +17 -13
- package/dist/Molecular/CustomIcons/components/Gift.js +22 -18
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +31 -27
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +31 -27
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +20 -16
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +21 -17
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +20 -16
- package/dist/Molecular/CustomIcons/components/Home.js +20 -16
- package/dist/Molecular/CustomIcons/components/Home2.js +23 -19
- package/dist/Molecular/CustomIcons/components/Key.js +25 -21
- package/dist/Molecular/CustomIcons/components/Landers.js +21 -17
- package/dist/Molecular/CustomIcons/components/Lock.js +17 -13
- package/dist/Molecular/CustomIcons/components/Mail.js +25 -21
- package/dist/Molecular/CustomIcons/components/Mastercard.js +65 -61
- package/dist/Molecular/CustomIcons/components/Minus.js +30 -26
- package/dist/Molecular/CustomIcons/components/Offers.js +18 -14
- package/dist/Molecular/CustomIcons/components/Pause.js +30 -26
- package/dist/Molecular/CustomIcons/components/PayPal.js +44 -40
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +31 -27
- package/dist/Molecular/CustomIcons/components/Phone.js +32 -28
- package/dist/Molecular/CustomIcons/components/Play.js +30 -26
- package/dist/Molecular/CustomIcons/components/Plus.js +30 -26
- package/dist/Molecular/CustomIcons/components/Profile.js +22 -18
- package/dist/Molecular/CustomIcons/components/QRCode.js +32 -28
- package/dist/Molecular/CustomIcons/components/Rectangle.js +17 -13
- package/dist/Molecular/CustomIcons/components/Revert.js +20 -16
- package/dist/Molecular/CustomIcons/components/Star.js +14 -10
- package/dist/Molecular/CustomIcons/components/Star2.js +18 -14
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +20 -16
- package/dist/Molecular/CustomIcons/components/Trash.js +17 -13
- package/dist/Molecular/CustomIcons/components/TrashRed.js +17 -13
- package/dist/Molecular/CustomIcons/components/Triggers.js +17 -13
- package/dist/Molecular/CustomIcons/components/User.js +22 -18
- package/dist/Molecular/CustomIcons/components/Visa.js +33 -29
- package/dist/Molecular/CustomIcons/components/X.js +17 -13
- package/dist/Molecular/CustomIcons/index.js +61 -61
- package/dist/Molecular/FormElement/FormElement.js +17 -19
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +93 -73
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +27 -28
- package/dist/Molecular/InputAddress/InputAddress.js +213 -126
- package/dist/Molecular/InputPassword/InputPassword.js +23 -13
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -15,25 +15,28 @@ var _useHandleKeyPress = _interopRequireDefault(require("../../../Functions/useK
|
|
|
15
15
|
|
|
16
16
|
require("./Modal.scss");
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
var Modal = function Modal(_ref) {
|
|
19
|
+
var _ref$zIndex = _ref.zIndex,
|
|
20
|
+
zIndex = _ref$zIndex === void 0 ? 100 : _ref$zIndex,
|
|
21
|
+
isOpen = _ref.isOpen,
|
|
22
|
+
closeModal = _ref.closeModal,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
size = _ref.size,
|
|
26
|
+
testId = _ref.testId,
|
|
27
|
+
_ref$isScrollLock = _ref.isScrollLock,
|
|
28
|
+
isScrollLock = _ref$isScrollLock === void 0 ? true : _ref$isScrollLock,
|
|
29
|
+
_ref$closeOnEsc = _ref.closeOnEsc,
|
|
30
|
+
closeOnEsc = _ref$closeOnEsc === void 0 ? true : _ref$closeOnEsc;
|
|
30
31
|
if (!isOpen) return null;
|
|
31
32
|
(0, _useHandleKeyPress.default)({
|
|
32
|
-
escCallback: closeOnEsc && typeof closeModal === "function" ?
|
|
33
|
+
escCallback: closeOnEsc && typeof closeModal === "function" ? function () {
|
|
34
|
+
return closeModal === null || closeModal === void 0 ? void 0 : closeModal();
|
|
35
|
+
} : null
|
|
33
36
|
});
|
|
34
37
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
35
38
|
style: {
|
|
36
|
-
zIndex
|
|
39
|
+
zIndex: zIndex
|
|
37
40
|
},
|
|
38
41
|
"data-testid": testId,
|
|
39
42
|
className: "modal-box j5"
|
|
@@ -11,12 +11,11 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
14
|
+
var ModalFooter = function ModalFooter(_ref) {
|
|
15
|
+
var _ref$className = _ref.className,
|
|
16
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
17
|
+
children = _ref.children,
|
|
18
|
+
wrapperRef = _ref.wrapperRef;
|
|
20
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
21
20
|
ref: wrapperRef,
|
|
22
21
|
className: (0, _classnames.default)("modal__footer", className)
|
|
@@ -7,31 +7,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
15
|
|
|
14
16
|
var _reactFeather = require("react-feather");
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
18
|
+
var ModalTitle = function ModalTitle(_ref) {
|
|
19
|
+
var _ref$variant = _ref.variant,
|
|
20
|
+
variant = _ref$variant === void 0 ? "primary" : _ref$variant,
|
|
21
|
+
children = _ref.children,
|
|
22
|
+
isForced = _ref.isForced,
|
|
23
|
+
onClose = _ref.onClose,
|
|
24
|
+
noHeaderCloseBtn = _ref.noHeaderCloseBtn,
|
|
25
|
+
className = _ref.className,
|
|
26
|
+
wrapperRef = _ref.wrapperRef;
|
|
26
27
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
28
|
ref: wrapperRef,
|
|
28
|
-
className: (0, _classnames.default)("modal__header", className, {
|
|
29
|
-
["modal__header-".concat(variant)]: variant
|
|
30
|
-
})
|
|
29
|
+
className: (0, _classnames.default)("modal__header", className, (0, _defineProperty2.default)({}, "modal__header-".concat(variant), variant))
|
|
31
30
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
32
|
-
className: (0, _classnames.default)("modal__header-title", {
|
|
33
|
-
["modal__header-".concat(variant, "-title")]: variant
|
|
34
|
-
})
|
|
31
|
+
className: (0, _classnames.default)("modal__header-title", (0, _defineProperty2.default)({}, "modal__header-".concat(variant, "-title"), variant))
|
|
35
32
|
}, children), !isForced && /*#__PURE__*/_react.default.createElement("div", {
|
|
36
33
|
"data-testid": "modal--button-closeCross",
|
|
37
34
|
onClick: onClose,
|
|
@@ -2,20 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports.default = useMobileModal;
|
|
9
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
10
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
17
|
|
|
12
|
-
var
|
|
18
|
+
var _useIsMobile2 = _interopRequireDefault(require("../../../../Functions/useIsMobile"));
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
21
|
|
|
14
|
-
function
|
|
22
|
+
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; }
|
|
15
23
|
|
|
16
|
-
function
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
25
|
|
|
18
|
-
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
+
|
|
28
|
+
var SCROLL_DIRECTION = {
|
|
19
29
|
UP: "up",
|
|
20
30
|
DOWN: "down"
|
|
21
31
|
};
|
|
@@ -23,44 +33,77 @@ const SCROLL_DIRECTION = {
|
|
|
23
33
|
function useMobileModal(_ref) {
|
|
24
34
|
var _modalMobileHeaderRef5, _modalMobileHeaderRef6, _modalMobileFooterRef5, _modalMobileFooterRef6;
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
var _ref$modalRef = _ref.modalRef,
|
|
37
|
+
modalRef = _ref$modalRef === void 0 ? null : _ref$modalRef,
|
|
38
|
+
_ref$withMobileLogic = _ref.withMobileLogic,
|
|
39
|
+
withMobileLogic = _ref$withMobileLogic === void 0 ? false : _ref$withMobileLogic,
|
|
40
|
+
withFixedFooter = _ref.withFixedFooter,
|
|
41
|
+
isOpen = _ref.isOpen;
|
|
42
|
+
var modalMobileContainerRef = (0, _react.useRef)(null);
|
|
43
|
+
var modalMobileHeaderRef = (0, _react.useRef)(null);
|
|
44
|
+
var modalMobileFooterRef = (0, _react.useRef)(null);
|
|
45
|
+
var modalMobileBodyRef = (0, _react.useRef)(null);
|
|
46
|
+
|
|
47
|
+
var _useIsMobile = (0, _useIsMobile2.default)(),
|
|
48
|
+
isMobile = _useIsMobile.isMobile;
|
|
49
|
+
|
|
50
|
+
var _useState = (0, _react.useState)(0),
|
|
51
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
|
+
modalHeight = _useState2[0],
|
|
53
|
+
setModalHeight = _useState2[1];
|
|
54
|
+
|
|
55
|
+
var _useState3 = (0, _react.useState)({
|
|
41
56
|
IS_HEADER_HIDDEN: false,
|
|
42
57
|
IS_HEADER_STICKY: false,
|
|
43
58
|
IS_FOOTER_HIDDEN: false,
|
|
44
59
|
IS_FOOTER_STICKY: false
|
|
45
|
-
})
|
|
46
|
-
|
|
60
|
+
}),
|
|
61
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
62
|
+
modalsLogic = _useState4[0],
|
|
63
|
+
setModalsLogic = _useState4[1];
|
|
64
|
+
|
|
65
|
+
var _useState5 = (0, _react.useState)({
|
|
47
66
|
headerHeight: 0,
|
|
48
67
|
footerHeight: 0
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
}),
|
|
69
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
70
|
+
modalsLogicProps = _useState6[0],
|
|
71
|
+
setModalsLogicProps = _useState6[1];
|
|
72
|
+
|
|
73
|
+
var _useState7 = (0, _react.useState)(SCROLL_DIRECTION.UP),
|
|
74
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
75
|
+
scrollDirection = _useState8[0],
|
|
76
|
+
setScrollDirection = _useState8[1];
|
|
77
|
+
|
|
78
|
+
var _useState9 = (0, _react.useState)(0),
|
|
79
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
80
|
+
scrollTopPrev = _useState10[0],
|
|
81
|
+
setScrollTopPrev = _useState10[1];
|
|
82
|
+
|
|
83
|
+
var _useState11 = (0, _react.useState)(0),
|
|
84
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
85
|
+
scrollTop = _useState12[0],
|
|
86
|
+
setScrollTop = _useState12[1];
|
|
87
|
+
|
|
88
|
+
var _useState13 = (0, _react.useState)(1),
|
|
89
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
90
|
+
scrollHeight = _useState14[0],
|
|
91
|
+
setScrollHeight = _useState14[1];
|
|
92
|
+
|
|
93
|
+
var _useState15 = (0, _react.useState)(1),
|
|
94
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
95
|
+
containerScrollHeight = _useState16[0],
|
|
96
|
+
setContainerScrollHeight = _useState16[1];
|
|
55
97
|
/* MODALS LOGIC | BEGIN */
|
|
56
98
|
// Count ScrollTop
|
|
57
99
|
|
|
58
|
-
|
|
59
|
-
|
|
100
|
+
|
|
101
|
+
(0, _react.useLayoutEffect)(function () {
|
|
102
|
+
var el = modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current;
|
|
60
103
|
|
|
61
104
|
if (el) {
|
|
62
|
-
el.addEventListener("scroll", ()
|
|
63
|
-
setScrollTop(scrollTop
|
|
105
|
+
el.addEventListener("scroll", function () {
|
|
106
|
+
setScrollTop(function (scrollTop) {
|
|
64
107
|
if (scrollTop !== el.scrollTop) setScrollTopPrev(scrollTop);
|
|
65
108
|
return el.scrollTop;
|
|
66
109
|
});
|
|
@@ -68,15 +111,17 @@ function useMobileModal(_ref) {
|
|
|
68
111
|
}
|
|
69
112
|
}, [modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current]); // Count ScrollDirection
|
|
70
113
|
|
|
71
|
-
(0, _react.useEffect)(()
|
|
72
|
-
setScrollDirection(
|
|
114
|
+
(0, _react.useEffect)(function () {
|
|
115
|
+
setScrollDirection(function (prevScrollDirection) {
|
|
116
|
+
return scrollTop < scrollTopPrev ? SCROLL_DIRECTION.UP : scrollTop > scrollTopPrev ? SCROLL_DIRECTION.DOWN : prevScrollDirection;
|
|
117
|
+
});
|
|
73
118
|
}, [scrollTop, scrollTopPrev]); // Dynamic Modal Positioning
|
|
74
119
|
|
|
75
|
-
(0, _react.useLayoutEffect)(()
|
|
120
|
+
(0, _react.useLayoutEffect)(function () {
|
|
76
121
|
if (isOpen) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
122
|
+
var modalStyle = modalRef !== null && modalRef !== void 0 && modalRef.current ? (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current.currentStyle) || window.getComputedStyle(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) : {};
|
|
123
|
+
var computedModalHeight = modalRef !== null && modalRef !== void 0 && modalRef.current ? modalHeight + parseFloat((modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) || 0) : 0;
|
|
124
|
+
var windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
|
|
80
125
|
|
|
81
126
|
if (modalMobileContainerRef !== null && modalMobileContainerRef !== void 0 && modalMobileContainerRef.current) {
|
|
82
127
|
if (computedModalHeight <= windowHeight) {
|
|
@@ -92,58 +137,58 @@ function useMobileModal(_ref) {
|
|
|
92
137
|
}
|
|
93
138
|
}, [modalsLogicProps, isOpen, isMobile, modalHeight]); // Calculating
|
|
94
139
|
|
|
95
|
-
(0, _react.useLayoutEffect)(()
|
|
140
|
+
(0, _react.useLayoutEffect)(function () {
|
|
96
141
|
if (isMobile && isOpen) {
|
|
97
142
|
var _modalRef$current, _modalRef$current$get;
|
|
98
143
|
|
|
99
|
-
|
|
144
|
+
var newModalHeight = modalRef === null || modalRef === void 0 ? void 0 : (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : (_modalRef$current$get = _modalRef$current.getBoundingClientRect()) === null || _modalRef$current$get === void 0 ? void 0 : _modalRef$current$get.height;
|
|
100
145
|
|
|
101
146
|
if (modalHeight !== newModalHeight) {
|
|
102
147
|
setModalHeight(newModalHeight);
|
|
103
148
|
}
|
|
104
149
|
}
|
|
105
150
|
});
|
|
106
|
-
(0, _react.useEffect)(()
|
|
151
|
+
(0, _react.useEffect)(function () {
|
|
107
152
|
if (isMobile && withMobileLogic) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
})
|
|
153
|
+
var footerHeight = modalsLogicProps.footerHeight,
|
|
154
|
+
headerHeight = modalsLogicProps.headerHeight;
|
|
155
|
+
setModalsLogic(function (prevStickyLogic) {
|
|
156
|
+
return {
|
|
157
|
+
IS_HEADER_HIDDEN: scrollDirection === SCROLL_DIRECTION.DOWN || scrollTop === 0,
|
|
158
|
+
IS_HEADER_STICKY: scrollDirection === SCROLL_DIRECTION.UP && scrollTop !== 0 && (scrollTop >= headerHeight || prevStickyLogic.IS_HEADER_STICKY),
|
|
159
|
+
IS_FOOTER_HIDDEN: !withFixedFooter && (scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === Math.round(scrollTop)),
|
|
160
|
+
IS_FOOTER_STICKY: withFixedFooter && scrollHeight > 1 || scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - Math.round(scrollTop) >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
|
|
161
|
+
};
|
|
162
|
+
});
|
|
118
163
|
}
|
|
119
164
|
}, [scrollTop, scrollHeight, isMobile, withMobileLogic, scrollDirection, modalsLogicProps, modalHeight, window.innerHeight]);
|
|
120
|
-
(0, _react.useLayoutEffect)(()
|
|
165
|
+
(0, _react.useLayoutEffect)(function () {
|
|
121
166
|
var _modalMobileHeaderRef, _modalMobileHeaderRef2;
|
|
122
167
|
|
|
123
168
|
if ((modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef2 = _modalMobileHeaderRef.getBoundingClientRect()) === null || _modalMobileHeaderRef2 === void 0 ? void 0 : _modalMobileHeaderRef2.height) !== undefined) {
|
|
124
|
-
setModalsLogicProps(state
|
|
169
|
+
setModalsLogicProps(function (state) {
|
|
125
170
|
var _modalMobileHeaderRef3, _modalMobileHeaderRef4;
|
|
126
171
|
|
|
127
|
-
return {
|
|
172
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
128
173
|
headerHeight: modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef3 = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef3 === void 0 ? void 0 : (_modalMobileHeaderRef4 = _modalMobileHeaderRef3.getBoundingClientRect()) === null || _modalMobileHeaderRef4 === void 0 ? void 0 : _modalMobileHeaderRef4.height
|
|
129
|
-
};
|
|
174
|
+
});
|
|
130
175
|
});
|
|
131
176
|
}
|
|
132
177
|
}, [modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef5 = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef5 === void 0 ? void 0 : (_modalMobileHeaderRef6 = _modalMobileHeaderRef5.getBoundingClientRect()) === null || _modalMobileHeaderRef6 === void 0 ? void 0 : _modalMobileHeaderRef6.height]);
|
|
133
|
-
(0, _react.useLayoutEffect)(()
|
|
178
|
+
(0, _react.useLayoutEffect)(function () {
|
|
134
179
|
var _modalMobileFooterRef, _modalMobileFooterRef2;
|
|
135
180
|
|
|
136
181
|
if ((modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef = modalMobileFooterRef.current) === null || _modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef2 = _modalMobileFooterRef.getBoundingClientRect()) === null || _modalMobileFooterRef2 === void 0 ? void 0 : _modalMobileFooterRef2.height) !== undefined) {
|
|
137
|
-
setModalsLogicProps(state
|
|
182
|
+
setModalsLogicProps(function (state) {
|
|
138
183
|
var _modalMobileFooterRef3, _modalMobileFooterRef4;
|
|
139
184
|
|
|
140
|
-
return {
|
|
185
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
141
186
|
footerHeight: modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef3 = modalMobileFooterRef.current) === null || _modalMobileFooterRef3 === void 0 ? void 0 : (_modalMobileFooterRef4 = _modalMobileFooterRef3.getBoundingClientRect()) === null || _modalMobileFooterRef4 === void 0 ? void 0 : _modalMobileFooterRef4.height
|
|
142
|
-
};
|
|
187
|
+
});
|
|
143
188
|
});
|
|
144
189
|
}
|
|
145
190
|
}, [modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef5 = modalMobileFooterRef.current) === null || _modalMobileFooterRef5 === void 0 ? void 0 : (_modalMobileFooterRef6 = _modalMobileFooterRef5.getBoundingClientRect()) === null || _modalMobileFooterRef6 === void 0 ? void 0 : _modalMobileFooterRef6.height]);
|
|
146
|
-
(0, _react.useEffect)(()
|
|
191
|
+
(0, _react.useEffect)(function () {
|
|
147
192
|
if (modalMobileContainerRef !== null && modalMobileContainerRef !== void 0 && modalMobileContainerRef.current) {
|
|
148
193
|
var _modalMobileContainer5, _modalMobileContainer6;
|
|
149
194
|
|
|
@@ -152,9 +197,9 @@ function useMobileModal(_ref) {
|
|
|
152
197
|
setScrollHeight((modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : (_modalMobileContainer6 = modalMobileContainerRef.current) === null || _modalMobileContainer6 === void 0 ? void 0 : _modalMobileContainer6.scrollHeight) - window.innerHeight);
|
|
153
198
|
}
|
|
154
199
|
}, [scrollTop, modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current, window.innerHeight]);
|
|
155
|
-
(0, _react.useEffect)(()
|
|
156
|
-
window.addEventListener("resize", ()
|
|
157
|
-
setContainerScrollHeight(containerScrollHeight
|
|
200
|
+
(0, _react.useEffect)(function () {
|
|
201
|
+
window.addEventListener("resize", function () {
|
|
202
|
+
setContainerScrollHeight(function (containerScrollHeight) {
|
|
158
203
|
setScrollHeight(containerScrollHeight - window.innerHeight);
|
|
159
204
|
return containerScrollHeight;
|
|
160
205
|
});
|
|
@@ -162,27 +207,27 @@ function useMobileModal(_ref) {
|
|
|
162
207
|
}, []);
|
|
163
208
|
/* MODALS LOGIC | END */
|
|
164
209
|
|
|
165
|
-
|
|
210
|
+
var renderMobileModal = function renderMobileModal(modal) {
|
|
166
211
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
167
212
|
className: "modal-mobile-container",
|
|
168
213
|
ref: modalMobileContainerRef
|
|
169
214
|
}, modal);
|
|
170
215
|
};
|
|
171
216
|
|
|
172
|
-
|
|
217
|
+
var renderModal = function renderModal(modal) {
|
|
173
218
|
return isMobile && withMobileLogic ? renderMobileModal(modal) : modal;
|
|
174
219
|
};
|
|
175
220
|
|
|
176
221
|
return {
|
|
177
|
-
modalMobileContainerRef,
|
|
178
|
-
modalMobileHeaderRef,
|
|
179
|
-
modalMobileBodyRef,
|
|
180
|
-
modalMobileFooterRef,
|
|
222
|
+
modalMobileContainerRef: modalMobileContainerRef,
|
|
223
|
+
modalMobileHeaderRef: modalMobileHeaderRef,
|
|
224
|
+
modalMobileBodyRef: modalMobileBodyRef,
|
|
225
|
+
modalMobileFooterRef: modalMobileFooterRef,
|
|
181
226
|
MODALS_LOGIC: modalsLogic,
|
|
182
|
-
SCROLL_DIRECTION,
|
|
183
|
-
scrollTop,
|
|
184
|
-
scrollHeight,
|
|
185
|
-
renderModal,
|
|
186
|
-
isMobile
|
|
227
|
+
SCROLL_DIRECTION: SCROLL_DIRECTION,
|
|
228
|
+
scrollTop: scrollTop,
|
|
229
|
+
scrollHeight: scrollHeight,
|
|
230
|
+
renderModal: renderModal,
|
|
231
|
+
isMobile: isMobile
|
|
187
232
|
};
|
|
188
233
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -9,58 +11,71 @@ exports.default = void 0;
|
|
|
9
11
|
|
|
10
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
13
|
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
12
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
19
|
|
|
14
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
21
|
|
|
16
22
|
require("./MonoAccordion.scss");
|
|
17
23
|
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
var RC = "mono-accordion";
|
|
29
|
+
|
|
30
|
+
var MonoAccordion = function MonoAccordion(_ref) {
|
|
31
|
+
var _cn;
|
|
32
|
+
|
|
33
|
+
var titleJSX = _ref.titleJSX,
|
|
34
|
+
icon = _ref.icon,
|
|
35
|
+
children = _ref.children,
|
|
36
|
+
isOpen = _ref.isOpen,
|
|
37
|
+
onClick = _ref.onClick,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
disabled = _ref.disabled,
|
|
40
|
+
testId = _ref.testId,
|
|
41
|
+
_ref$datasetProp = _ref.datasetProp,
|
|
42
|
+
datasetProp = _ref$datasetProp === void 0 ? {} : _ref$datasetProp;
|
|
43
|
+
|
|
44
|
+
var _useState = (0, _react.useState)(),
|
|
45
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
|
+
maxHeight = _useState2[0],
|
|
47
|
+
setMaxHeight = _useState2[1];
|
|
48
|
+
|
|
49
|
+
var titleRef = (0, _react.useRef)();
|
|
50
|
+
var containerRef = (0, _react.useRef)();
|
|
51
|
+
|
|
52
|
+
var setHeight = function setHeight(value) {
|
|
53
|
+
if (value !== undefined) setMaxHeight(function (state) {
|
|
54
|
+
return "".concat(value, "px");
|
|
55
|
+
});else setMaxHeight(function (state) {
|
|
42
56
|
var _Array$from, _Array$from$reduce, _containerRef$current;
|
|
43
57
|
|
|
44
|
-
return "".concat((_Array$from = Array.from((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.childNodes)) === null || _Array$from === void 0 ? void 0 : (_Array$from$reduce = _Array$from.reduce) === null || _Array$from$reduce === void 0 ? void 0 : _Array$from$reduce.call(_Array$from, (acc, el)
|
|
58
|
+
return "".concat((_Array$from = Array.from((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.childNodes)) === null || _Array$from === void 0 ? void 0 : (_Array$from$reduce = _Array$from.reduce) === null || _Array$from$reduce === void 0 ? void 0 : _Array$from$reduce.call(_Array$from, function (acc, el) {
|
|
59
|
+
return acc + el.offsetHeight;
|
|
60
|
+
}, 0), "px");
|
|
45
61
|
});
|
|
46
62
|
};
|
|
47
63
|
|
|
48
|
-
|
|
49
|
-
if (!Array.from(titleRef.current.childNodes).some(
|
|
64
|
+
var handleClick = function handleClick(e) {
|
|
65
|
+
if (!Array.from(titleRef.current.childNodes).some(function (el) {
|
|
66
|
+
return el.contains(e.target);
|
|
67
|
+
})) {
|
|
50
68
|
onClick(e);
|
|
51
69
|
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
52
70
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
53
71
|
} else return e;
|
|
54
72
|
};
|
|
55
73
|
|
|
56
|
-
(0, _react.useEffect)(()
|
|
74
|
+
(0, _react.useEffect)(function () {
|
|
57
75
|
if (!isOpen) setHeight(0);else setHeight();
|
|
58
76
|
}, [isOpen, children]);
|
|
59
77
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, datasetProp, {
|
|
60
|
-
className: (0, _classnames.default)(RC, className, {
|
|
61
|
-
["".concat(RC, "_is-open")]: isOpen,
|
|
62
|
-
["".concat(RC, "_disabled")]: disabled
|
|
63
|
-
})
|
|
78
|
+
className: (0, _classnames.default)(RC, className, (_cn = {}, (0, _defineProperty2.default)(_cn, "".concat(RC, "_is-open"), isOpen), (0, _defineProperty2.default)(_cn, "".concat(RC, "_disabled"), disabled), _cn))
|
|
64
79
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
65
80
|
"data-testid": "accordionHeader--key-".concat(testId, "--clickable"),
|
|
66
81
|
className: "".concat(RC, "__head"),
|
|
@@ -73,7 +88,7 @@ const MonoAccordion = _ref => {
|
|
|
73
88
|
}, icon)), /*#__PURE__*/_react.default.createElement("div", {
|
|
74
89
|
ref: containerRef,
|
|
75
90
|
style: {
|
|
76
|
-
maxHeight
|
|
91
|
+
maxHeight: maxHeight
|
|
77
92
|
},
|
|
78
93
|
className: (0, _classnames.default)("".concat(RC, "__container"))
|
|
79
94
|
}, /*#__PURE__*/_react.default.createElement("div", {
|