intelicoreact 1.6.2 → 1.6.4
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/ArrayElement.d.ts +13 -0
- package/dist/AsyncReturnType.d.ts +17 -0
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.interface.js +4 -1
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +69 -14
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.stories.js +30 -7
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.test.js +43 -34
- package/dist/Atomic/FormElements/ActionAlert/index.js +17 -2
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.interface.js +4 -1
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +26 -11
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.stories.js +35 -12
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.test.js +29 -20
- package/dist/Atomic/FormElements/AdvancedStatus/index.js +17 -2
- package/dist/Atomic/FormElements/Calendar/Calendar.js +109 -53
- package/dist/Atomic/FormElements/Calendar/Calendar.props.js +4 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.stories.js +74 -10
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.interface.js +4 -1
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +27 -12
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +39 -16
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.test.js +46 -37
- package/dist/Atomic/FormElements/CheckboxInput/index.js +17 -2
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.interface.js +4 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +24 -9
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.stories.js +33 -10
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.test.js +34 -25
- package/dist/Atomic/FormElements/CheckboxesLine/index.js +17 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +160 -104
- package/dist/Atomic/FormElements/Datepicker/Datepicker.stories.js +31 -8
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +89 -33
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +154 -98
- package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +82 -18
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +25 -10
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +138 -82
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.stories.js +79 -15
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +69 -13
- package/dist/Atomic/FormElements/FileLoader/FileLoader.stories.js +86 -22
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +69 -13
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +71 -15
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +91 -35
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.stories.js +82 -18
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +40 -25
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.stories.js +79 -15
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +78 -22
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.stories.js +33 -10
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +73 -17
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.stories.js +73 -9
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +75 -19
- package/dist/Atomic/FormElements/Input/Input.js +100 -45
- package/dist/Atomic/FormElements/Input/Input.stories.js +73 -9
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +85 -29
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +78 -14
- package/dist/Atomic/FormElements/InputColor/InputColor.js +30 -15
- package/dist/Atomic/FormElements/InputColor/InputColor.stories.js +73 -9
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.interface.js +4 -1
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +73 -17
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.stories.js +52 -14
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.test.js +45 -36
- package/dist/Atomic/FormElements/InputCurrency/index.js +16 -1
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +128 -72
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +75 -11
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +30 -15
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +182 -126
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +98 -42
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +24 -9
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +144 -53
- package/dist/Atomic/FormElements/InputLink/InputLink.js +76 -20
- package/dist/Atomic/FormElements/InputLink/InputLink.stories.js +73 -9
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +20 -2
- package/dist/Atomic/FormElements/InputMask/InputMask.js +158 -103
- package/dist/Atomic/FormElements/InputMask/InputMask.stories.js +81 -17
- package/dist/Atomic/FormElements/InputMask/config.js +1 -0
- package/dist/Atomic/FormElements/InputMask/functions.js +59 -14
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +129 -73
- package/dist/Atomic/FormElements/InputMask2/InputMask2.stories.js +77 -13
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -0
- package/dist/Atomic/FormElements/InputMask2/functions.js +59 -14
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +133 -77
- package/dist/Atomic/FormElements/InputMask3/InputMask3.stories.js +79 -15
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -0
- package/dist/Atomic/FormElements/InputMask3/functions.js +59 -14
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +79 -23
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.stories.js +72 -8
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +81 -25
- package/dist/Atomic/FormElements/InputsRow/InputsRow.stories.js +31 -8
- package/dist/Atomic/FormElements/Label/Label.interface.js +4 -1
- package/dist/Atomic/FormElements/Label/Label.js +31 -16
- package/dist/Atomic/FormElements/Label/Label.stories.js +30 -7
- package/dist/Atomic/FormElements/Label/Label.test.js +46 -37
- package/dist/Atomic/FormElements/Label/index.js +17 -2
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +124 -68
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js +74 -10
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +67 -11
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.stories.js +73 -9
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +105 -49
- package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +75 -11
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +67 -11
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.stories.js +31 -8
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +33 -18
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.stories.js +73 -9
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +27 -12
- package/dist/Atomic/FormElements/RadioInput/RadioInput.stories.js +31 -8
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +25 -10
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.stories.js +73 -9
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +92 -36
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.stories.js +85 -21
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +81 -25
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.stories.js +74 -10
- package/dist/Atomic/FormElements/RangeList/RangeList.js +89 -34
- package/dist/Atomic/FormElements/RangeList/RangeList.stories.js +81 -14
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +37 -14
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +120 -64
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.stories.js +102 -38
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +137 -81
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.stories.js +82 -18
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +26 -11
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.stories.js +85 -21
- package/dist/Atomic/FormElements/Switcher/Switcher.js +31 -16
- package/dist/Atomic/FormElements/Switcher/Switcher.stories.js +74 -10
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +26 -11
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.stories.js +75 -11
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +24 -9
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.stories.js +75 -11
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +68 -13
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.stories.js +74 -10
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +64 -8
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.stories.js +75 -11
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +26 -11
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.stories.js +76 -12
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +81 -25
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.stories.js +78 -14
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +11 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +30 -15
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.stories.js +76 -12
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +70 -14
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.stories.js +73 -9
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +208 -152
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.stories.js +80 -16
- package/dist/Atomic/FormElements/Text/Text.js +25 -10
- package/dist/Atomic/FormElements/Text/Text.stories.js +30 -7
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +27 -12
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.stories.js +74 -10
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.test.js +26 -17
- package/dist/Atomic/FormElements/Textarea/Textarea.js +69 -13
- package/dist/Atomic/FormElements/Textarea/Textarea.stories.js +75 -11
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +77 -22
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.stories.js +76 -12
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +27 -12
- package/dist/Atomic/FormElements/TimeRange/TimeRange.interface.js +4 -1
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +79 -23
- package/dist/Atomic/FormElements/TimeRange/TimeRange.stories.js +30 -7
- package/dist/Atomic/FormElements/TimeRange/TimeRange.test.js +59 -50
- package/dist/Atomic/FormElements/TimeRange/index.js +17 -2
- package/dist/Atomic/FormElements/UserContacts/UserContact.test.js +77 -68
- package/dist/Atomic/FormElements/UserContacts/UserContacts.interface.js +4 -1
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +79 -23
- package/dist/Atomic/FormElements/UserContacts/UserContacts.stories.js +31 -8
- package/dist/Atomic/FormElements/UserContacts/index.js +17 -2
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +71 -15
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.stories.js +78 -14
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +39 -24
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +45 -30
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.stories.js +81 -17
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +11 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +45 -30
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.stories.js +82 -18
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +11 -1
- package/dist/Atomic/Layout/Header/Header.js +83 -27
- package/dist/Atomic/Layout/Header/Header.stories.js +31 -8
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +107 -51
- package/dist/Atomic/Layout/MainMenu/MainMenu.stories.js +31 -8
- package/dist/Atomic/Layout/Spinner/Spinner.interface.js +4 -1
- package/dist/Atomic/Layout/Spinner/Spinner.js +28 -13
- package/dist/Atomic/Layout/Spinner/Spinner.stories.js +30 -7
- package/dist/Atomic/Layout/Spinner/Spinner.test.js +22 -13
- package/dist/Atomic/Layout/Spinner/index.js +17 -2
- package/dist/Atomic/UI/Accordion/Accordion.interface.js +4 -1
- package/dist/Atomic/UI/Accordion/Accordion.js +77 -21
- package/dist/Atomic/UI/Accordion/Accordion.stories.js +36 -10
- package/dist/Atomic/UI/Accordion/Accordion.test.js +18 -9
- package/dist/Atomic/UI/Accordion/AccordionItem.js +84 -28
- package/dist/Atomic/UI/Accordion/AccordionItem.test.js +18 -9
- package/dist/Atomic/UI/Accordion/index.js +17 -2
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +99 -43
- package/dist/Atomic/UI/AccordionTable/AccordionTable.stories.js +80 -16
- package/dist/Atomic/UI/AccordionText/AccordionText.js +73 -18
- package/dist/Atomic/UI/AccordionText/AccordionText.stories.js +59 -36
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +94 -38
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +70 -14
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.stories.js +31 -8
- package/dist/Atomic/UI/Alert/Alert.js +78 -22
- package/dist/Atomic/UI/Alert/Alert.stories.js +38 -12
- package/dist/Atomic/UI/Arrow/Arrow.js +78 -22
- package/dist/Atomic/UI/Arrow/Arrow.stories.js +31 -8
- package/dist/Atomic/UI/Box/Box.js +22 -8
- package/dist/Atomic/UI/Box/Box.stories.js +41 -18
- package/dist/Atomic/UI/Button/Button.js +24 -9
- package/dist/Atomic/UI/Button/Button.stories.js +32 -9
- package/dist/Atomic/UI/Button/Button.test.js +51 -42
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +30 -15
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.stories.js +35 -13
- package/dist/Atomic/UI/Chart/Chart.js +105 -49
- package/dist/Atomic/UI/Chart/Chart.stories.js +31 -8
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +44 -8
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +30 -15
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -9
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +41 -16
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +24 -3
- package/dist/Atomic/UI/Chart/partial/utils.js +45 -13
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +76 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.stories.js +32 -9
- package/dist/Atomic/UI/DateTime/DateTime.js +70 -14
- package/dist/Atomic/UI/DateTime/DateTime.stories.js +32 -9
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +65 -14
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +62 -6
- package/dist/Atomic/UI/DoubleString/DoubleString.js +85 -29
- package/dist/Atomic/UI/DoubleString/DoubleString.stories.js +39 -13
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.interface.js +4 -1
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +58 -7
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.stories.js +72 -8
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.test.js +24 -15
- package/dist/Atomic/UI/DynamicIcon/index.js +17 -2
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +101 -46
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.stories.js +72 -8
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +41 -12
- package/dist/Atomic/UI/Hint/Hint.interface.js +4 -1
- package/dist/Atomic/UI/Hint/Hint.js +93 -37
- package/dist/Atomic/UI/Hint/Hint.stories.js +38 -15
- package/dist/Atomic/UI/Hint/Hint.test.js +13 -4
- package/dist/Atomic/UI/Hint/index.js +17 -2
- package/dist/Atomic/UI/Hint/partials/_utils.js +36 -11
- package/dist/Atomic/UI/Modal/Modal.interface.js +4 -1
- package/dist/Atomic/UI/Modal/Modal.js +61 -35
- package/dist/Atomic/UI/Modal/Modal.stories.js +85 -38
- package/dist/Atomic/UI/Modal/ModalHOC.js +68 -12
- package/dist/Atomic/UI/Modal/ModalHOC.stories.js +59 -27
- package/dist/Atomic/UI/Modal/ModalHOC.test.js +47 -38
- package/dist/Atomic/UI/Modal/index.js +26 -4
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +63 -7
- package/dist/Atomic/UI/Modal/partials/ModalFooter.test.js +40 -31
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +71 -15
- package/dist/Atomic/UI/Modal/partials/ModalTitle.test.js +39 -30
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +34 -19
- package/dist/Atomic/UI/Modal/partials/useMobileModal.test.js +28 -19
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +34 -25
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.interface.js +4 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +73 -17
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.stories.js +184 -101
- package/dist/Atomic/UI/MonoAccordion/index.js +17 -2
- package/dist/Atomic/UI/NavLine/NavLine.interface.js +4 -1
- package/dist/Atomic/UI/NavLine/NavLine.js +102 -46
- package/dist/Atomic/UI/NavLine/NavLine.stories.js +116 -32
- package/dist/Atomic/UI/NavLine/NavLine.test.js +53 -44
- package/dist/Atomic/UI/NavLine/index.js +17 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.interface.js +4 -1
- package/dist/Atomic/UI/PageTitle/PageTitle.js +34 -19
- package/dist/Atomic/UI/PageTitle/PageTitle.stories.js +33 -10
- package/dist/Atomic/UI/PageTitle/PageTitle.test.js +51 -42
- package/dist/Atomic/UI/PageTitle/index.js +17 -2
- package/dist/Atomic/UI/PieChart/PieChart.js +35 -66
- package/dist/Atomic/UI/PieChart/PieChart.scss +11 -87
- package/dist/Atomic/UI/PieChart/PieChart.stories.js +81 -56
- package/dist/Atomic/UI/Price/Price.interface.js +4 -1
- package/dist/Atomic/UI/Price/Price.js +24 -9
- package/dist/Atomic/UI/Price/Price.stories.js +30 -7
- package/dist/Atomic/UI/Price/Price.test.js +21 -12
- package/dist/Atomic/UI/Price/index.js +17 -2
- package/dist/Atomic/UI/PriceRange/PriceRange.interface.js +4 -1
- package/dist/Atomic/UI/PriceRange/PriceRange.js +26 -11
- package/dist/Atomic/UI/PriceRange/PriceRange.stories.js +30 -7
- package/dist/Atomic/UI/PriceRange/PriceRange.test.js +18 -9
- package/dist/Atomic/UI/PriceRange/index.js +17 -2
- package/dist/Atomic/UI/ProgressLine/ProgressLine.interface.js +4 -1
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +32 -17
- package/dist/Atomic/UI/ProgressLine/ProgressLine.stories.js +30 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.test.js +18 -9
- package/dist/Atomic/UI/ProgressLine/index.js +17 -2
- package/dist/Atomic/UI/Status/Status.interface.js +4 -1
- package/dist/Atomic/UI/Status/Status.js +31 -16
- package/dist/Atomic/UI/Status/Status.stories.js +34 -8
- package/dist/Atomic/UI/Status/Status.test.js +32 -23
- package/dist/Atomic/UI/Status/index.js +17 -2
- package/dist/Atomic/UI/Table/Partials/TdCell.js +79 -23
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +32 -17
- package/dist/Atomic/UI/Table/Partials/TdRow.js +81 -25
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +75 -19
- package/dist/Atomic/UI/Table/Table.js +32 -17
- package/dist/Atomic/UI/Table/Table.stories.js +73 -9
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +74 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +28 -13
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +16 -6
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +32 -17
- package/dist/Atomic/UI/Tag/Tag.interface.js +4 -1
- package/dist/Atomic/UI/Tag/Tag.js +80 -24
- package/dist/Atomic/UI/Tag/Tag.stories.js +38 -15
- package/dist/Atomic/UI/Tag/Tag.test.js +30 -21
- package/dist/Atomic/UI/Tag/index.js +17 -2
- package/dist/Atomic/UI/TagList/TagList.js +84 -28
- package/dist/Atomic/UI/TagList/TagList.stories.js +80 -16
- package/dist/Atomic/UI/UserBox/UserBox.interface.js +4 -1
- package/dist/Atomic/UI/UserBox/UserBox.js +37 -22
- package/dist/Atomic/UI/UserBox/UserBox.stories.js +30 -7
- package/dist/Atomic/UI/UserBox/UserBox.test.js +74 -24
- package/dist/Atomic/UI/UserBox/index.js +17 -2
- package/dist/Atomic/UI/WizardStepper/WizardStepper.stories.js +34 -11
- package/dist/Atomic/UI/WizardStepper/constructor.js +34 -11
- package/dist/Atomic/UI/WizardStepper/index.js +17 -2
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +31 -16
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +12 -2
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +39 -25
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +17 -2
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +34 -19
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +17 -2
- package/dist/Atomic/UI/WizardStepper/ui/icons.js +39 -24
- package/dist/Atomic/UI/WizardStepper/ui/index.js +17 -2
- package/dist/Classes/AbortableFetch.js +12 -2
- package/dist/Classes/AnimatedHandler.js +11 -1
- package/dist/Classes/RESTAPI/index.js +24 -9
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +12 -2
- package/dist/Classes/RESTAPI/partials/ApiBase.js +18 -3
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +25 -10
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +22 -7
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +20 -5
- package/dist/Classes/RESTAPI/partials/Utils.js +14 -4
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +18 -3
- package/dist/Classes/RESTAPI/partials/_utils.js +43 -10
- package/dist/Constants/index.constants.js +40 -7
- package/dist/DeepPartial.d.ts +40 -0
- package/dist/DeepReadonly.d.ts +38 -0
- package/dist/DeepRequired.d.ts +50 -0
- package/dist/Flatten.d.ts +34 -0
- package/dist/FunctionType.d.ts +37 -0
- package/dist/Functions/Portal.js +62 -6
- package/dist/Functions/customEventListener.js +1 -0
- package/dist/Functions/dateTime.js +31 -21
- package/dist/Functions/fieldValueFormatters.js +79 -61
- package/dist/Functions/guards/assertions.js +19 -4
- package/dist/Functions/guards/safeValue.js +21 -6
- package/dist/Functions/guards/typeGuards.js +12 -2
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +55 -4
- package/dist/Functions/locale/createTranslator.js +13 -3
- package/dist/Functions/operations.js +11 -1
- package/dist/Functions/presets/inputMaskPresets.js +12 -2
- package/dist/Functions/presets/inputPresets.js +14 -4
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +24 -32
- package/dist/Functions/schemas.js +77 -15
- package/dist/Functions/useBodyScrollLock.js +13 -3
- package/dist/Functions/useClickOutside.js +13 -3
- package/dist/Functions/useDebounce.js +55 -4
- package/dist/Functions/useFieldFocus.js +17 -7
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +18 -3
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +11 -1
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +18 -3
- package/dist/Functions/useFormTools/functions/General.js +11 -1
- package/dist/Functions/useFormTools/functions/RenderFields.js +16 -6
- package/dist/Functions/useFormTools/functions/usePrevious.js +14 -4
- package/dist/Functions/useFormTools/index.js +50 -35
- package/dist/Functions/useInputHighlightError.js +68 -9
- package/dist/Functions/useIsMobile/index.js +17 -2
- package/dist/Functions/useIsMobile/useIsMobile.js +14 -4
- package/dist/Functions/useIsMobile/useIsMobile.test.js +18 -9
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +21 -6
- package/dist/Functions/useKeyPress/useHandleKeyPress.test.js +20 -11
- package/dist/Functions/useKeyPress/useKeyPress.js +16 -6
- package/dist/Functions/useKeyPress/useKeyPress.test.js +25 -16
- package/dist/Functions/useLocalStorage.js +13 -3
- package/dist/Functions/useLocationParams.js +14 -4
- package/dist/Functions/useMediaQuery.js +13 -3
- package/dist/Functions/useMetaInfo.js +27 -9
- package/dist/Functions/useMouseUpOutside.js +13 -3
- package/dist/Functions/useOnlineStatus.js +14 -4
- package/dist/Functions/usePasswordChecker.js +69 -13
- package/dist/Functions/usePrevious.js +14 -4
- package/dist/Functions/useResize.js +15 -5
- package/dist/Functions/useScrollTo.js +15 -5
- package/dist/Functions/useToggle.js +16 -6
- package/dist/Functions/utils.js +173 -67
- package/dist/If.d.ts +34 -0
- package/dist/KeysType.d.ts +10 -0
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +57 -6
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +57 -6
- package/dist/Molecular/CustomIcons/components/AppStore.js +59 -8
- package/dist/Molecular/CustomIcons/components/Arrow.js +62 -11
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +55 -4
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +56 -5
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +56 -5
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +55 -4
- package/dist/Molecular/CustomIcons/components/Bell.js +55 -4
- package/dist/Molecular/CustomIcons/components/Button.js +55 -4
- package/dist/Molecular/CustomIcons/components/Campaigns.js +55 -4
- package/dist/Molecular/CustomIcons/components/Check.js +55 -4
- package/dist/Molecular/CustomIcons/components/Check2.js +55 -4
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +55 -4
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +55 -4
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +55 -4
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +55 -4
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +55 -4
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +58 -7
- package/dist/Molecular/CustomIcons/components/Close.js +56 -5
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +60 -9
- package/dist/Molecular/CustomIcons/components/Delete.js +55 -4
- package/dist/Molecular/CustomIcons/components/Edit.js +55 -4
- package/dist/Molecular/CustomIcons/components/Email.js +59 -8
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +60 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +59 -8
- package/dist/Molecular/CustomIcons/components/Flows.js +55 -4
- package/dist/Molecular/CustomIcons/components/Gift.js +56 -5
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +59 -8
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +59 -8
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +56 -5
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +56 -5
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +56 -5
- package/dist/Molecular/CustomIcons/components/Home.js +56 -5
- package/dist/Molecular/CustomIcons/components/Home2.js +56 -5
- package/dist/Molecular/CustomIcons/components/Key.js +55 -4
- package/dist/Molecular/CustomIcons/components/Landers.js +56 -5
- package/dist/Molecular/CustomIcons/components/Lock.js +55 -4
- package/dist/Molecular/CustomIcons/components/Mail.js +57 -6
- package/dist/Molecular/CustomIcons/components/Mastercard.js +67 -16
- package/dist/Molecular/CustomIcons/components/Minus.js +58 -7
- package/dist/Molecular/CustomIcons/components/Offers.js +55 -4
- package/dist/Molecular/CustomIcons/components/Pause.js +58 -7
- package/dist/Molecular/CustomIcons/components/PayPal.js +61 -10
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +59 -8
- package/dist/Molecular/CustomIcons/components/Phone.js +58 -7
- package/dist/Molecular/CustomIcons/components/Play.js +58 -7
- package/dist/Molecular/CustomIcons/components/Plus.js +58 -7
- package/dist/Molecular/CustomIcons/components/Profile.js +56 -5
- package/dist/Molecular/CustomIcons/components/QRCode.js +59 -8
- package/dist/Molecular/CustomIcons/components/Rectangle.js +55 -4
- package/dist/Molecular/CustomIcons/components/Revert.js +56 -5
- package/dist/Molecular/CustomIcons/components/Star.js +55 -4
- package/dist/Molecular/CustomIcons/components/Star2.js +55 -4
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +57 -6
- package/dist/Molecular/CustomIcons/components/Trash.js +55 -4
- package/dist/Molecular/CustomIcons/components/TrashRed.js +55 -4
- package/dist/Molecular/CustomIcons/components/Triggers.js +55 -4
- package/dist/Molecular/CustomIcons/components/User.js +56 -5
- package/dist/Molecular/CustomIcons/components/Visa.js +61 -10
- package/dist/Molecular/CustomIcons/components/X.js +55 -4
- package/dist/Molecular/CustomIcons/index.js +78 -61
- package/dist/Molecular/FormElement/FormElement.js +28 -13
- package/dist/Molecular/FormElement/FormElement.stories.js +33 -10
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +74 -19
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.stories.js +81 -17
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +13 -3
- package/dist/Molecular/InputAddress/InputAddress.js +139 -83
- package/dist/Molecular/InputAddress/InputAddress.stories.js +78 -14
- package/dist/Molecular/InputPassword/InputPassword.js +73 -17
- package/dist/Molecular/InputPassword/InputPassword.stories.js +72 -8
- package/dist/NonNullableType.d.ts +13 -0
- package/dist/ObjectType.d.ts +9 -0
- package/dist/OnlyObjectKeys.d.ts +65 -0
- package/dist/PrettyPrint.d.ts +29 -0
- package/dist/RequiredFields.d.ts +21 -0
- package/dist/TupleType.d.ts +10 -0
- package/dist/ValuesType.d.ts +10 -0
- package/dist/lib/src/Atomic/UI/PieChart/PieChart.d.ts +7 -3
- package/dist/lib/src/Atomic/UI/PieChart/PieChart.stories.d.ts +15 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/base.interface.js +4 -1
- package/dist/types/base.types.js +4 -1
- package/package.json +4 -3
- package/dist/Atomic/UI/PieChart/PieChar.interface.js +0 -1
- package/dist/Atomic/UI/PieChart/PieChart.test.js +0 -133
- package/dist/Atomic/UI/PieChart/index.js +0 -5
- package/dist/lib/src/Atomic/UI/PieChart/PieChar.interface.d.ts +0 -36
- package/dist/lib/src/Atomic/UI/PieChart/PieChart.test.d.ts +0 -1
- package/dist/lib/src/Atomic/UI/PieChart/index.d.ts +0 -13
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
// eslint-disable-next-line no-unused-vars
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return useFormTools;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _react = require("react");
|
|
13
|
+
const _ArrayWithObjects = /*#__PURE__*/ _interop_require_default(require("./form-drivers/ArrayWithObjects"));
|
|
14
|
+
const _ObjectWithIterableObjects = /*#__PURE__*/ _interop_require_default(require("./form-drivers/ObjectWithIterableObjects"));
|
|
15
|
+
const _ObjectWithNamedKeyObjects = /*#__PURE__*/ _interop_require_default(require("./form-drivers/ObjectWithNamedKeyObjects"));
|
|
16
|
+
const _General = /*#__PURE__*/ _interop_require_default(require("./functions/General"));
|
|
17
|
+
const _RenderFields = /*#__PURE__*/ _interop_require_default(require("./functions/RenderFields"));
|
|
18
|
+
function _interop_require_default(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
default: obj
|
|
21
|
+
};
|
|
22
|
+
}
|
|
8
23
|
const DefaultFocusControllerProps = {
|
|
9
24
|
setAutoFocus: true,
|
|
10
25
|
onlyEmptyFieldAutoFocus: false
|
|
11
26
|
};
|
|
12
|
-
|
|
27
|
+
function useFormTools({ form, setForm, FormType, FormFields, FormDataDriverName = "ArrayWithObjects" || "ObjectWithIterableObjects" || "ObjectWithNamedKeyObjects", FormDataDriver = null, FocusControllerProps = DefaultFocusControllerProps, goToNextFieldOnEnterPressed = true } = {}) {
|
|
13
28
|
FocusControllerProps = {
|
|
14
29
|
...DefaultFocusControllerProps,
|
|
15
30
|
...FocusControllerProps
|
|
16
31
|
};
|
|
17
32
|
const FormDataDrivers = {
|
|
18
33
|
ArrayWithObjects: {
|
|
19
|
-
handlers:
|
|
34
|
+
handlers: _ArrayWithObjects.default,
|
|
20
35
|
default: true
|
|
21
36
|
},
|
|
22
37
|
ObjectWithIterableObjects: {
|
|
23
|
-
handlers:
|
|
38
|
+
handlers: _ObjectWithIterableObjects.default
|
|
24
39
|
},
|
|
25
40
|
ObjectWithNamedKeyObjects: {
|
|
26
|
-
handlers:
|
|
41
|
+
handlers: _ObjectWithNamedKeyObjects.default
|
|
27
42
|
}
|
|
28
43
|
};
|
|
29
44
|
const getFormDataDriver = (name)=>{
|
|
@@ -33,7 +48,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
33
48
|
const getFormDataDriverInstance = (name, ...args)=>{
|
|
34
49
|
return getFormDataDriver(name)(...args);
|
|
35
50
|
};
|
|
36
|
-
const { getFieldClassName, updateFormField } =
|
|
51
|
+
const { getFieldClassName, updateFormField } = (0, _General.default)();
|
|
37
52
|
const { getFieldData, getFormField, setFormFields, setFormField, getFormFieldsAsArray, getFormFieldsKeys, removeAllFormFields, removeFormField, removeFormFields } = getFormDataDriverInstance(FormDataDriverName, {
|
|
38
53
|
form,
|
|
39
54
|
setForm,
|
|
@@ -41,7 +56,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
41
56
|
});
|
|
42
57
|
///////////////////////////////////////////////////////////////
|
|
43
58
|
//--- OnChange Observer ---//--- START ---//
|
|
44
|
-
const [onChangeObservers, setOnChangeObservers] = useState({});
|
|
59
|
+
const [onChangeObservers, setOnChangeObservers] = (0, _react.useState)({});
|
|
45
60
|
const addOnChangeObserver = (key, cb)=>{
|
|
46
61
|
let observerId = null;
|
|
47
62
|
setOnChangeObservers((state)=>{
|
|
@@ -86,7 +101,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
86
101
|
///////////////////////////////////////////////////////////////
|
|
87
102
|
///////////////////////////////////////////////////////////////
|
|
88
103
|
//--- Form Submit Blocker ---//--- START ---//
|
|
89
|
-
const [formSubmitBlockers, setFormSubmitBlockers] = useState([]);
|
|
104
|
+
const [formSubmitBlockers, setFormSubmitBlockers] = (0, _react.useState)([]);
|
|
90
105
|
const toggleFormSubmitBlock = (key, value)=>{
|
|
91
106
|
setFormSubmitBlockers((state)=>state.includes(key) || !value ? [
|
|
92
107
|
...state.filter((k)=>k !== key)
|
|
@@ -107,8 +122,8 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
107
122
|
///////////////////////////////////////////////////////////////
|
|
108
123
|
///////////////////////////////////////////////////////////////
|
|
109
124
|
//--- Render Fields Controller ---//--- START ---//
|
|
110
|
-
const [isFormFieldsAdded, setIsFormFieldsAdded] = useState(false);
|
|
111
|
-
const [renderFormFields, setRenderFormFieldsState] = useState([]);
|
|
125
|
+
const [isFormFieldsAdded, setIsFormFieldsAdded] = (0, _react.useState)(false);
|
|
126
|
+
const [renderFormFields, setRenderFormFieldsState] = (0, _react.useState)([]);
|
|
112
127
|
const setRenderFormFields = (data)=>{
|
|
113
128
|
setIsFormFieldsAdded(true);
|
|
114
129
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -126,7 +141,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
126
141
|
const removeRenderFields = (fields)=>{
|
|
127
142
|
setRenderFormFieldsState((state)=>state.filter((field)=>!fields.includes(field)));
|
|
128
143
|
};
|
|
129
|
-
const [isFormRendered, setIsFormRendered] = useState(false);
|
|
144
|
+
const [isFormRendered, setIsFormRendered] = (0, _react.useState)(false);
|
|
130
145
|
const submitIsFormRendered = ()=>setIsFormRendered(true);
|
|
131
146
|
const resetIsFormRendered = ()=>setIsFormRendered(false);
|
|
132
147
|
const onEnterDown = async (e)=>{
|
|
@@ -160,13 +175,13 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
160
175
|
}
|
|
161
176
|
};
|
|
162
177
|
//On Type Change
|
|
163
|
-
useEffect(()=>{
|
|
178
|
+
(0, _react.useEffect)(()=>{
|
|
164
179
|
resetIsFormRendered();
|
|
165
180
|
}, [
|
|
166
181
|
FormType
|
|
167
182
|
]);
|
|
168
183
|
//On Render Fields Change
|
|
169
|
-
useEffect(()=>{
|
|
184
|
+
(0, _react.useEffect)(()=>{
|
|
170
185
|
if (isFormFieldsAdded) resetIsFormRendered(false);
|
|
171
186
|
//Add Form Fields
|
|
172
187
|
if (renderFormFields.length !== 0) {
|
|
@@ -181,8 +196,8 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
181
196
|
if (typeof (fieldData === null || fieldData === void 0 ? void 0 : fieldData.label) === "object") {
|
|
182
197
|
field.label = fieldData.label[FormType] || fieldData.label.default;
|
|
183
198
|
}
|
|
184
|
-
field.ref = /*#__PURE__*/ createRef();
|
|
185
|
-
field.wrapperRef = /*#__PURE__*/ createRef();
|
|
199
|
+
field.ref = /*#__PURE__*/ (0, _react.createRef)();
|
|
200
|
+
field.wrapperRef = /*#__PURE__*/ (0, _react.createRef)();
|
|
186
201
|
field.isValueChangedByUser = false;
|
|
187
202
|
if (goToNextFieldOnEnterPressed) {
|
|
188
203
|
const onKeyDownProp = field.onKeyDown || (()=>{});
|
|
@@ -213,7 +228,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
213
228
|
}, [
|
|
214
229
|
renderFormFields
|
|
215
230
|
]);
|
|
216
|
-
const [onFormRenderObservers, setOnFormRenderObservers] = useState([]);
|
|
231
|
+
const [onFormRenderObservers, setOnFormRenderObservers] = (0, _react.useState)([]);
|
|
217
232
|
const addOnFormRenderObserver = (cb, { once = false } = {})=>{
|
|
218
233
|
setOnFormRenderObservers((state)=>[
|
|
219
234
|
...state,
|
|
@@ -253,7 +268,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
253
268
|
});
|
|
254
269
|
};
|
|
255
270
|
//On Form Rendered
|
|
256
|
-
useEffect(()=>{
|
|
271
|
+
(0, _react.useEffect)(()=>{
|
|
257
272
|
if (!isFormRendered && onFormRenderObservers.length) {
|
|
258
273
|
const formFieldsKeys = getFormFieldsKeys(form);
|
|
259
274
|
const isAllFieldsRendered = renderFormFields.reduce((result, key)=>{
|
|
@@ -296,7 +311,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
296
311
|
return null;
|
|
297
312
|
});
|
|
298
313
|
};
|
|
299
|
-
useEffect(()=>{
|
|
314
|
+
(0, _react.useEffect)(()=>{
|
|
300
315
|
hightliteErrorLabels();
|
|
301
316
|
}, [
|
|
302
317
|
form
|
|
@@ -305,8 +320,8 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
305
320
|
///////////////////////////////////////////////////////////////
|
|
306
321
|
///////////////////////////////////////////////////////////////
|
|
307
322
|
//--- Fields Focus Controller ---//--- START ---//
|
|
308
|
-
const [isInitFocused, setIsInitFocused] = useState(false);
|
|
309
|
-
const [autoFocusedField, setAutoFocusedField] = useState(null);
|
|
323
|
+
const [isInitFocused, setIsInitFocused] = (0, _react.useState)(false);
|
|
324
|
+
const [autoFocusedField, setAutoFocusedField] = (0, _react.useState)(null);
|
|
310
325
|
const setFirstFieldInitFocused = ()=>setIsInitFocused(true);
|
|
311
326
|
const resetIsInitFocused = ()=>setIsInitFocused(false);
|
|
312
327
|
const toggleFieldFocus = ({ key, cb = ()=>{}, form: argForm, field }, action = "focus")=>{
|
|
@@ -360,7 +375,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
360
375
|
form
|
|
361
376
|
}), 50);
|
|
362
377
|
};
|
|
363
|
-
const [onFieldFocusCallbacks, setOnFieldFocusCallbacks] = useState({});
|
|
378
|
+
const [onFieldFocusCallbacks, setOnFieldFocusCallbacks] = (0, _react.useState)({});
|
|
364
379
|
const addOnFieldFocusCallback = (key, cb)=>{
|
|
365
380
|
setOnFieldFocusCallbacks((state)=>{
|
|
366
381
|
const stateCopy = {
|
|
@@ -376,7 +391,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
376
391
|
if (!Array.isArray(onFieldFocusCallbacks[key])) return null;
|
|
377
392
|
(_onFieldFocusCallbacks_key = onFieldFocusCallbacks[key]) === null || _onFieldFocusCallbacks_key === void 0 ? void 0 : _onFieldFocusCallbacks_key.map((cb)=>cb());
|
|
378
393
|
};
|
|
379
|
-
const [focusOnRenderFields, setFocusOnRenderFields] = useState([]);
|
|
394
|
+
const [focusOnRenderFields, setFocusOnRenderFields] = (0, _react.useState)([]);
|
|
380
395
|
const addFocusFieldOnRender = (key, cb)=>{
|
|
381
396
|
setFocusOnRenderFields((state)=>[
|
|
382
397
|
...state,
|
|
@@ -387,7 +402,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
387
402
|
const removeFocusFieldOnRender = (key)=>{
|
|
388
403
|
setFocusOnRenderFields((state)=>state.filter((field)=>field !== key));
|
|
389
404
|
};
|
|
390
|
-
useEffect(()=>{
|
|
405
|
+
(0, _react.useEffect)(()=>{
|
|
391
406
|
if (FocusControllerProps.setAutoFocus && !isInitFocused && !autoFocusedField && isFormRendered) setFirstFieldFocus();
|
|
392
407
|
if (focusOnRenderFields.length) {
|
|
393
408
|
var _getFormFieldsKeys;
|
|
@@ -413,12 +428,12 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
413
428
|
isInitFocused,
|
|
414
429
|
isFormRendered
|
|
415
430
|
]);
|
|
416
|
-
useEffect(()=>{
|
|
431
|
+
(0, _react.useEffect)(()=>{
|
|
417
432
|
setAutoFocusedField(null);
|
|
418
433
|
}, [
|
|
419
434
|
isInitFocused
|
|
420
435
|
]);
|
|
421
|
-
useEffect(()=>{
|
|
436
|
+
(0, _react.useEffect)(()=>{
|
|
422
437
|
resetIsInitFocused();
|
|
423
438
|
}, [
|
|
424
439
|
FormType
|
|
@@ -435,8 +450,8 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
435
450
|
///////////////////////////////////////////////////////////////
|
|
436
451
|
///////////////////////////////////////////////////////////////
|
|
437
452
|
//--- OnFieldRendered Observer ---//--- START ---//
|
|
438
|
-
const [onFieldRenderedObservers, setOnFieldRenderedObservers] = useState({});
|
|
439
|
-
const [isFieldObserversReset, setIsFieldObserversReset] = useState(false);
|
|
453
|
+
const [onFieldRenderedObservers, setOnFieldRenderedObservers] = (0, _react.useState)({});
|
|
454
|
+
const [isFieldObserversReset, setIsFieldObserversReset] = (0, _react.useState)(false);
|
|
440
455
|
const resetOnFieldRenderObserversWorkedOut = ()=>{
|
|
441
456
|
if (!isFieldObserversReset && renderFormFields.length) {
|
|
442
457
|
renderFormFields.map((key)=>{
|
|
@@ -515,13 +530,13 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
515
530
|
};
|
|
516
531
|
});
|
|
517
532
|
};
|
|
518
|
-
useEffect(()=>{
|
|
533
|
+
(0, _react.useEffect)(()=>{
|
|
519
534
|
resetOnFieldRenderObserversWorkedOut();
|
|
520
535
|
onRenderObserverWorker();
|
|
521
536
|
}, [
|
|
522
537
|
form
|
|
523
538
|
]);
|
|
524
|
-
useEffect(()=>{
|
|
539
|
+
(0, _react.useEffect)(()=>{
|
|
525
540
|
setIsFieldObserversReset(false);
|
|
526
541
|
}, [
|
|
527
542
|
FormType
|
|
@@ -623,7 +638,7 @@ export default function useFormTools({ form, setForm, FormType, FormFields, Form
|
|
|
623
638
|
addOnFormRenderObserver,
|
|
624
639
|
submitIsFormRendered,
|
|
625
640
|
resetIsFormRendered,
|
|
626
|
-
renderFields: ({ form: argForm = form, fields: argFields = renderFormFields, cols: argCols = 1, RenderFieldComponent })=>
|
|
641
|
+
renderFields: ({ form: argForm = form, fields: argFields = renderFormFields, cols: argCols = 1, RenderFieldComponent })=>(0, _RenderFields.default)({
|
|
627
642
|
form: argForm,
|
|
628
643
|
fields: argFields,
|
|
629
644
|
cols: argCols,
|
|
@@ -1,10 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
default: function() {
|
|
13
|
+
return _default;
|
|
14
|
+
},
|
|
15
|
+
useInputHighlightError: function() {
|
|
16
|
+
return useInputHighlightError;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
20
|
+
const _indexconstants = require("../Constants/index.constants");
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
22
|
+
if (typeof WeakMap !== "function") return null;
|
|
23
|
+
var cacheBabelInterop = new WeakMap();
|
|
24
|
+
var cacheNodeInterop = new WeakMap();
|
|
25
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
26
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
27
|
+
})(nodeInterop);
|
|
28
|
+
}
|
|
29
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
30
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
34
|
+
return {
|
|
35
|
+
default: obj
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
39
|
+
if (cache && cache.has(obj)) {
|
|
40
|
+
return cache.get(obj);
|
|
41
|
+
}
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
45
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
|
+
for(var key in obj){
|
|
47
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
48
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
49
|
+
if (desc && (desc.get || desc.set)) {
|
|
50
|
+
Object.defineProperty(newObj, key, desc);
|
|
51
|
+
} else {
|
|
52
|
+
newObj[key] = obj[key];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
newObj.default = obj;
|
|
57
|
+
if (cache) {
|
|
58
|
+
cache.set(obj, newObj);
|
|
59
|
+
}
|
|
60
|
+
return newObj;
|
|
61
|
+
}
|
|
62
|
+
const useInputHighlightError = ({ value, blinkTime, isUseErrorsBlink })=>{
|
|
4
63
|
const DEFAULT_BLINK_TIME = 100;
|
|
5
|
-
const [isToHighlightError, setIsToHighlightError] = useState(false);
|
|
6
|
-
const [isAttemptToChange, setIsAttemptToChange] = useState(false);
|
|
7
|
-
const [prevValue, setPreviousValue] = useState(value);
|
|
64
|
+
const [isToHighlightError, setIsToHighlightError] = (0, _react.useState)(false);
|
|
65
|
+
const [isAttemptToChange, setIsAttemptToChange] = (0, _react.useState)(false);
|
|
66
|
+
const [prevValue, setPreviousValue] = (0, _react.useState)(value);
|
|
8
67
|
function hasHighlightError(e) {
|
|
9
68
|
const changedValue = `${value !== null && value !== void 0 ? value : ""}`;
|
|
10
69
|
const previousValue = `${prevValue !== null && prevValue !== void 0 ? prevValue : ""}`;
|
|
@@ -28,9 +87,9 @@ export const useInputHighlightError = ({ value, blinkTime, isUseErrorsBlink })=>
|
|
|
28
87
|
const samePart = infoAboutDifferencesSameness.same.join("");
|
|
29
88
|
const differencesLength = infoAboutDifferencesSameness.differences.length;
|
|
30
89
|
const currentSet = changedValue === null || changedValue === void 0 ? void 0 : changedValue.replace(samePart, "");
|
|
31
|
-
if (!KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) setIsAttemptToChange(!(!differencesLength && e.key === currentSet));
|
|
90
|
+
if (!_indexconstants.KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) setIsAttemptToChange(!(!differencesLength && e.key === currentSet));
|
|
32
91
|
}
|
|
33
|
-
useEffect(()=>{
|
|
92
|
+
(0, _react.useEffect)(()=>{
|
|
34
93
|
if (isUseErrorsBlink && isAttemptToChange) {
|
|
35
94
|
setIsAttemptToChange(null);
|
|
36
95
|
setIsToHighlightError(true);
|
|
@@ -48,4 +107,4 @@ export const useInputHighlightError = ({ value, blinkTime, isUseErrorsBlink })=>
|
|
|
48
107
|
hasHighlightError
|
|
49
108
|
};
|
|
50
109
|
};
|
|
51
|
-
|
|
110
|
+
const _default = useInputHighlightError;
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _useIsMobile = /*#__PURE__*/ _interop_require_default(require("./useIsMobile"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const _default = _useIsMobile.default;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
2
12
|
/**
|
|
3
13
|
* Hook to detect if the current device is a mobile device
|
|
4
14
|
* @param props - Configuration options
|
|
@@ -8,8 +18,8 @@ import { useEffect, useState } from 'react';
|
|
|
8
18
|
const getIsMobile = ()=>{
|
|
9
19
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
10
20
|
};
|
|
11
|
-
const [isMobile, setIsMobile] = useState(getIsMobile());
|
|
12
|
-
useEffect(()=>{
|
|
21
|
+
const [isMobile, setIsMobile] = (0, _react.useState)(getIsMobile());
|
|
22
|
+
(0, _react.useEffect)(()=>{
|
|
13
23
|
if (getIsMobile()) {
|
|
14
24
|
setIsMobile(true);
|
|
15
25
|
}
|
|
@@ -20,4 +30,4 @@ import { useEffect, useState } from 'react';
|
|
|
20
30
|
isMobile: isMobile && (isWithoutWidthCheck || window.screen.width <= 768)
|
|
21
31
|
};
|
|
22
32
|
}
|
|
23
|
-
|
|
33
|
+
const _default = useIsMobile;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _react = require("@testing-library/react");
|
|
6
|
+
const _useIsMobile = /*#__PURE__*/ _interop_require_default(require("./useIsMobile"));
|
|
7
|
+
function _interop_require_default(obj) {
|
|
8
|
+
return obj && obj.__esModule ? obj : {
|
|
9
|
+
default: obj
|
|
10
|
+
};
|
|
11
|
+
}
|
|
3
12
|
describe('useIsMobile', ()=>{
|
|
4
13
|
const originalNavigator = window.navigator;
|
|
5
14
|
const originalScreen = window.screen;
|
|
@@ -31,19 +40,19 @@ describe('useIsMobile', ()=>{
|
|
|
31
40
|
it('should detect mobile device based on user agent', ()=>{
|
|
32
41
|
mockUserAgent('iPhone');
|
|
33
42
|
mockScreenWidth(375);
|
|
34
|
-
const { result } = renderHook(()=>
|
|
43
|
+
const { result } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)());
|
|
35
44
|
expect(result.current.isMobile).toBe(true);
|
|
36
45
|
});
|
|
37
46
|
it('should detect desktop device based on user agent', ()=>{
|
|
38
47
|
mockUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36');
|
|
39
48
|
mockScreenWidth(1920);
|
|
40
|
-
const { result } = renderHook(()=>
|
|
49
|
+
const { result } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)());
|
|
41
50
|
expect(result.current.isMobile).toBe(false);
|
|
42
51
|
});
|
|
43
52
|
it('should respect width check when isWithoutWidthCheck is false', ()=>{
|
|
44
53
|
mockUserAgent('iPhone');
|
|
45
54
|
mockScreenWidth(1024);
|
|
46
|
-
const { result } = renderHook(()=>
|
|
55
|
+
const { result } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)({
|
|
47
56
|
isWithoutWidthCheck: false
|
|
48
57
|
}));
|
|
49
58
|
expect(result.current.isMobile).toBe(false);
|
|
@@ -51,7 +60,7 @@ describe('useIsMobile', ()=>{
|
|
|
51
60
|
it('should ignore width check when isWithoutWidthCheck is true', ()=>{
|
|
52
61
|
mockUserAgent('iPhone');
|
|
53
62
|
mockScreenWidth(1024);
|
|
54
|
-
const { result } = renderHook(()=>
|
|
63
|
+
const { result } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)({
|
|
55
64
|
isWithoutWidthCheck: true
|
|
56
65
|
}));
|
|
57
66
|
expect(result.current.isMobile).toBe(true);
|
|
@@ -71,7 +80,7 @@ describe('useIsMobile', ()=>{
|
|
|
71
80
|
it(`should detect ${device} as mobile device`, ()=>{
|
|
72
81
|
mockUserAgent(device);
|
|
73
82
|
mockScreenWidth(375);
|
|
74
|
-
const { result } = renderHook(()=>
|
|
83
|
+
const { result } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)());
|
|
75
84
|
expect(result.current.isMobile).toBe(true);
|
|
76
85
|
});
|
|
77
86
|
});
|
|
@@ -79,7 +88,7 @@ describe('useIsMobile', ()=>{
|
|
|
79
88
|
it('should update isMobile state when userAgent changes', ()=>{
|
|
80
89
|
mockUserAgent('Desktop');
|
|
81
90
|
mockScreenWidth(1920);
|
|
82
|
-
const { result, rerender } = renderHook(()=>
|
|
91
|
+
const { result, rerender } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)());
|
|
83
92
|
expect(result.current.isMobile).toBe(false);
|
|
84
93
|
mockUserAgent('iPhone');
|
|
85
94
|
mockScreenWidth(375);
|
|
@@ -87,7 +96,7 @@ describe('useIsMobile', ()=>{
|
|
|
87
96
|
expect(result.current.isMobile).toBe(true);
|
|
88
97
|
});
|
|
89
98
|
it('should return only isMobile property', ()=>{
|
|
90
|
-
const { result } = renderHook(()=>
|
|
99
|
+
const { result } = (0, _react.renderHook)(()=>(0, _useIsMobile.default)());
|
|
91
100
|
expect(Object.keys(result.current)).toEqual([
|
|
92
101
|
'isMobile'
|
|
93
102
|
]);
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _useKeyPress = /*#__PURE__*/ _interop_require_default(require("./useKeyPress"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
3
18
|
/**
|
|
4
19
|
* A hook that handles Enter and Escape key press events
|
|
5
20
|
*
|
|
@@ -18,9 +33,9 @@ import useKeyPress from './useKeyPress';
|
|
|
18
33
|
* }
|
|
19
34
|
* ```
|
|
20
35
|
*/ function useHandleKeyPress({ escCallback, enterCallback, withClamping = true }) {
|
|
21
|
-
const isPressEnter =
|
|
22
|
-
const isPressEscape =
|
|
23
|
-
useEffect(()=>{
|
|
36
|
+
const isPressEnter = (0, _useKeyPress.default)('Enter', withClamping);
|
|
37
|
+
const isPressEscape = (0, _useKeyPress.default)('Escape', withClamping);
|
|
38
|
+
(0, _react.useEffect)(()=>{
|
|
24
39
|
if (isPressEnter && typeof enterCallback === 'function') {
|
|
25
40
|
enterCallback();
|
|
26
41
|
}
|
|
@@ -34,4 +49,4 @@ import useKeyPress from './useKeyPress';
|
|
|
34
49
|
isPressEscape
|
|
35
50
|
]);
|
|
36
51
|
}
|
|
37
|
-
|
|
52
|
+
const _default = useHandleKeyPress;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _react = require("@testing-library/react");
|
|
6
|
+
const _useHandleKeyPress = /*#__PURE__*/ _interop_require_default(require("./useHandleKeyPress"));
|
|
7
|
+
const _useKeyPress = /*#__PURE__*/ _interop_require_default(require("./useKeyPress"));
|
|
8
|
+
function _interop_require_default(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
4
13
|
// Мокаем хук useKeyPress
|
|
5
14
|
jest.mock('./useKeyPress');
|
|
6
|
-
const mockedUseKeyPress =
|
|
15
|
+
const mockedUseKeyPress = _useKeyPress.default;
|
|
7
16
|
describe('useHandleKeyPress', ()=>{
|
|
8
17
|
// Очищаем моки перед каждым тестом
|
|
9
18
|
beforeEach(()=>{
|
|
@@ -17,7 +26,7 @@ describe('useHandleKeyPress', ()=>{
|
|
|
17
26
|
// Симулируем нажатие Enter
|
|
18
27
|
mockedUseKeyPress.mockReturnValueOnce(true) // для Enter
|
|
19
28
|
.mockReturnValueOnce(false); // для Escape
|
|
20
|
-
renderHook(()=>
|
|
29
|
+
(0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({
|
|
21
30
|
enterCallback,
|
|
22
31
|
escCallback
|
|
23
32
|
}));
|
|
@@ -30,7 +39,7 @@ describe('useHandleKeyPress', ()=>{
|
|
|
30
39
|
// Симулируем нажатие Escape
|
|
31
40
|
mockedUseKeyPress.mockReturnValueOnce(false) // для Enter
|
|
32
41
|
.mockReturnValueOnce(true); // для Escape
|
|
33
|
-
renderHook(()=>
|
|
42
|
+
(0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({
|
|
34
43
|
enterCallback,
|
|
35
44
|
escCallback
|
|
36
45
|
}));
|
|
@@ -42,7 +51,7 @@ describe('useHandleKeyPress', ()=>{
|
|
|
42
51
|
const escCallback = jest.fn();
|
|
43
52
|
// Никакие клавиши не нажаты
|
|
44
53
|
mockedUseKeyPress.mockReturnValue(false);
|
|
45
|
-
renderHook(()=>
|
|
54
|
+
(0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({
|
|
46
55
|
enterCallback,
|
|
47
56
|
escCallback
|
|
48
57
|
}));
|
|
@@ -52,13 +61,13 @@ describe('useHandleKeyPress', ()=>{
|
|
|
52
61
|
it('should handle undefined callbacks gracefully', ()=>{
|
|
53
62
|
// Проверяем, что хук не выбрасывает ошибку при отсутствии callback'ов
|
|
54
63
|
expect(()=>{
|
|
55
|
-
renderHook(()=>
|
|
64
|
+
(0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({
|
|
56
65
|
withClamping: true
|
|
57
66
|
}));
|
|
58
67
|
}).not.toThrow();
|
|
59
68
|
});
|
|
60
69
|
it('should pass withClamping parameter to useKeyPress', ()=>{
|
|
61
|
-
renderHook(()=>
|
|
70
|
+
(0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({
|
|
62
71
|
withClamping: false
|
|
63
72
|
}));
|
|
64
73
|
// Проверяем, что useKeyPress вызывается с правильными параметрами
|
|
@@ -66,7 +75,7 @@ describe('useHandleKeyPress', ()=>{
|
|
|
66
75
|
expect(mockedUseKeyPress).toHaveBeenCalledWith('Escape', false);
|
|
67
76
|
});
|
|
68
77
|
it('should use default withClamping value when not provided', ()=>{
|
|
69
|
-
renderHook(()=>
|
|
78
|
+
(0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({}));
|
|
70
79
|
// Проверяем, что useKeyPress вызывается с дефолтным значением withClamping
|
|
71
80
|
expect(mockedUseKeyPress).toHaveBeenCalledWith('Enter', true);
|
|
72
81
|
expect(mockedUseKeyPress).toHaveBeenCalledWith('Escape', true);
|
|
@@ -74,7 +83,7 @@ describe('useHandleKeyPress', ()=>{
|
|
|
74
83
|
it('should properly handle effect cleanup', ()=>{
|
|
75
84
|
const enterCallback = jest.fn();
|
|
76
85
|
const escCallback = jest.fn();
|
|
77
|
-
const { unmount } = renderHook(()=>
|
|
86
|
+
const { unmount } = (0, _react.renderHook)(()=>(0, _useHandleKeyPress.default)({
|
|
78
87
|
enterCallback,
|
|
79
88
|
escCallback
|
|
80
89
|
}));
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
2
12
|
/**
|
|
3
13
|
* A hook that detects when a specific key is pressed
|
|
4
14
|
* @param targetKey - The key to listen for
|
|
5
15
|
* @param clamping - Whether to allow key repeat events
|
|
6
16
|
* @returns boolean indicating if the target key is currently pressed
|
|
7
17
|
*/ function useKeyPress(targetKey, clamping = true) {
|
|
8
|
-
const [keyPressed, setKeyPressed] = useState(false);
|
|
9
|
-
const downHandler = useCallback(({ key, repeat })=>{
|
|
18
|
+
const [keyPressed, setKeyPressed] = (0, _react.useState)(false);
|
|
19
|
+
const downHandler = (0, _react.useCallback)(({ key, repeat })=>{
|
|
10
20
|
if (key === targetKey) {
|
|
11
21
|
if (!clamping && repeat) return;
|
|
12
22
|
setKeyPressed(true);
|
|
@@ -15,7 +25,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
15
25
|
clamping,
|
|
16
26
|
targetKey
|
|
17
27
|
]);
|
|
18
|
-
const upHandler = useCallback(({ key, repeat })=>{
|
|
28
|
+
const upHandler = (0, _react.useCallback)(({ key, repeat })=>{
|
|
19
29
|
if (key === targetKey) {
|
|
20
30
|
if (!clamping && repeat) return;
|
|
21
31
|
setKeyPressed(false);
|
|
@@ -24,7 +34,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
24
34
|
clamping,
|
|
25
35
|
targetKey
|
|
26
36
|
]);
|
|
27
|
-
useEffect(()=>{
|
|
37
|
+
(0, _react.useEffect)(()=>{
|
|
28
38
|
const handleDown = (event)=>downHandler(event);
|
|
29
39
|
const handleUp = (event)=>upHandler(event);
|
|
30
40
|
window.addEventListener('keydown', handleDown);
|
|
@@ -39,4 +49,4 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
39
49
|
]);
|
|
40
50
|
return keyPressed;
|
|
41
51
|
}
|
|
42
|
-
|
|
52
|
+
const _default = useKeyPress;
|