josenanodev-react-components-library 1.0.3 → 1.0.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/cjs/Services/MulticalendarStatesAndSettings.d.ts +34 -0
- package/dist/cjs/Services/MulticalendarStatesAndSettings.js +55 -0
- package/dist/cjs/Services/accessToken.d.ts +3 -0
- package/dist/cjs/Services/accessToken.js +15 -0
- package/dist/cjs/common/constants.d.ts +5 -0
- package/dist/cjs/common/constants.js +8 -0
- package/dist/cjs/common/turboSuiteUrls.d.ts +7 -0
- package/dist/cjs/common/turboSuiteUrls.js +9 -0
- package/dist/cjs/common/types.d.ts +113 -0
- package/dist/cjs/components/BubbleMenu/BubbleMenu.d.ts +12 -0
- package/dist/cjs/components/BubbleMenu/BubbleMenu.js +60 -0
- package/dist/cjs/components/BubbleMenu/BubbleMenu.module.scss +113 -0
- package/dist/cjs/components/CalendarDatePicker/CalendarDatePicker.d.ts +19 -0
- package/dist/cjs/components/CalendarDatePicker/CalendarDatePicker.js +191 -0
- package/dist/cjs/components/CalendarDatePicker/CalendarDatePicker.module.scss +104 -0
- package/dist/cjs/components/CalendarDatePicker/subcomponents/CalendarScrollableSection.d.ts +15 -0
- package/dist/cjs/components/CalendarDatePicker/subcomponents/CalendarScrollableSection.js +300 -0
- package/dist/cjs/components/CalendarDatePicker/subcomponents/CalendarScrollableSection.module.scss +151 -0
- package/dist/cjs/components/ExportToExcelButton/ExportToExcelButton.css +31 -0
- package/dist/cjs/components/ExportToExcelButton/ExportToExcelButton.d.ts +5 -0
- package/dist/cjs/components/ExportToExcelButton/ExportToExcelButton.js +45 -0
- package/dist/cjs/components/ExportToExcelButton/ExportToExcelButtonOwnFunctions.d.ts +6 -0
- package/dist/cjs/components/ExportToExcelButton/ExportToExcelButtonOwnFunctions.js +75 -0
- package/dist/cjs/components/ExportToExcelButton/types.d.ts +44 -0
- package/dist/cjs/components/InputBoxWithConfirmation/InputBoxWithConfirmation.d.ts +17 -0
- package/dist/cjs/components/InputBoxWithConfirmation/InputBoxWithConfirmation.js +137 -0
- package/dist/cjs/components/InputBoxWithConfirmation/InputBoxWithConfirmation.module.scss +52 -0
- package/dist/cjs/components/IntegerControl/IntegerControl.d.ts +10 -0
- package/dist/cjs/components/IntegerControl/IntegerControl.js +52 -0
- package/dist/cjs/components/IntegerControl/IntegerControl.module.scss +46 -0
- package/dist/cjs/components/LabeledInput/LabeledInput.d.ts +15 -0
- package/dist/cjs/components/LabeledInput/LabeledInput.js +47 -0
- package/dist/cjs/components/LabeledInput/LabeledInput.module.scss +74 -0
- package/dist/cjs/components/Modal/Modal.css +43 -0
- package/dist/cjs/components/Modal/Modal.d.ts +5 -0
- package/dist/cjs/components/Modal/Modal.js +82 -0
- package/dist/cjs/components/Modal/types.d.ts +8 -0
- package/dist/cjs/components/Multicalendar/Multicalendar.css +191 -0
- package/dist/cjs/components/Multicalendar/Multicalendar.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/Multicalendar.js +369 -0
- package/dist/cjs/components/Multicalendar/MulticalendarOwnFunctions.d.ts +86 -0
- package/dist/cjs/components/Multicalendar/MulticalendarOwnFunctions.js +192 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.css +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.js +20 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/types.d.ts +11 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.css +6 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.js +20 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/types.d.ts +13 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.css +3 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.js +15 -0
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/types.d.ts +9 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/Cell.css +6 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/Cell.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/Cell.js +12 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/types.d.ts +10 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.css +60 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.js +56 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/types.d.ts +11 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.css +14 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.js +13 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/types.d.ts +6 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.css +14 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.d.ts +5 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.js +14 -0
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/types.d.ts +7 -0
- package/dist/cjs/components/Multicalendar/types.d.ts +48 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.css +40 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.d.ts +5 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.js +48 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/types.d.ts +6 -0
- package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.css +244 -0
- package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.d.ts +5 -0
- package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.js +147 -0
- package/dist/cjs/components/ParallelSelectionList/types.d.ts +22 -0
- package/dist/cjs/components/PopUp/PopUp.css +15 -0
- package/dist/cjs/components/PopUp/PopUp.d.ts +5 -0
- package/dist/cjs/components/PopUp/PopUp.js +50 -0
- package/dist/cjs/components/PopUp/types.d.ts +9 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.css +39 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.js +56 -0
- package/dist/cjs/components/ProgressBar/types.d.ts +7 -0
- package/dist/cjs/components/ScreenSteps/ScreenSteps.d.ts +14 -0
- package/dist/cjs/components/ScreenSteps/ScreenSteps.js +66 -0
- package/dist/cjs/components/ScreenSteps/ScreenSteps.module.scss +68 -0
- package/dist/cjs/components/ScrollSnapGallery/ScrollSnapGallery.d.ts +14 -0
- package/dist/cjs/components/ScrollSnapGallery/ScrollSnapGallery.js +98 -0
- package/dist/cjs/components/ScrollSnapGallery/ScrollSnapGallery.module.scss +67 -0
- package/dist/cjs/components/SearchBar/SearchBar.css +35 -0
- package/dist/cjs/components/SearchBar/SearchBar.d.ts +5 -0
- package/dist/cjs/components/SearchBar/SearchBar.js +54 -0
- package/dist/cjs/components/SearchBar/types.d.ts +10 -0
- package/dist/cjs/components/SideBar/SideBar.css +53 -0
- package/dist/cjs/components/SideBar/SideBar.d.ts +8 -0
- package/dist/cjs/components/SideBar/SideBar.js +70 -0
- package/dist/cjs/components/SideBar/types.d.ts +8 -0
- package/dist/cjs/components/Slider/Slider.css +55 -0
- package/dist/cjs/components/Slider/Slider.d.ts +5 -0
- package/dist/cjs/components/Slider/Slider.js +173 -0
- package/dist/cjs/components/Slider/SliderOwnFunctions.d.ts +2 -0
- package/dist/cjs/components/Slider/SliderOwnFunctions.js +11 -0
- package/dist/cjs/components/Slider/types.d.ts +14 -0
- package/dist/cjs/hooks/useIntersectionObserver.d.ts +9 -0
- package/dist/cjs/hooks/useIntersectionObserver.js +28 -0
- package/dist/cjs/hooks/useOutsideClick.d.ts +3 -0
- package/dist/cjs/hooks/useOutsideClick.js +19 -0
- package/dist/cjs/hooks/useResizeObserver.d.ts +7 -0
- package/dist/cjs/hooks/useResizeObserver.js +30 -0
- package/dist/cjs/hooks/useWindowsSize.d.ts +6 -0
- package/dist/cjs/hooks/useWindowsSize.js +20 -0
- package/dist/cjs/index.css +79 -0
- package/dist/cjs/index.d.ts +20 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/languages/en-EN.d.ts +3 -0
- package/dist/cjs/languages/en-EN.js +25 -0
- package/dist/cjs/languages/es-ES.d.ts +3 -0
- package/dist/cjs/languages/es-ES.js +25 -0
- package/dist/cjs/languages/it-IT.d.ts +3 -0
- package/dist/cjs/languages/it-IT.js +25 -0
- package/dist/cjs/languages/types.d.ts +22 -0
- package/dist/cjs/mocks/ReactComponentMocksForTesting/CellChildrenMock.d.ts +4 -0
- package/dist/cjs/mocks/ReactComponentMocksForTesting/CellChildrenMock.js +13 -0
- package/dist/cjs/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.d.ts +4 -0
- package/dist/cjs/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.js +10 -0
- package/dist/cjs/react-app-env.d.ts +1 -0
- package/dist/cjs/setupTests.d.ts +2 -0
- package/dist/cjs/setupTests.js +8 -0
- package/dist/cjs/stories/CalendarDatePickerMask.d.ts +4 -0
- package/dist/cjs/stories/CalendarDatePickerMask.js +21 -0
- package/dist/cjs/utils/datesArray.d.ts +8 -0
- package/dist/cjs/utils/datesArray.js +23 -0
- package/dist/cjs/utils/dayOfTheWeekStartingOnMonday.d.ts +7 -0
- package/dist/cjs/utils/dayOfTheWeekStartingOnMonday.js +11 -0
- package/dist/cjs/utils/jsToSqlDate.d.ts +7 -0
- package/dist/cjs/utils/jsToSqlDate.js +22 -0
- package/dist/cjs/utils/monthYearString.d.ts +3 -0
- package/dist/cjs/utils/monthYearString.js +27 -0
- package/dist/cjs/utils/numberOfDaysInAMonth.d.ts +6 -0
- package/dist/cjs/utils/numberOfDaysInAMonth.js +12 -0
- package/dist/cjs/utils/numberOfWeeksInAMonth.d.ts +7 -0
- package/dist/cjs/utils/numberOfWeeksInAMonth.js +25 -0
- package/dist/cjs/utils/sqlToJsDate.d.ts +7 -0
- package/dist/cjs/utils/sqlToJsDate.js +14 -0
- package/dist/esm/Services/MulticalendarStatesAndSettings.d.ts +34 -0
- package/dist/esm/Services/MulticalendarStatesAndSettings.js +46 -0
- package/dist/esm/Services/accessToken.d.ts +3 -0
- package/dist/esm/Services/accessToken.js +9 -0
- package/dist/esm/common/constants.d.ts +5 -0
- package/dist/esm/common/constants.js +5 -0
- package/dist/esm/common/turboSuiteUrls.d.ts +7 -0
- package/dist/esm/common/turboSuiteUrls.js +7 -0
- package/dist/esm/common/types.d.ts +113 -0
- package/dist/esm/components/BubbleMenu/BubbleMenu.d.ts +12 -0
- package/dist/esm/components/BubbleMenu/BubbleMenu.js +32 -0
- package/dist/esm/components/BubbleMenu/BubbleMenu.module.scss +113 -0
- package/dist/esm/components/CalendarDatePicker/CalendarDatePicker.d.ts +19 -0
- package/dist/esm/components/CalendarDatePicker/CalendarDatePicker.js +163 -0
- package/dist/esm/components/CalendarDatePicker/CalendarDatePicker.module.scss +104 -0
- package/dist/esm/components/CalendarDatePicker/subcomponents/CalendarScrollableSection.d.ts +15 -0
- package/dist/esm/components/CalendarDatePicker/subcomponents/CalendarScrollableSection.js +272 -0
- package/dist/esm/components/CalendarDatePicker/subcomponents/CalendarScrollableSection.module.scss +151 -0
- package/dist/esm/components/ExportToExcelButton/ExportToExcelButton.css +31 -0
- package/dist/esm/components/ExportToExcelButton/ExportToExcelButton.d.ts +5 -0
- package/dist/esm/components/ExportToExcelButton/ExportToExcelButton.js +17 -0
- package/dist/esm/components/ExportToExcelButton/ExportToExcelButtonOwnFunctions.d.ts +6 -0
- package/dist/esm/components/ExportToExcelButton/ExportToExcelButtonOwnFunctions.js +48 -0
- package/dist/esm/components/ExportToExcelButton/types.d.ts +44 -0
- package/dist/esm/components/InputBoxWithConfirmation/InputBoxWithConfirmation.d.ts +17 -0
- package/dist/esm/components/InputBoxWithConfirmation/InputBoxWithConfirmation.js +109 -0
- package/dist/esm/components/InputBoxWithConfirmation/InputBoxWithConfirmation.module.scss +52 -0
- package/dist/esm/components/IntegerControl/IntegerControl.d.ts +10 -0
- package/dist/esm/components/IntegerControl/IntegerControl.js +24 -0
- package/dist/esm/components/IntegerControl/IntegerControl.module.scss +46 -0
- package/dist/esm/components/LabeledInput/LabeledInput.d.ts +15 -0
- package/dist/esm/components/LabeledInput/LabeledInput.js +19 -0
- package/dist/esm/components/LabeledInput/LabeledInput.module.scss +74 -0
- package/dist/esm/components/Modal/Modal.css +43 -0
- package/dist/esm/components/Modal/Modal.d.ts +5 -0
- package/dist/esm/components/Modal/Modal.js +54 -0
- package/dist/esm/components/Modal/types.d.ts +8 -0
- package/dist/esm/components/Multicalendar/Multicalendar.css +191 -0
- package/dist/esm/components/Multicalendar/Multicalendar.d.ts +5 -0
- package/dist/esm/components/Multicalendar/Multicalendar.js +341 -0
- package/dist/esm/components/Multicalendar/MulticalendarOwnFunctions.d.ts +86 -0
- package/dist/esm/components/Multicalendar/MulticalendarOwnFunctions.js +176 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.css +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.js +15 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/types.d.ts +11 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.css +6 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.js +15 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/types.d.ts +13 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.css +3 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.js +10 -0
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/types.d.ts +9 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/Cell.css +6 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/Cell.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/Cell.js +7 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/types.d.ts +10 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.css +60 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.js +51 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/types.d.ts +11 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.css +14 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.js +8 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/types.d.ts +6 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.css +14 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.d.ts +5 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.js +9 -0
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/types.d.ts +7 -0
- package/dist/esm/components/Multicalendar/types.d.ts +48 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.css +40 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.d.ts +5 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.js +23 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/types.d.ts +6 -0
- package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.css +244 -0
- package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.d.ts +5 -0
- package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.js +142 -0
- package/dist/esm/components/ParallelSelectionList/types.d.ts +22 -0
- package/dist/esm/components/PopUp/PopUp.css +15 -0
- package/dist/esm/components/PopUp/PopUp.d.ts +5 -0
- package/dist/esm/components/PopUp/PopUp.js +22 -0
- package/dist/esm/components/PopUp/types.d.ts +9 -0
- package/dist/esm/components/ProgressBar/ProgressBar.css +39 -0
- package/dist/esm/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/esm/components/ProgressBar/ProgressBar.js +31 -0
- package/dist/esm/components/ProgressBar/types.d.ts +7 -0
- package/dist/esm/components/ScreenSteps/ScreenSteps.d.ts +14 -0
- package/dist/esm/components/ScreenSteps/ScreenSteps.js +38 -0
- package/dist/esm/components/ScreenSteps/ScreenSteps.module.scss +68 -0
- package/dist/esm/components/ScrollSnapGallery/ScrollSnapGallery.d.ts +14 -0
- package/dist/esm/components/ScrollSnapGallery/ScrollSnapGallery.js +70 -0
- package/dist/esm/components/ScrollSnapGallery/ScrollSnapGallery.module.scss +67 -0
- package/dist/esm/components/SearchBar/SearchBar.css +35 -0
- package/dist/esm/components/SearchBar/SearchBar.d.ts +5 -0
- package/dist/esm/components/SearchBar/SearchBar.js +29 -0
- package/dist/esm/components/SearchBar/types.d.ts +10 -0
- package/dist/esm/components/SideBar/SideBar.css +53 -0
- package/dist/esm/components/SideBar/SideBar.d.ts +8 -0
- package/dist/esm/components/SideBar/SideBar.js +42 -0
- package/dist/esm/components/SideBar/types.d.ts +8 -0
- package/dist/esm/components/Slider/Slider.css +55 -0
- package/dist/esm/components/Slider/Slider.d.ts +5 -0
- package/dist/esm/components/Slider/Slider.js +148 -0
- package/dist/esm/components/Slider/SliderOwnFunctions.d.ts +2 -0
- package/dist/esm/components/Slider/SliderOwnFunctions.js +6 -0
- package/dist/esm/components/Slider/types.d.ts +14 -0
- package/dist/esm/hooks/useIntersectionObserver.d.ts +9 -0
- package/dist/esm/hooks/useIntersectionObserver.js +26 -0
- package/dist/esm/hooks/useOutsideClick.d.ts +3 -0
- package/dist/esm/hooks/useOutsideClick.js +17 -0
- package/dist/esm/hooks/useResizeObserver.d.ts +7 -0
- package/dist/esm/hooks/useResizeObserver.js +28 -0
- package/dist/esm/hooks/useWindowsSize.d.ts +6 -0
- package/dist/esm/hooks/useWindowsSize.js +18 -0
- package/dist/esm/index.css +79 -0
- package/dist/esm/index.d.ts +20 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/languages/en-EN.d.ts +3 -0
- package/dist/esm/languages/en-EN.js +23 -0
- package/dist/esm/languages/es-ES.d.ts +3 -0
- package/dist/esm/languages/es-ES.js +23 -0
- package/dist/esm/languages/it-IT.d.ts +3 -0
- package/dist/esm/languages/it-IT.js +23 -0
- package/dist/esm/languages/types.d.ts +22 -0
- package/dist/esm/mocks/ReactComponentMocksForTesting/CellChildrenMock.d.ts +4 -0
- package/dist/esm/mocks/ReactComponentMocksForTesting/CellChildrenMock.js +8 -0
- package/dist/esm/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.d.ts +4 -0
- package/dist/esm/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.js +5 -0
- package/dist/esm/react-app-env.d.ts +1 -0
- package/dist/esm/setupTests.d.ts +2 -0
- package/dist/esm/setupTests.js +6 -0
- package/dist/esm/stories/CalendarDatePickerMask.d.ts +4 -0
- package/dist/esm/stories/CalendarDatePickerMask.js +16 -0
- package/dist/esm/utils/datesArray.d.ts +8 -0
- package/dist/esm/utils/datesArray.js +21 -0
- package/dist/esm/utils/dayOfTheWeekStartingOnMonday.d.ts +7 -0
- package/dist/esm/utils/dayOfTheWeekStartingOnMonday.js +9 -0
- package/dist/esm/utils/jsToSqlDate.d.ts +7 -0
- package/dist/esm/utils/jsToSqlDate.js +20 -0
- package/dist/esm/utils/monthYearString.d.ts +3 -0
- package/dist/esm/utils/monthYearString.js +25 -0
- package/dist/esm/utils/numberOfDaysInAMonth.d.ts +6 -0
- package/dist/esm/utils/numberOfDaysInAMonth.js +8 -0
- package/dist/esm/utils/numberOfWeeksInAMonth.d.ts +7 -0
- package/dist/esm/utils/numberOfWeeksInAMonth.js +20 -0
- package/dist/esm/utils/sqlToJsDate.d.ts +7 -0
- package/dist/esm/utils/sqlToJsDate.js +12 -0
- package/package.json +10 -22
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +0 -20188
- package/dist/index.umd.js +0 -196
- package/dist/style.css +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconType } from "react-icons/lib";
|
|
3
|
+
type ScrollSnapGalleryProps = {
|
|
4
|
+
urls: string[];
|
|
5
|
+
width?: string;
|
|
6
|
+
height?: string;
|
|
7
|
+
IndicatorIcon?: IconType;
|
|
8
|
+
positionIndicatorSize?: number;
|
|
9
|
+
iconSize?: number;
|
|
10
|
+
showArrows?: boolean;
|
|
11
|
+
frameStyle?: React.CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
declare const ScrollSnapGallery: ({ urls, width, height, IndicatorIcon, positionIndicatorSize, iconSize, showArrows, frameStyle, }: ScrollSnapGalleryProps) => React.JSX.Element;
|
|
14
|
+
export default ScrollSnapGallery;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import styles from "./ScrollSnapGallery.module.scss";
|
|
3
|
+
//Icons
|
|
4
|
+
import { GoDotFill } from "react-icons/go";
|
|
5
|
+
import { BsArrowLeftCircle, BsArrowRightCircle } from "react-icons/bs";
|
|
6
|
+
const ScrollSnapGallery = ({ urls = [], width = "400px", height = "300px", IndicatorIcon = GoDotFill, positionIndicatorSize = Math.min(urls.length, 6), iconSize = 16, showArrows = false, frameStyle = {}, }) => {
|
|
7
|
+
const [currentSlide, setCurrentSlide] = useState(0);
|
|
8
|
+
const [minimumVisibleIndicator, setMinimumVisibleIndicator] = useState(0);
|
|
9
|
+
const [maximumVisibleIndicator, setMaximumVisibleIndicator] = useState(positionIndicatorSize - 1);
|
|
10
|
+
const [positionIndicatorXtranslateValue, setPositionIndicatorXtranslateValue] = useState(0);
|
|
11
|
+
const indicatorIconStyle = (index) => {
|
|
12
|
+
let className = styles["indicator-icon"];
|
|
13
|
+
if (currentSlide === index) {
|
|
14
|
+
className += ` ${styles["current"]}`;
|
|
15
|
+
}
|
|
16
|
+
const isMinimumNotFirst = minimumVisibleIndicator !== 0 && index === minimumVisibleIndicator;
|
|
17
|
+
const isMaximumNotLast = maximumVisibleIndicator !== urls.length - 1 && index === maximumVisibleIndicator;
|
|
18
|
+
if (isMinimumNotFirst || isMaximumNotLast) {
|
|
19
|
+
className += ` ${styles["full-shrunken"]}`;
|
|
20
|
+
}
|
|
21
|
+
const isOneAfterMinimumNotSecond = minimumVisibleIndicator !== 0 && index === minimumVisibleIndicator + 1;
|
|
22
|
+
const isOneBeforeMaximumNotSecond = maximumVisibleIndicator !== urls.length - 1 &&
|
|
23
|
+
index === maximumVisibleIndicator - 1;
|
|
24
|
+
if (isOneAfterMinimumNotSecond || isOneBeforeMaximumNotSecond) {
|
|
25
|
+
className += ` ${styles["medium-shrunken"]}`;
|
|
26
|
+
}
|
|
27
|
+
if (index < minimumVisibleIndicator || index > maximumVisibleIndicator) {
|
|
28
|
+
className += ` ${styles["hidden"]}`;
|
|
29
|
+
}
|
|
30
|
+
return className;
|
|
31
|
+
};
|
|
32
|
+
const handleScroll = (event) => {
|
|
33
|
+
const { scrollLeft, clientWidth } = event.target;
|
|
34
|
+
const slideWidth = clientWidth;
|
|
35
|
+
const slideIndex = Math.round(scrollLeft / slideWidth);
|
|
36
|
+
setCurrentSlide(slideIndex);
|
|
37
|
+
if (slideIndex <= minimumVisibleIndicator) {
|
|
38
|
+
const minumum = Math.max(slideIndex - 1, 0);
|
|
39
|
+
const maximum = minumum + positionIndicatorSize - 1;
|
|
40
|
+
setMinimumVisibleIndicator(minumum);
|
|
41
|
+
setMaximumVisibleIndicator(maximum);
|
|
42
|
+
}
|
|
43
|
+
else if (slideIndex >= maximumVisibleIndicator) {
|
|
44
|
+
const maximum = Math.min(slideIndex + 1, urls.length - 1);
|
|
45
|
+
const minumum = maximum - positionIndicatorSize + 1;
|
|
46
|
+
setMaximumVisibleIndicator(maximum);
|
|
47
|
+
setMinimumVisibleIndicator(minumum);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setPositionIndicatorXtranslateValue(minimumVisibleIndicator * iconSize);
|
|
52
|
+
}, [minimumVisibleIndicator]);
|
|
53
|
+
return (React.createElement("section", { className: styles["scroll-snap-gallery"] },
|
|
54
|
+
React.createElement("div", { className: styles["frame"], style: Object.assign(Object.assign({}, frameStyle), { width, height }), onScroll: handleScroll }, urls.map((url, index) => {
|
|
55
|
+
return React.createElement("img", { key: url + index, src: url, alt: "gallery item" });
|
|
56
|
+
})),
|
|
57
|
+
React.createElement("div", { className: styles["arrow-controls"] },
|
|
58
|
+
showArrows && (React.createElement(BsArrowLeftCircle, { className: styles["arrow"], onClick: () => {
|
|
59
|
+
const frame = document.querySelector(`.${styles["frame"]}`);
|
|
60
|
+
frame.scrollLeft -= frame.clientWidth;
|
|
61
|
+
} })),
|
|
62
|
+
React.createElement("div", { className: styles["position-indicator"], style: {
|
|
63
|
+
transform: `translateX(calc(50% - ${positionIndicatorXtranslateValue}px - ${(iconSize * positionIndicatorSize) / 2}px))`,
|
|
64
|
+
} }, urls.map((url, index) => (React.createElement(IndicatorIcon, { key: url + index, className: indicatorIconStyle(index), style: { width: iconSize, height: iconSize } })))),
|
|
65
|
+
showArrows && (React.createElement(BsArrowRightCircle, { className: styles["arrow"], onClick: () => {
|
|
66
|
+
const frame = document.querySelector(`.${styles["frame"]}`);
|
|
67
|
+
frame.scrollLeft += frame.clientWidth;
|
|
68
|
+
} })))));
|
|
69
|
+
};
|
|
70
|
+
export default ScrollSnapGallery;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.scroll-snap-gallery {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
.frame {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
scroll-snap-type: x mandatory;
|
|
10
|
+
scroll-snap-stop: always;
|
|
11
|
+
scroll-behavior: smooth;
|
|
12
|
+
overflow-x: auto;
|
|
13
|
+
overflow-y: hidden;
|
|
14
|
+
-webkit-overflow-scrolling: touch;
|
|
15
|
+
-ms-overflow-style: none;
|
|
16
|
+
scrollbar-width: none;
|
|
17
|
+
user-select: none;
|
|
18
|
+
&::-webkit-scrollbar {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
img {
|
|
22
|
+
scroll-snap-align: center;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
object-fit: cover;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.arrow-controls {
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
margin-top: 10px;
|
|
33
|
+
.arrow {
|
|
34
|
+
width: 24px;
|
|
35
|
+
height: 24px;
|
|
36
|
+
fill: #959595;
|
|
37
|
+
transition: all 100ms ease-in-out;
|
|
38
|
+
z-index: 2;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
&:active {
|
|
41
|
+
fill: #0d280b;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.position-indicator {
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
align-items: center;
|
|
48
|
+
transition: all 0.3s ease-in-out;
|
|
49
|
+
.indicator-icon {
|
|
50
|
+
fill: #959595;
|
|
51
|
+
transition: all 0.3s ease-in-out;
|
|
52
|
+
&.current {
|
|
53
|
+
fill: #0d280b;
|
|
54
|
+
}
|
|
55
|
+
&.medium-shrunken {
|
|
56
|
+
transform: scale(0.75);
|
|
57
|
+
}
|
|
58
|
+
&.full-shrunken {
|
|
59
|
+
transform: scale(0.5);
|
|
60
|
+
}
|
|
61
|
+
&.hidden {
|
|
62
|
+
transform: scale(0);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.trc-search-bar .div-search-bar {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
border: 1px solid rgb(185, 185, 185);
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
margin: 2px 10px;
|
|
8
|
+
padding: 5px 0px;
|
|
9
|
+
border-radius: 6px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.trc-search-bar .div-search-bar input {
|
|
13
|
+
width: 100%;
|
|
14
|
+
border: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.trc-search-bar .div-search-bar input:focus {
|
|
18
|
+
border: none;
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.trc-search-bar .div-search-bar svg {
|
|
23
|
+
width: 36px;
|
|
24
|
+
padding: 0px 10px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.trc-search-bar .div-search-bar .icono-search-bar-opciones {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
transition: all 0.5s;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.trc-search-bar .div-search-bar .icono-search-bar-opciones.icono-search-bar-opciones-desactivado {
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
color: rgb(184, 184, 184);
|
|
35
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./SearchBar.css";
|
|
3
|
+
import { SearchBarPropsType } from "./types";
|
|
4
|
+
declare const SearchBar: ({ actionOnEnter, actionOnAlteringText, actionOnEmptyText, optionsButtonVisible, actionOnClickOptionsButton, placeholder, initialValue, disabled, }: SearchBarPropsType) => React.JSX.Element;
|
|
5
|
+
export default SearchBar;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import "./SearchBar.css";
|
|
3
|
+
//Icons
|
|
4
|
+
import { BsSearch, BsSliders } from "react-icons/bs";
|
|
5
|
+
const SearchBar = ({ actionOnEnter = () => { }, actionOnAlteringText = () => { }, actionOnEmptyText = () => { }, optionsButtonVisible, actionOnClickOptionsButton = () => { }, placeholder = "", initialValue = "", disabled = false, }) => {
|
|
6
|
+
//Estados
|
|
7
|
+
const [searchValue, setSearchValue] = useState(initialValue);
|
|
8
|
+
return (React.createElement("form", { className: "trc-search-bar", onSubmit: (e) => {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
let searchElement = e.target.elements.namedItem("search-bar-name");
|
|
11
|
+
if (searchElement !== null)
|
|
12
|
+
actionOnEnter(searchElement.value);
|
|
13
|
+
} },
|
|
14
|
+
React.createElement("div", { className: "div-search-bar" },
|
|
15
|
+
React.createElement("div", null,
|
|
16
|
+
React.createElement(BsSearch, null)),
|
|
17
|
+
React.createElement("input", { name: "search-bar-name", type: "text", placeholder: placeholder, disabled: disabled, onChange: (e) => {
|
|
18
|
+
setSearchValue(e.target.value);
|
|
19
|
+
if (e.target.value)
|
|
20
|
+
actionOnAlteringText();
|
|
21
|
+
if (!e.target.value)
|
|
22
|
+
actionOnEmptyText();
|
|
23
|
+
}, value: searchValue }),
|
|
24
|
+
optionsButtonVisible && (React.createElement("div", { className: disabled
|
|
25
|
+
? "icono-search-bar-opciones icono-search-bar-opciones-disabled"
|
|
26
|
+
: "icono-search-bar-opciones", onClick: () => actionOnClickOptionsButton() },
|
|
27
|
+
React.createElement(BsSliders, null))))));
|
|
28
|
+
};
|
|
29
|
+
export default SearchBar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface SearchBarPropsType {
|
|
2
|
+
actionOnEnter?: function;
|
|
3
|
+
actionOnAlteringText?: function;
|
|
4
|
+
actionOnEmptyText?: function;
|
|
5
|
+
optionsButtonVisible: boolean;
|
|
6
|
+
actionOnClickOptionsButton?: function;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
initialValue?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.trc-side-bar {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
height: 100%;
|
|
5
|
+
z-index: 2;
|
|
6
|
+
background-color: rgb(253, 253, 253);
|
|
7
|
+
box-shadow: 0px 0px 15px 0px rgb(206 206 206);
|
|
8
|
+
transition: all 0.5s ease-in-out;
|
|
9
|
+
animation: fade-in-side-bar 1s ease-in;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.trc-side-bar .sidebar-close-button {
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 3px;
|
|
15
|
+
z-index: 2;
|
|
16
|
+
height: 30px;
|
|
17
|
+
width: 30px;
|
|
18
|
+
background-color: rgba(247, 247, 247, 0.7);
|
|
19
|
+
border-radius: 20px;
|
|
20
|
+
border: none;
|
|
21
|
+
outline: none;
|
|
22
|
+
transition: all 0.3s;
|
|
23
|
+
color: dimgray;
|
|
24
|
+
font-size: 30px;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.trc-side-bar .sidebar-close-button:hover {
|
|
32
|
+
color: var(--primary-color);
|
|
33
|
+
background-color: rgba(236, 236, 236, 0.7);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.trc-side-bar .sidebar-close-button svg.open{
|
|
37
|
+
transform: rotate(0deg);
|
|
38
|
+
transition: all 0.5s;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.trc-side-bar .sidebar-close-button svg.close{
|
|
42
|
+
transform: rotate(180deg);
|
|
43
|
+
transition: all 0.5s;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes fade-in-side-bar {
|
|
47
|
+
from {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
to {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./SideBar.css";
|
|
3
|
+
import { SideBarPropsType } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* NOTE: Parent Node must have position: relative, to work correctly with the side bar
|
|
6
|
+
*/
|
|
7
|
+
declare const SideBar: ({ side, open, children, closeAction, outBoundClickClosesSideBar, aditionalInlineStyle, }: SideBarPropsType) => React.JSX.Element;
|
|
8
|
+
export default SideBar;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
|
+
import "./SideBar.css";
|
|
3
|
+
//Hooks
|
|
4
|
+
import useOutsideClick from "../../hooks/useOutsideClick";
|
|
5
|
+
import useResizeObserver from "../../hooks/useResizeObserver";
|
|
6
|
+
//Icons
|
|
7
|
+
import { BsChevronLeft, BsChevronRight } from "react-icons/bs";
|
|
8
|
+
/**
|
|
9
|
+
* NOTE: Parent Node must have position: relative, to work correctly with the side bar
|
|
10
|
+
*/
|
|
11
|
+
const SideBar = ({ side, open = false, children, closeAction, outBoundClickClosesSideBar, aditionalInlineStyle = {}, }) => {
|
|
12
|
+
//Refs
|
|
13
|
+
const sideBarRef = useRef(null);
|
|
14
|
+
//Hooks
|
|
15
|
+
const [elementWidth] = useResizeObserver(sideBarRef);
|
|
16
|
+
useOutsideClick(sideBarRef, () => {
|
|
17
|
+
if (outBoundClickClosesSideBar)
|
|
18
|
+
if (closeAction) {
|
|
19
|
+
closeAction();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
setOpenState(false);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//useState
|
|
26
|
+
const [openState, setOpenState] = useState(open);
|
|
27
|
+
return (React.createElement("div", { ref: sideBarRef, className: "trc-side-bar", style: Object.assign({ [side === "left" ? "right" : "left"]: (closeAction && open) || (!closeAction && openState)
|
|
28
|
+
? `calc(100% - ${elementWidth}px)`
|
|
29
|
+
: closeAction
|
|
30
|
+
? "100%"
|
|
31
|
+
: `calc(100% - 30px)` }, aditionalInlineStyle) },
|
|
32
|
+
React.createElement("button", { style: side === "left" ? { right: 0 } : { left: 0 }, className: "sidebar-close-button", onClick: () => {
|
|
33
|
+
if (closeAction) {
|
|
34
|
+
closeAction();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setOpenState(!openState);
|
|
38
|
+
}
|
|
39
|
+
} }, side === "left" ? (React.createElement(BsChevronLeft, { className: (closeAction && open) || (!closeAction && openState) ? "open" : "close" })) : (React.createElement(BsChevronRight, { className: (closeAction && open) || (!closeAction && openState) ? "open" : "close" }))),
|
|
40
|
+
children));
|
|
41
|
+
};
|
|
42
|
+
export default SideBar;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.trc-slider {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.trc-slider.disabled{
|
|
7
|
+
opacity: 0.7;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.trc-slider .left-fill {
|
|
11
|
+
border: 2px solid rgb(216, 216, 216);
|
|
12
|
+
background-color: var(--secondary-color);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.trc-slider .right-fill {
|
|
16
|
+
border: 2px solid rgb(216, 216, 216);
|
|
17
|
+
background-color: rgb(211, 211, 211);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.trc-slider .sphere {
|
|
21
|
+
border-radius: 100%;
|
|
22
|
+
box-shadow: 0px 0px 20px 2px #a7a7a7;
|
|
23
|
+
background-color: rgb(255, 255, 255);
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
cursor: grab;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.trc-slider .sphere p {
|
|
32
|
+
margin: 0;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
color: #757575;
|
|
36
|
+
width: 25%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.trc-slider .sphere input {
|
|
40
|
+
width: 70%;
|
|
41
|
+
border: none;
|
|
42
|
+
background-color: transparent;
|
|
43
|
+
text-align: right;
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
color: #757575;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.trc-slider .sphere input::-webkit-inner-spin-button {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.trc-slider .sphere input:focus {
|
|
54
|
+
outline: none;
|
|
55
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./Slider.css";
|
|
3
|
+
import { SliderPropsType } from "./types";
|
|
4
|
+
declare const Slider: ({ minimumValue, maximumValue, onChange, initialValue, value, showValueInsideButton, editableValueInsideButton, height, width, sufix, prefix, disabled, }: SliderPropsType) => React.JSX.Element;
|
|
5
|
+
export default Slider;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, Fragment } from "react";
|
|
2
|
+
import * as ownFunctions from "./SliderOwnFunctions";
|
|
3
|
+
import "./Slider.css";
|
|
4
|
+
const Slider = ({ minimumValue, maximumValue, onChange, initialValue = 0, value, showValueInsideButton, editableValueInsideButton, height = 40, width = 300, sufix, prefix, disabled, }) => {
|
|
5
|
+
//Refs
|
|
6
|
+
const sliderRef = useRef(null);
|
|
7
|
+
//Estados
|
|
8
|
+
const [position, setPosition] = useState(initialValue !== undefined
|
|
9
|
+
? ownFunctions.definePostionByValue(initialValue, width, maximumValue, minimumValue)
|
|
10
|
+
: width / 2);
|
|
11
|
+
const [visibleValue, setVisibleValue] = useState(initialValue);
|
|
12
|
+
const [temporalVisibleValue, setTemporalVisibleValue] = useState(undefined);
|
|
13
|
+
const [cancelTransition, setCancelTransition] = useState(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (value !== undefined) {
|
|
16
|
+
setVisibleValue(value);
|
|
17
|
+
setPosition(ownFunctions.definePostionByValue(value, width, maximumValue, minimumValue));
|
|
18
|
+
}
|
|
19
|
+
}, [value, width, maximumValue, minimumValue]);
|
|
20
|
+
return (React.createElement("div", { ref: sliderRef, style: { width: width, height: height }, className: `trc-slider ${disabled ? "disabled" : ""}`, onMouseDown: (event1) => {
|
|
21
|
+
if (!disabled) {
|
|
22
|
+
var nuevovisibleValue;
|
|
23
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
24
|
+
setCancelTransition(false);
|
|
25
|
+
const newPosition = event1.clientX - sliderRef.current.getBoundingClientRect().x;
|
|
26
|
+
setPosition(newPosition);
|
|
27
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
28
|
+
setVisibleValue(nuevovisibleValue);
|
|
29
|
+
}
|
|
30
|
+
function repositioning(event2) {
|
|
31
|
+
setCancelTransition(true);
|
|
32
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
33
|
+
setTemporalVisibleValue(undefined);
|
|
34
|
+
let newPosition = event2.clientX - sliderRef.current.getBoundingClientRect().x;
|
|
35
|
+
if (newPosition < 0)
|
|
36
|
+
newPosition = 0;
|
|
37
|
+
if (newPosition > width)
|
|
38
|
+
newPosition = width;
|
|
39
|
+
setPosition(newPosition);
|
|
40
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
41
|
+
setVisibleValue(nuevovisibleValue);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
document.addEventListener("mousemove", repositioning);
|
|
45
|
+
function removeEventListeners() {
|
|
46
|
+
document.removeEventListener("mousemove", repositioning);
|
|
47
|
+
document.removeEventListener("mouseup", removeEventListeners);
|
|
48
|
+
setCancelTransition(false);
|
|
49
|
+
onChange(nuevovisibleValue);
|
|
50
|
+
}
|
|
51
|
+
document.addEventListener("mouseup", removeEventListeners);
|
|
52
|
+
}
|
|
53
|
+
}, onTouchStart: (event1) => {
|
|
54
|
+
if (!disabled) {
|
|
55
|
+
var nuevovisibleValue;
|
|
56
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
57
|
+
setCancelTransition(false);
|
|
58
|
+
const newPosition = event1.touches[0].clientX - sliderRef.current.getBoundingClientRect().x;
|
|
59
|
+
setPosition(newPosition);
|
|
60
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
61
|
+
setVisibleValue(nuevovisibleValue);
|
|
62
|
+
}
|
|
63
|
+
function repositioning(event2) {
|
|
64
|
+
setCancelTransition(true);
|
|
65
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
66
|
+
setTemporalVisibleValue(undefined);
|
|
67
|
+
let newPosition = event2.touches[0].clientX - sliderRef.current.getBoundingClientRect().x;
|
|
68
|
+
if (newPosition < 0)
|
|
69
|
+
newPosition = 0;
|
|
70
|
+
if (newPosition > width)
|
|
71
|
+
newPosition = width;
|
|
72
|
+
setPosition(newPosition);
|
|
73
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
74
|
+
setVisibleValue(nuevovisibleValue);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
document.addEventListener("touchmove", repositioning);
|
|
78
|
+
function removeEventListeners() {
|
|
79
|
+
document.removeEventListener("touchmove", repositioning);
|
|
80
|
+
document.removeEventListener("touchend", removeEventListeners);
|
|
81
|
+
setCancelTransition(false);
|
|
82
|
+
onChange(nuevovisibleValue);
|
|
83
|
+
}
|
|
84
|
+
document.addEventListener("touchend", removeEventListeners);
|
|
85
|
+
}
|
|
86
|
+
} },
|
|
87
|
+
React.createElement("div", { style: {
|
|
88
|
+
width: position,
|
|
89
|
+
height: height * 0.8,
|
|
90
|
+
borderTopLeftRadius: (height * 0.8) / 2,
|
|
91
|
+
borderBottomLeftRadius: (height * 0.8) / 2,
|
|
92
|
+
marginRight: -height / 2,
|
|
93
|
+
transition: cancelTransition ? "none" : "all 0.3s",
|
|
94
|
+
}, className: "left-fill" }),
|
|
95
|
+
React.createElement("div", { style: { width: height, height: height }, className: "sphere" }, showValueInsideButton && (React.createElement(Fragment, null,
|
|
96
|
+
prefix !== undefined && React.createElement("p", null, prefix),
|
|
97
|
+
React.createElement("input", { disabled: !editableValueInsideButton || disabled, type: "number", min: minimumValue, max: maximumValue, value: temporalVisibleValue !== undefined ? temporalVisibleValue : visibleValue, onChange: (event) => {
|
|
98
|
+
setTemporalVisibleValue(Number(event.target.value));
|
|
99
|
+
}, onFocus: () => {
|
|
100
|
+
setTemporalVisibleValue(visibleValue);
|
|
101
|
+
}, onKeyDown: (event) => {
|
|
102
|
+
if (!disabled) {
|
|
103
|
+
if (event.key === "Enter" && temporalVisibleValue !== undefined) {
|
|
104
|
+
let nuevovalue = temporalVisibleValue;
|
|
105
|
+
if (nuevovalue < minimumValue)
|
|
106
|
+
nuevovalue = minimumValue;
|
|
107
|
+
if (nuevovalue > maximumValue)
|
|
108
|
+
nuevovalue = maximumValue;
|
|
109
|
+
const newPosition = ownFunctions.definePostionByValue(nuevovalue, width, maximumValue, minimumValue);
|
|
110
|
+
setPosition(newPosition);
|
|
111
|
+
const nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
112
|
+
setVisibleValue(nuevovisibleValue);
|
|
113
|
+
onChange(nuevovisibleValue);
|
|
114
|
+
setTemporalVisibleValue(undefined);
|
|
115
|
+
}
|
|
116
|
+
if (event.key === "Escape") {
|
|
117
|
+
setPosition(ownFunctions.definePostionByValue(visibleValue, width, maximumValue, minimumValue));
|
|
118
|
+
setTemporalVisibleValue(undefined);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, onBlur: () => {
|
|
122
|
+
if (!disabled) {
|
|
123
|
+
if (temporalVisibleValue !== undefined) {
|
|
124
|
+
let nuevovalue = temporalVisibleValue;
|
|
125
|
+
if (nuevovalue < minimumValue)
|
|
126
|
+
nuevovalue = minimumValue;
|
|
127
|
+
if (nuevovalue > maximumValue)
|
|
128
|
+
nuevovalue = maximumValue;
|
|
129
|
+
const newPosition = ownFunctions.definePostionByValue(nuevovalue, width, maximumValue, minimumValue);
|
|
130
|
+
setPosition(newPosition);
|
|
131
|
+
const nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
132
|
+
setVisibleValue(nuevovisibleValue);
|
|
133
|
+
onChange(nuevovisibleValue);
|
|
134
|
+
setTemporalVisibleValue(undefined);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} }),
|
|
138
|
+
sufix !== undefined && React.createElement("p", null, sufix)))),
|
|
139
|
+
React.createElement("div", { style: {
|
|
140
|
+
width: width - position,
|
|
141
|
+
height: height * 0.8,
|
|
142
|
+
borderTopRightRadius: (height * 0.8) / 2,
|
|
143
|
+
borderBottomRightRadius: (height * 0.8) / 2,
|
|
144
|
+
marginLeft: -height / 2,
|
|
145
|
+
transition: cancelTransition ? "none" : "all 0.3s",
|
|
146
|
+
}, className: "right-fill" })));
|
|
147
|
+
};
|
|
148
|
+
export default Slider;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function defineVisibleValue(posicion, ancho, valorMaximo, valorMinimo) {
|
|
2
|
+
return Math.round((posicion / (ancho)) * (valorMaximo - valorMinimo) + valorMinimo);
|
|
3
|
+
}
|
|
4
|
+
export function definePostionByValue(nuevoValor, ancho, valorMaximo, valorMinimo) {
|
|
5
|
+
return ((nuevoValor - valorMinimo) / (valorMaximo - valorMinimo)) * (ancho);
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SliderPropsType {
|
|
2
|
+
minimumValue: number;
|
|
3
|
+
maximumValue: number;
|
|
4
|
+
onChange: (newValue: number) => void;
|
|
5
|
+
initialValue?: number;
|
|
6
|
+
value?: number;
|
|
7
|
+
showValueInsideButton?: boolean;
|
|
8
|
+
editableValueInsideButton?: boolean;
|
|
9
|
+
height?: number;
|
|
10
|
+
width?: number;
|
|
11
|
+
sufix?: string;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to observe an element's intersection
|
|
4
|
+
* @param ref ref to the element to observe
|
|
5
|
+
* @param options intersection observer options
|
|
6
|
+
* @returns a boolean indicating if the element is intersecting
|
|
7
|
+
*/
|
|
8
|
+
declare function useIntersectionObserver(ref: RefObject<Element>, options?: IntersectionObserverInit | undefined): boolean;
|
|
9
|
+
export default useIntersectionObserver;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState, useRef } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to observe an element's intersection
|
|
4
|
+
* @param ref ref to the element to observe
|
|
5
|
+
* @param options intersection observer options
|
|
6
|
+
* @returns a boolean indicating if the element is intersecting
|
|
7
|
+
*/
|
|
8
|
+
function useIntersectionObserver(ref, options) {
|
|
9
|
+
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
10
|
+
const observer = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (observer.current)
|
|
13
|
+
observer.current.disconnect();
|
|
14
|
+
observer.current = new IntersectionObserver(([entry]) => {
|
|
15
|
+
setIsIntersecting(entry.isIntersecting);
|
|
16
|
+
}, options);
|
|
17
|
+
if (ref.current)
|
|
18
|
+
observer.current.observe(ref.current);
|
|
19
|
+
return () => {
|
|
20
|
+
if (observer.current)
|
|
21
|
+
observer.current.disconnect();
|
|
22
|
+
};
|
|
23
|
+
}, [ref, options]);
|
|
24
|
+
return isIntersecting;
|
|
25
|
+
}
|
|
26
|
+
export default useIntersectionObserver;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
function useOutsideClick(elementRef, onOutsideClickAction, elementsRefsExceptions = []) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
function handleClickOutside(event) {
|
|
5
|
+
if (elementRef.current &&
|
|
6
|
+
!elementRef.current.contains(event.target) &&
|
|
7
|
+
elementsRefsExceptions.every((elementRefException) => elementRefException.current !== event.target)) {
|
|
8
|
+
onOutsideClickAction();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
12
|
+
return () => {
|
|
13
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
14
|
+
};
|
|
15
|
+
}, [elementRef, onOutsideClickAction, elementsRefsExceptions]);
|
|
16
|
+
}
|
|
17
|
+
export default useOutsideClick;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @returns Array [elementWidth, elementHeight], that represent the current
|
|
4
|
+
* values of width and height of elementRef
|
|
5
|
+
*/
|
|
6
|
+
declare function useResizeObserver(elementRef: React.MutableRefObject<HTMLElement | null>): number[];
|
|
7
|
+
export default useResizeObserver;
|