@elliemae/ds-controlled-form 2.0.0-alpha.1 → 2.0.0-alpha.13
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/cjs/controlled-checkbox/ControlledCheckbox.js +13 -6
- package/cjs/controlled-checkbox/config/useValidateProps.js +5 -7
- package/cjs/controlled-checkbox/propTypes.js +5 -4
- package/cjs/controlled-checkbox/styles.js +88 -52
- package/cjs/controlled-checkbox/utils/setMultipleRefs.js +4 -0
- package/cjs/controlled-checkbox/utils/styleHelpers.js +15 -27
- package/cjs/controlled-date-range-picker/ControlledDateRangePicker.js +2 -2
- package/cjs/controlled-date-range-picker/ControlledDateRangePickerCTX.js +3 -2
- package/cjs/controlled-date-range-picker/ControlledDateRangePickerDatatestid.js +1 -18
- package/cjs/controlled-date-range-picker/config/useControlledDateRangePicker.js +19 -3
- package/cjs/controlled-date-range-picker/config/useRangePickerLogic.js +22 -13
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeCalendar.js +9 -1
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeContent.js +30 -5
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeFromDate.js +13 -3
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeToDate.js +9 -1
- package/cjs/controlled-date-time-picker/ControlledDateTimePicker.js +2 -2
- package/cjs/controlled-date-time-picker/ControlledDateTimePickerCTX.js +23 -2
- package/cjs/controlled-date-time-picker/ControlledDateTimePickerDatatestid.js +31 -4
- package/cjs/controlled-date-time-picker/config/useControlledDateTimePicker.js +254 -36
- package/cjs/controlled-date-time-picker/config/useGetDestructuredValues.js +149 -0
- package/cjs/controlled-date-time-picker/config/useValidateProps.js +10 -41
- package/cjs/controlled-date-time-picker/index.js +1 -1
- package/cjs/controlled-date-time-picker/parts/ClearButton/ClearButton.js +11 -9
- package/cjs/controlled-date-time-picker/parts/ClearButton/useClearButton.js +48 -3
- package/cjs/controlled-date-time-picker/parts/ControlledDateTimePickerContent.js +37 -16
- package/cjs/controlled-date-time-picker/parts/DateInputs/DDInput.js +16 -11
- package/cjs/controlled-date-time-picker/parts/DateInputs/DateInputs.js +21 -11
- package/cjs/controlled-date-time-picker/parts/DateInputs/MMInput.js +18 -11
- package/cjs/controlled-date-time-picker/parts/DateInputs/YYYYInput.js +16 -11
- package/cjs/controlled-date-time-picker/parts/DateInputs/useDateInputs.js +117 -66
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Calendar.js +9 -8
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarBody.js +10 -4
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContent.js +15 -9
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContext.js +7 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +33 -9
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarFooter.js +3 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarHead.js +43 -44
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +13 -12
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +7 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWeekDays.js +34 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +10 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Day.js +59 -28
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +339 -115
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +42 -42
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +48 -23
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +135 -59
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +26 -14
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheel.js +4 -4
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +5 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +4 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +3 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +13 -12
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +10 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.js +61 -24
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +23 -8
- package/cjs/controlled-date-time-picker/parts/Pickers/PickersIcons.js +3 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/HoursList.js +38 -26
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +34 -31
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +36 -26
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +26 -23
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +211 -150
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +9 -8
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +9 -6
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +5 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelFooter.js +3 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +12 -12
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +10 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +10 -58
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +11 -8
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +184 -147
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +23 -12
- package/cjs/controlled-date-time-picker/parts/Styleds.js +80 -42
- package/cjs/controlled-date-time-picker/parts/TimeInputs/HHInput.js +18 -11
- package/cjs/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.js +17 -11
- package/cjs/controlled-date-time-picker/parts/TimeInputs/MinutesInput.js +16 -11
- package/cjs/controlled-date-time-picker/parts/TimeInputs/TimeInputs.js +20 -11
- package/cjs/controlled-date-time-picker/parts/TimeInputs/useTimeInputs.js +109 -205
- package/cjs/controlled-date-time-picker/propTypes.js +3 -1
- package/cjs/controlled-date-time-picker/utils/constants.js +59 -0
- package/cjs/controlled-date-time-picker/utils/dateHelpers.js +41 -23
- package/cjs/controlled-date-time-picker/utils/dateTimeHelpers.js +8 -3
- package/cjs/controlled-date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +1 -1
- package/cjs/controlled-date-time-picker/utils/stringHelpers.js +43 -17
- package/cjs/controlled-date-time-picker/utils/timeHelpers.js +2 -1
- package/cjs/controlled-toggle/ControlledToggle.js +52 -36
- package/cjs/controlled-toggle/propTypes.js +3 -2
- package/cjs/controlled-toggle/styles.js +146 -79
- package/cjs/controlled-toggle/utils/addTooltipOnReadOnly.js +2 -2
- package/cjs/controlled-toggle/utils/styleHelpers.js +15 -9
- package/cjs/index.js +1 -1
- package/esm/controlled-checkbox/ControlledCheckbox.js +12 -5
- package/esm/controlled-checkbox/config/useValidateProps.js +6 -8
- package/esm/controlled-checkbox/propTypes.js +5 -4
- package/esm/controlled-checkbox/styles.js +84 -48
- package/esm/controlled-checkbox/utils/setMultipleRefs.js +4 -0
- package/esm/controlled-checkbox/utils/styleHelpers.js +15 -27
- package/esm/controlled-date-range-picker/ControlledDateRangePickerCTX.js +2 -1
- package/esm/controlled-date-range-picker/ControlledDateRangePickerDatatestid.js +1 -18
- package/esm/controlled-date-range-picker/config/useControlledDateRangePicker.js +15 -3
- package/esm/controlled-date-range-picker/config/useRangePickerLogic.js +21 -12
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeCalendar.js +8 -0
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeContent.js +28 -4
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeFromDate.js +12 -2
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeToDate.js +8 -0
- package/esm/controlled-date-time-picker/ControlledDateTimePickerCTX.js +22 -1
- package/esm/controlled-date-time-picker/ControlledDateTimePickerDatatestid.js +31 -4
- package/esm/controlled-date-time-picker/config/useControlledDateTimePicker.js +254 -36
- package/esm/controlled-date-time-picker/config/useGetDestructuredValues.js +143 -0
- package/esm/controlled-date-time-picker/config/useValidateProps.js +10 -41
- package/esm/controlled-date-time-picker/index.js +1 -1
- package/esm/controlled-date-time-picker/parts/ClearButton/ClearButton.js +10 -7
- package/esm/controlled-date-time-picker/parts/ClearButton/useClearButton.js +48 -3
- package/esm/controlled-date-time-picker/parts/ControlledDateTimePickerContent.js +34 -14
- package/esm/controlled-date-time-picker/parts/DateInputs/DDInput.js +16 -11
- package/esm/controlled-date-time-picker/parts/DateInputs/DateInputs.js +15 -5
- package/esm/controlled-date-time-picker/parts/DateInputs/MMInput.js +18 -11
- package/esm/controlled-date-time-picker/parts/DateInputs/YYYYInput.js +16 -11
- package/esm/controlled-date-time-picker/parts/DateInputs/useDateInputs.js +119 -67
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Calendar.js +4 -3
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarBody.js +10 -4
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContent.js +16 -10
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContext.js +6 -0
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +35 -11
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarFooter.js +3 -1
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarHead.js +42 -39
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +13 -10
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +6 -2
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWeekDays.js +35 -3
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +7 -0
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Day.js +58 -28
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +335 -113
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +43 -43
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +49 -24
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +136 -60
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +27 -15
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +3 -1
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +3 -1
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +3 -1
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +13 -10
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +7 -0
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.js +60 -24
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +23 -8
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/HoursList.js +33 -19
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +30 -25
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +30 -18
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +20 -15
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +210 -150
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +4 -3
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +8 -5
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +4 -1
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelFooter.js +3 -1
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +12 -10
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +7 -0
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +10 -58
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +11 -8
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +185 -148
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +24 -13
- package/esm/controlled-date-time-picker/parts/Styleds.js +70 -31
- package/esm/controlled-date-time-picker/parts/TimeInputs/HHInput.js +18 -11
- package/esm/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.js +17 -11
- package/esm/controlled-date-time-picker/parts/TimeInputs/MinutesInput.js +16 -11
- package/esm/controlled-date-time-picker/parts/TimeInputs/TimeInputs.js +15 -6
- package/esm/controlled-date-time-picker/parts/TimeInputs/useTimeInputs.js +110 -202
- package/esm/controlled-date-time-picker/propTypes.js +3 -1
- package/esm/controlled-date-time-picker/utils/constants.js +46 -0
- package/esm/controlled-date-time-picker/utils/dateHelpers.js +40 -23
- package/esm/controlled-date-time-picker/utils/dateTimeHelpers.js +7 -2
- package/esm/controlled-date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +1 -1
- package/esm/controlled-date-time-picker/utils/stringHelpers.js +43 -18
- package/esm/controlled-date-time-picker/utils/timeHelpers.js +2 -1
- package/esm/controlled-toggle/ControlledToggle.js +47 -31
- package/esm/controlled-toggle/propTypes.js +3 -2
- package/esm/controlled-toggle/styles.js +139 -72
- package/esm/controlled-toggle/utils/addTooltipOnReadOnly.js +1 -1
- package/esm/controlled-toggle/utils/styleHelpers.js +15 -9
- package/esm/index.js +1 -1
- package/package.json +29 -12
- package/types/controlled-checkbox/ControlledCheckbox.d.ts +60 -9
- package/types/controlled-checkbox/config/useValidateProps.d.ts +1 -1
- package/types/controlled-checkbox/index.d.d.ts +1 -0
- package/types/controlled-checkbox/propTypes.d.ts +55 -8
- package/types/controlled-checkbox/styles.d.ts +4 -4
- package/types/controlled-checkbox/tests/DSControlledCheckbox.keyboard.test.d.ts +1 -0
- package/types/controlled-checkbox/tests/DSControlledCheckbox.test.d.ts +1 -0
- package/types/controlled-checkbox/tests/DSControllledCheckbox.events.test.d.ts +1 -0
- package/types/controlled-date-range-picker/ControlledDateRangePicker.d.ts +12 -2
- package/types/controlled-date-range-picker/ControlledDateRangePickerDatatestid.d.ts +1 -18
- package/types/controlled-date-range-picker/propTypes.d.ts +7 -1
- package/types/controlled-date-range-picker/tests/date-range-picker.auto-advance.test.d.ts +1 -0
- package/types/controlled-date-range-picker/tests/date-range-picker.classes.test.d.ts +1 -0
- package/types/controlled-date-range-picker/tests/date-range-picker.clear-button.test.d.ts +1 -0
- package/types/controlled-date-range-picker/tests/date-range-picker.keyboard-focus.test.d.ts +1 -0
- package/types/controlled-date-range-picker/tests/date-range-picker.manual-delete-values.test.d.ts +1 -0
- package/types/controlled-date-range-picker/tests/date-range-picker.types-dom.test.d.ts +1 -0
- package/types/controlled-date-time-picker/ControlledDateTimePicker.d.ts +84 -21
- package/types/controlled-date-time-picker/ControlledDateTimePickerDatatestid.d.ts +28 -3
- package/types/controlled-date-time-picker/config/useGetDestructuredValues.d.ts +4 -0
- package/types/controlled-date-time-picker/index.d.ts +1 -1
- package/types/controlled-date-time-picker/parts/ClearButton/useClearButton.d.ts +2 -1
- package/types/controlled-date-time-picker/parts/DateInputs/DDInput.d.ts +3 -1
- package/types/controlled-date-time-picker/parts/DateInputs/MMInput.d.ts +4 -1
- package/types/controlled-date-time-picker/parts/DateInputs/YYYYInput.d.ts +3 -1
- package/types/controlled-date-time-picker/parts/DateInputs/useDateInputs.d.ts +0 -9
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/CalendarBody.d.ts +5 -1
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContext.d.ts +11 -5
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.d.ts +5 -3
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/Day.d.ts +5 -3
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.d.ts +17 -123
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +3 -5
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.d.ts +5 -18
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +4 -7
- package/types/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.d.ts +2 -0
- package/types/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +7 -3
- package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.d.ts +19 -9
- package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.d.ts +3 -0
- package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +3 -11
- package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +1 -8
- package/types/controlled-date-time-picker/parts/Styleds.d.ts +13 -10
- package/types/controlled-date-time-picker/parts/TimeInputs/HHInput.d.ts +4 -1
- package/types/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +3 -1
- package/types/controlled-date-time-picker/parts/TimeInputs/MinutesInput.d.ts +3 -1
- package/types/controlled-date-time-picker/propTypes.d.ts +79 -20
- package/types/controlled-date-time-picker/tests/date-time-picker.keyboard-focus.test.d.ts +1 -0
- package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.data-entry-typing.test.d.ts +1 -0
- package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.fill-with-now.test.d.ts +1 -0
- package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.regressive-backspace.test.d.ts +1 -0
- package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.shortcut-clear.test.d.ts +1 -0
- package/types/controlled-date-time-picker/utils/constants.d.ts +44 -0
- package/types/controlled-date-time-picker/utils/dateHelpers.d.ts +3 -2
- package/types/controlled-date-time-picker/utils/dateTimeHelpers.d.ts +1 -1
- package/types/controlled-date-time-picker/utils/stringHelpers.d.ts +1 -0
- package/types/controlled-toggle/ControlledToggle.d.ts +79 -13
- package/types/controlled-toggle/propTypes.d.ts +73 -11
- package/types/controlled-toggle/styles.d.ts +7 -7
- package/cjs/controlled-date-time-picker/parts/TimeInputs/SSInput.js +0 -53
- package/cjs/package.json +0 -7
- package/esm/controlled-date-time-picker/parts/TimeInputs/SSInput.js +0 -45
- package/esm/package.json +0 -7
- package/types/controlled-date-time-picker/parts/TimeInputs/SSInput.d.ts +0 -13
|
@@ -3,36 +3,52 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
7
|
+
var constants = require('../../../utils/constants.js');
|
|
6
8
|
|
|
7
9
|
/* eslint-disable @typescript-eslint/indent */
|
|
8
|
-
const useKeyboardHandlers =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
const useKeyboardHandlers = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
handlePrevHour,
|
|
13
|
+
handleNextHour,
|
|
14
|
+
handlePrevMinute,
|
|
15
|
+
handleNextMinute,
|
|
16
|
+
handleTimeWheelBtnChangeMeridiem
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
withAnyInputs,
|
|
20
|
+
isWithTimeInputs,
|
|
21
|
+
isWithDateInputs,
|
|
22
|
+
isWithCalendarToo,
|
|
23
|
+
isControllerOnly,
|
|
24
|
+
hideDate,
|
|
25
|
+
hideTime,
|
|
26
|
+
monthInputRef,
|
|
27
|
+
hourInputRef,
|
|
28
|
+
meridiemInputRef,
|
|
29
|
+
yearInputRef,
|
|
30
|
+
prevMonthBtnRef,
|
|
31
|
+
prevHourBtnRef,
|
|
32
|
+
currHourBtnRef,
|
|
33
|
+
nextHourBtnRef,
|
|
34
|
+
prevMinutesBtnRef,
|
|
35
|
+
currMinutesBtnRef,
|
|
36
|
+
nextMinutesBtnRef,
|
|
37
|
+
prevMeridiemBtnRef,
|
|
38
|
+
currMeridiemBtnRef,
|
|
39
|
+
nextMeridiemBtnRef
|
|
40
|
+
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
41
|
+
const onHomeKeyDownInsideTimeWheel = React.useCallback(() => {
|
|
42
|
+
var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2, _currHourBtnRef$curre, _currHourBtnRef$curre2;
|
|
43
|
+
|
|
44
|
+
if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr === void 0 ? void 0 : (_prevMonthBtnRef$curr2 = _prevMonthBtnRef$curr.focus) === null || _prevMonthBtnRef$curr2 === void 0 ? void 0 : _prevMonthBtnRef$curr2.call(_prevMonthBtnRef$curr);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
|
|
45
|
+
}, [currHourBtnRef, isWithCalendarToo, prevMonthBtnRef]);
|
|
46
|
+
const onEndKeyDownInsideTimeWheel = React.useCallback(() => {
|
|
47
|
+
var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
|
|
48
|
+
|
|
49
|
+
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c === void 0 ? void 0 : (_currMeridiemBtnRef$c2 = _currMeridiemBtnRef$c.focus) === null || _currMeridiemBtnRef$c2 === void 0 ? void 0 : _currMeridiemBtnRef$c2.call(_currMeridiemBtnRef$c);
|
|
50
|
+
}, [currMeridiemBtnRef]);
|
|
51
|
+
const onHomeKeyDownTriggerIcon = React.useCallback(() => {
|
|
36
52
|
var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
|
|
37
53
|
|
|
38
54
|
if (!hideDate) monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren = monthInputRef.current) === null || _monthInputRef$curren === void 0 ? void 0 : (_monthInputRef$curren2 = _monthInputRef$curren.focus) === null || _monthInputRef$curren2 === void 0 ? void 0 : _monthInputRef$curren2.call(_monthInputRef$curren);else if (!hideTime) hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current = hourInputRef.current) === null || _hourInputRef$current === void 0 ? void 0 : (_hourInputRef$current2 = _hourInputRef$current.focus) === null || _hourInputRef$current2 === void 0 ? void 0 : _hourInputRef$current2.call(_hourInputRef$current);
|
|
@@ -41,256 +57,283 @@ const useKeyboardHandlers = ({
|
|
|
41
57
|
const {
|
|
42
58
|
key
|
|
43
59
|
} = e;
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
if (key === 'Home')
|
|
47
|
-
|
|
60
|
+
if (constants.homeEndKeys.includes(key)) e.preventDefault();
|
|
61
|
+
if (constants.homeEndKeys.includes(key)) e.stopPropagation();
|
|
62
|
+
if (key === 'Home') onHomeKeyDownTriggerIcon();
|
|
63
|
+
|
|
64
|
+
if (key === 'Backspace' && withAnyInputs) {
|
|
65
|
+
var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
|
|
66
|
+
|
|
67
|
+
if (isWithTimeInputs) meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur = meridiemInputRef.current) === null || _meridiemInputRef$cur === void 0 ? void 0 : (_meridiemInputRef$cur2 = _meridiemInputRef$cur.focus) === null || _meridiemInputRef$cur2 === void 0 ? void 0 : _meridiemInputRef$cur2.call(_meridiemInputRef$cur);else if (isWithDateInputs) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current = yearInputRef.current) === null || _yearInputRef$current === void 0 ? void 0 : (_yearInputRef$current2 = _yearInputRef$current.focus) === null || _yearInputRef$current2 === void 0 ? void 0 : _yearInputRef$current2.call(_yearInputRef$current);
|
|
68
|
+
}
|
|
69
|
+
}, [isWithDateInputs, isWithTimeInputs, meridiemInputRef, onHomeKeyDownTriggerIcon, withAnyInputs, yearInputRef]);
|
|
48
70
|
const handleCurrHourOnKeyDown = React.useCallback(e => {
|
|
49
71
|
const {
|
|
50
72
|
key,
|
|
51
73
|
shiftKey
|
|
52
74
|
} = e;
|
|
75
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
76
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
53
77
|
let didTriggerHourChange = false;
|
|
54
78
|
|
|
55
79
|
if (key === 'ArrowUp') {
|
|
56
80
|
handlePrevHour(e);
|
|
57
81
|
didTriggerHourChange = true;
|
|
58
|
-
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (key === 'ArrowDown') {
|
|
59
85
|
handleNextHour(e);
|
|
60
86
|
didTriggerHourChange = true;
|
|
61
|
-
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (key === 'ArrowRight') {
|
|
62
90
|
var _currMinutesBtnRef$cu, _currMinutesBtnRef$cu2;
|
|
63
91
|
|
|
64
92
|
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu === void 0 ? void 0 : (_currMinutesBtnRef$cu2 = _currMinutesBtnRef$cu.focus) === null || _currMinutesBtnRef$cu2 === void 0 ? void 0 : _currMinutesBtnRef$cu2.call(_currMinutesBtnRef$cu);
|
|
65
|
-
}
|
|
66
|
-
var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
|
|
67
|
-
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c === void 0 ? void 0 : (_currMeridiemBtnRef$c2 = _currMeridiemBtnRef$c.focus) === null || _currMeridiemBtnRef$c2 === void 0 ? void 0 : _currMeridiemBtnRef$c2.call(_currMeridiemBtnRef$c);
|
|
70
|
-
} // ensure the focus is in the correct button after up/down arrow
|
|
93
|
+
}
|
|
71
94
|
|
|
95
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
96
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
|
|
72
97
|
|
|
73
98
|
if (didTriggerHourChange) setTimeout(() => {
|
|
74
|
-
var _currHourBtnRef$
|
|
99
|
+
var _currHourBtnRef$curre3, _currHourBtnRef$curre4;
|
|
75
100
|
|
|
76
|
-
return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$
|
|
77
|
-
});
|
|
78
|
-
|
|
101
|
+
return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre3 = currHourBtnRef.current) === null || _currHourBtnRef$curre3 === void 0 ? void 0 : (_currHourBtnRef$curre4 = _currHourBtnRef$curre3.focus) === null || _currHourBtnRef$curre4 === void 0 ? void 0 : _currHourBtnRef$curre4.call(_currHourBtnRef$curre3);
|
|
102
|
+
}); // TAB CYCLE IMPLEMENTATION
|
|
103
|
+
|
|
104
|
+
if (!isControllerOnly) if (key === 'Tab' && shiftKey && !isWithCalendarToo) {
|
|
105
|
+
var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
|
|
106
|
+
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c3 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c3 === void 0 ? void 0 : (_currMeridiemBtnRef$c4 = _currMeridiemBtnRef$c3.focus) === null || _currMeridiemBtnRef$c4 === void 0 ? void 0 : _currMeridiemBtnRef$c4.call(_currMeridiemBtnRef$c3);
|
|
109
|
+
}
|
|
110
|
+
}, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleNextHour, handlePrevHour, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
79
111
|
const handleCurrMinutesOnKeyDown = React.useCallback(e => {
|
|
80
112
|
const {
|
|
81
113
|
key
|
|
82
114
|
} = e;
|
|
115
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
116
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
83
117
|
let didTriggerMinuteChange = false;
|
|
84
118
|
|
|
85
119
|
if (key === 'ArrowUp') {
|
|
86
120
|
handlePrevMinute(e);
|
|
87
121
|
didTriggerMinuteChange = true;
|
|
88
|
-
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (key === 'ArrowDown') {
|
|
89
125
|
handleNextMinute(e);
|
|
90
126
|
didTriggerMinuteChange = true;
|
|
91
|
-
}
|
|
92
|
-
var _currHourBtnRef$curre3, _currHourBtnRef$curre4;
|
|
127
|
+
}
|
|
93
128
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
|
|
129
|
+
if (key === 'ArrowLeft') {
|
|
130
|
+
var _currHourBtnRef$curre5, _currHourBtnRef$curre6;
|
|
97
131
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
} // ensure the focus is in the correct button after up/down arrow
|
|
132
|
+
currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre5 = currHourBtnRef.current) === null || _currHourBtnRef$curre5 === void 0 ? void 0 : (_currHourBtnRef$curre6 = _currHourBtnRef$curre5.focus) === null || _currHourBtnRef$curre6 === void 0 ? void 0 : _currHourBtnRef$curre6.call(_currHourBtnRef$curre5);
|
|
133
|
+
}
|
|
101
134
|
|
|
135
|
+
if (key === 'ArrowRight') {
|
|
136
|
+
var _currMeridiemBtnRef$c5, _currMeridiemBtnRef$c6;
|
|
137
|
+
|
|
138
|
+
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c5 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c5 === void 0 ? void 0 : (_currMeridiemBtnRef$c6 = _currMeridiemBtnRef$c5.focus) === null || _currMeridiemBtnRef$c6 === void 0 ? void 0 : _currMeridiemBtnRef$c6.call(_currMeridiemBtnRef$c5);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
142
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
|
|
102
143
|
|
|
103
144
|
if (didTriggerMinuteChange) setTimeout(() => {
|
|
104
145
|
var _currMinutesBtnRef$cu3, _currMinutesBtnRef$cu4;
|
|
105
146
|
|
|
106
147
|
return currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu3 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu3 === void 0 ? void 0 : (_currMinutesBtnRef$cu4 = _currMinutesBtnRef$cu3.focus) === null || _currMinutesBtnRef$cu4 === void 0 ? void 0 : _currMinutesBtnRef$cu4.call(_currMinutesBtnRef$cu3);
|
|
107
148
|
});
|
|
108
|
-
}, [
|
|
109
|
-
// (e) => {
|
|
110
|
-
// const { key } = e;
|
|
111
|
-
// let didTriggerSecondChange = false;
|
|
112
|
-
// if (key === 'ArrowUp') {
|
|
113
|
-
// handlePrevSecond(e);
|
|
114
|
-
// didTriggerSecondChange = true;
|
|
115
|
-
// } else if (key === 'ArrowDown') {
|
|
116
|
-
// handleNextSecond(e);
|
|
117
|
-
// didTriggerSecondChange = true;
|
|
118
|
-
// } else if (key === 'ArrowLeft') {
|
|
119
|
-
// currMinutesBtnRef?.current?.focus?.();
|
|
120
|
-
// } else if (key === 'ArrowRight') {
|
|
121
|
-
// currMeridiemBtnRef?.current?.focus?.();
|
|
122
|
-
// }
|
|
123
|
-
// // ensure the focus is in the correct button after up/down arrow
|
|
124
|
-
// if (didTriggerSecondChange) setTimeout(() => currSecondsBtnRef?.current?.focus?.(), 10);
|
|
125
|
-
// },
|
|
126
|
-
// [
|
|
127
|
-
// currMeridiemBtnRef,
|
|
128
|
-
// currMinutesBtnRef,
|
|
129
|
-
// currSecondsBtnRef,
|
|
130
|
-
// handleNextSecond,
|
|
131
|
-
// handlePrevSecond,
|
|
132
|
-
// ],
|
|
133
|
-
// );
|
|
134
|
-
|
|
149
|
+
}, [onHomeKeyDownInsideTimeWheel, onEndKeyDownInsideTimeWheel, handlePrevMinute, handleNextMinute, currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef]);
|
|
135
150
|
const handleCurrMeridiemOnKeyDown = React.useCallback(e => {
|
|
136
151
|
const {
|
|
137
152
|
key,
|
|
138
153
|
shiftKey
|
|
139
154
|
} = e;
|
|
155
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
156
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
140
157
|
let didTriggerMeridiemChange = false;
|
|
141
158
|
|
|
142
159
|
if (key === 'ArrowUp') {
|
|
143
160
|
handleTimeWheelBtnChangeMeridiem('AM', e);
|
|
144
161
|
didTriggerMeridiemChange = true;
|
|
145
|
-
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (key === 'ArrowDown') {
|
|
146
165
|
handleTimeWheelBtnChangeMeridiem('PM', e);
|
|
147
166
|
didTriggerMeridiemChange = true;
|
|
148
|
-
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (key === 'ArrowLeft') {
|
|
149
170
|
var _currMinutesBtnRef$cu5, _currMinutesBtnRef$cu6;
|
|
150
171
|
|
|
151
172
|
// currSecondsBtnRef?.current?.focus?.();
|
|
152
173
|
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu5 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu5 === void 0 ? void 0 : (_currMinutesBtnRef$cu6 = _currMinutesBtnRef$cu5.focus) === null || _currMinutesBtnRef$cu6 === void 0 ? void 0 : _currMinutesBtnRef$cu6.call(_currMinutesBtnRef$cu5);
|
|
153
|
-
}
|
|
154
|
-
var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2, _currHourBtnRef$curre5, _currHourBtnRef$curre6;
|
|
155
|
-
|
|
156
|
-
e.preventDefault();
|
|
157
|
-
if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr === void 0 ? void 0 : (_prevMonthBtnRef$curr2 = _prevMonthBtnRef$curr.focus) === null || _prevMonthBtnRef$curr2 === void 0 ? void 0 : _prevMonthBtnRef$curr2.call(_prevMonthBtnRef$curr);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre5 = currHourBtnRef.current) === null || _currHourBtnRef$curre5 === void 0 ? void 0 : (_currHourBtnRef$curre6 = _currHourBtnRef$curre5.focus) === null || _currHourBtnRef$curre6 === void 0 ? void 0 : _currHourBtnRef$curre6.call(_currHourBtnRef$curre5);
|
|
158
|
-
} // ensure the focus is in the correct button after up/down arrow
|
|
174
|
+
}
|
|
159
175
|
|
|
176
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
177
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
|
|
160
178
|
|
|
161
179
|
if (didTriggerMeridiemChange) setTimeout(() => {
|
|
162
|
-
var _currMeridiemBtnRef$
|
|
180
|
+
var _currMeridiemBtnRef$c7, _currMeridiemBtnRef$c8;
|
|
163
181
|
|
|
164
|
-
return currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$
|
|
165
|
-
});
|
|
166
|
-
|
|
182
|
+
return currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c7 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c7 === void 0 ? void 0 : (_currMeridiemBtnRef$c8 = _currMeridiemBtnRef$c7.focus) === null || _currMeridiemBtnRef$c8 === void 0 ? void 0 : _currMeridiemBtnRef$c8.call(_currMeridiemBtnRef$c7);
|
|
183
|
+
}); // TAB CYCLE IMPLEMENTATION
|
|
184
|
+
|
|
185
|
+
if (!isControllerOnly) if (key === 'Tab' && !shiftKey) {
|
|
186
|
+
var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4, _currHourBtnRef$curre7, _currHourBtnRef$curre8;
|
|
187
|
+
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr3 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr3 === void 0 ? void 0 : (_prevMonthBtnRef$curr4 = _prevMonthBtnRef$curr3.focus) === null || _prevMonthBtnRef$curr4 === void 0 ? void 0 : _prevMonthBtnRef$curr4.call(_prevMonthBtnRef$curr3);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre7 = currHourBtnRef.current) === null || _currHourBtnRef$curre7 === void 0 ? void 0 : (_currHourBtnRef$curre8 = _currHourBtnRef$curre7.focus) === null || _currHourBtnRef$curre8 === void 0 ? void 0 : _currHourBtnRef$curre8.call(_currHourBtnRef$curre7);
|
|
190
|
+
}
|
|
191
|
+
}, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleTimeWheelBtnChangeMeridiem, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMonthBtnRef]);
|
|
167
192
|
const handlePrevHourBtnOnKeyDown = React.useCallback(e => {
|
|
168
193
|
const {
|
|
169
194
|
key
|
|
170
195
|
} = e;
|
|
196
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
197
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
171
198
|
|
|
172
199
|
if (key === 'ArrowRight') {
|
|
173
200
|
var _prevMinutesBtnRef$cu, _prevMinutesBtnRef$cu2;
|
|
174
201
|
|
|
175
202
|
prevMinutesBtnRef === null || prevMinutesBtnRef === void 0 ? void 0 : (_prevMinutesBtnRef$cu = prevMinutesBtnRef.current) === null || _prevMinutesBtnRef$cu === void 0 ? void 0 : (_prevMinutesBtnRef$cu2 = _prevMinutesBtnRef$cu.focus) === null || _prevMinutesBtnRef$cu2 === void 0 ? void 0 : _prevMinutesBtnRef$cu2.call(_prevMinutesBtnRef$cu);
|
|
176
|
-
}
|
|
177
|
-
var _currHourBtnRef$curre7, _currHourBtnRef$curre8;
|
|
203
|
+
}
|
|
178
204
|
|
|
179
|
-
|
|
205
|
+
if (key === 'ArrowDown') {
|
|
206
|
+
var _currHourBtnRef$curre9, _currHourBtnRef$curre10;
|
|
207
|
+
|
|
208
|
+
currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre9 = currHourBtnRef.current) === null || _currHourBtnRef$curre9 === void 0 ? void 0 : (_currHourBtnRef$curre10 = _currHourBtnRef$curre9.focus) === null || _currHourBtnRef$curre10 === void 0 ? void 0 : _currHourBtnRef$curre10.call(_currHourBtnRef$curre9);
|
|
180
209
|
}
|
|
181
|
-
|
|
210
|
+
|
|
211
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
212
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
213
|
+
}, [currHourBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMinutesBtnRef]);
|
|
182
214
|
const handlePrevMinuteBtnOnKeyDown = React.useCallback(e => {
|
|
183
215
|
const {
|
|
184
216
|
key
|
|
185
217
|
} = e;
|
|
218
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
219
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
186
220
|
|
|
187
221
|
if (key === 'ArrowRight') {
|
|
188
222
|
var _prevMeridiemBtnRef$c, _prevMeridiemBtnRef$c2;
|
|
189
223
|
|
|
190
224
|
// prevSecondsBtnRef?.current?.focus?.();
|
|
191
225
|
prevMeridiemBtnRef === null || prevMeridiemBtnRef === void 0 ? void 0 : (_prevMeridiemBtnRef$c = prevMeridiemBtnRef.current) === null || _prevMeridiemBtnRef$c === void 0 ? void 0 : (_prevMeridiemBtnRef$c2 = _prevMeridiemBtnRef$c.focus) === null || _prevMeridiemBtnRef$c2 === void 0 ? void 0 : _prevMeridiemBtnRef$c2.call(_prevMeridiemBtnRef$c);
|
|
192
|
-
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (key === 'ArrowLeft') {
|
|
193
229
|
var _prevHourBtnRef$curre, _prevHourBtnRef$curre2;
|
|
194
230
|
|
|
195
231
|
prevHourBtnRef === null || prevHourBtnRef === void 0 ? void 0 : (_prevHourBtnRef$curre = prevHourBtnRef.current) === null || _prevHourBtnRef$curre === void 0 ? void 0 : (_prevHourBtnRef$curre2 = _prevHourBtnRef$curre.focus) === null || _prevHourBtnRef$curre2 === void 0 ? void 0 : _prevHourBtnRef$curre2.call(_prevHourBtnRef$curre);
|
|
196
|
-
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (key === 'ArrowDown') {
|
|
197
235
|
var _currMinutesBtnRef$cu7, _currMinutesBtnRef$cu8;
|
|
198
236
|
|
|
199
237
|
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu7 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu7 === void 0 ? void 0 : (_currMinutesBtnRef$cu8 = _currMinutesBtnRef$cu7.focus) === null || _currMinutesBtnRef$cu8 === void 0 ? void 0 : _currMinutesBtnRef$cu8.call(_currMinutesBtnRef$cu7);
|
|
200
238
|
}
|
|
201
|
-
}, [currMinutesBtnRef, prevHourBtnRef, prevMeridiemBtnRef]); // const handlePrevSecondBtnOnKeyDown = useCallback(
|
|
202
|
-
// (e) => {
|
|
203
|
-
// const { key } = e;
|
|
204
|
-
// if (key === 'ArrowRight') {
|
|
205
|
-
// prevMeridiemBtnRef?.current?.focus?.();
|
|
206
|
-
// } else if (key === 'ArrowLeft') {
|
|
207
|
-
// prevMinutesBtnRef?.current?.focus?.();
|
|
208
|
-
// } else if (key === 'ArrowDown') {
|
|
209
|
-
// currSecondsBtnRef?.current?.focus?.();
|
|
210
|
-
// }
|
|
211
|
-
// },
|
|
212
|
-
// [currSecondsBtnRef, prevMeridiemBtnRef, prevMinutesBtnRef],
|
|
213
|
-
// );
|
|
214
239
|
|
|
240
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
241
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
242
|
+
}, [currMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevHourBtnRef, prevMeridiemBtnRef]);
|
|
215
243
|
const handlePrevMeridiemBtnOnKeyDown = React.useCallback(e => {
|
|
216
244
|
const {
|
|
217
245
|
key
|
|
218
246
|
} = e;
|
|
247
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
248
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
219
249
|
|
|
220
250
|
if (key === 'ArrowLeft') {
|
|
221
251
|
var _prevMinutesBtnRef$cu3, _prevMinutesBtnRef$cu4;
|
|
222
252
|
|
|
223
|
-
// prevSecondsBtnRef?.current?.focus?.();
|
|
224
253
|
prevMinutesBtnRef === null || prevMinutesBtnRef === void 0 ? void 0 : (_prevMinutesBtnRef$cu3 = prevMinutesBtnRef.current) === null || _prevMinutesBtnRef$cu3 === void 0 ? void 0 : (_prevMinutesBtnRef$cu4 = _prevMinutesBtnRef$cu3.focus) === null || _prevMinutesBtnRef$cu4 === void 0 ? void 0 : _prevMinutesBtnRef$cu4.call(_prevMinutesBtnRef$cu3);
|
|
225
|
-
}
|
|
226
|
-
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (key === 'ArrowDown') {
|
|
257
|
+
var _currMeridiemBtnRef$c9, _currMeridiemBtnRef$c10;
|
|
227
258
|
|
|
228
|
-
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$
|
|
259
|
+
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c9 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c9 === void 0 ? void 0 : (_currMeridiemBtnRef$c10 = _currMeridiemBtnRef$c9.focus) === null || _currMeridiemBtnRef$c10 === void 0 ? void 0 : _currMeridiemBtnRef$c10.call(_currMeridiemBtnRef$c9);
|
|
229
260
|
}
|
|
230
|
-
|
|
261
|
+
|
|
262
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
263
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
264
|
+
}, [currMeridiemBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMinutesBtnRef]);
|
|
231
265
|
const handleNextHourBtnOnKeyDown = React.useCallback(e => {
|
|
232
266
|
const {
|
|
233
267
|
key
|
|
234
268
|
} = e;
|
|
269
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
270
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
235
271
|
|
|
236
272
|
if (key === 'ArrowRight') {
|
|
237
273
|
var _nextMinutesBtnRef$cu, _nextMinutesBtnRef$cu2;
|
|
238
274
|
|
|
239
275
|
nextMinutesBtnRef === null || nextMinutesBtnRef === void 0 ? void 0 : (_nextMinutesBtnRef$cu = nextMinutesBtnRef.current) === null || _nextMinutesBtnRef$cu === void 0 ? void 0 : (_nextMinutesBtnRef$cu2 = _nextMinutesBtnRef$cu.focus) === null || _nextMinutesBtnRef$cu2 === void 0 ? void 0 : _nextMinutesBtnRef$cu2.call(_nextMinutesBtnRef$cu);
|
|
240
|
-
}
|
|
241
|
-
var _currHourBtnRef$curre9, _currHourBtnRef$curre10;
|
|
276
|
+
}
|
|
242
277
|
|
|
243
|
-
|
|
278
|
+
if (key === 'ArrowUp') {
|
|
279
|
+
var _currHourBtnRef$curre11, _currHourBtnRef$curre12;
|
|
280
|
+
|
|
281
|
+
currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre11 = currHourBtnRef.current) === null || _currHourBtnRef$curre11 === void 0 ? void 0 : (_currHourBtnRef$curre12 = _currHourBtnRef$curre11.focus) === null || _currHourBtnRef$curre12 === void 0 ? void 0 : _currHourBtnRef$curre12.call(_currHourBtnRef$curre11);
|
|
244
282
|
}
|
|
245
|
-
|
|
283
|
+
|
|
284
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
285
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
286
|
+
}, [currHourBtnRef, nextMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
246
287
|
const handleNextMinuteBtnOnKeyDown = React.useCallback(e => {
|
|
247
288
|
const {
|
|
248
289
|
key
|
|
249
290
|
} = e;
|
|
291
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
292
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
250
293
|
|
|
251
294
|
if (key === 'ArrowRight') {
|
|
252
295
|
var _nextMeridiemBtnRef$c, _nextMeridiemBtnRef$c2;
|
|
253
296
|
|
|
254
|
-
// nextSecondsBtnRef?.current?.focus?.();
|
|
255
297
|
nextMeridiemBtnRef === null || nextMeridiemBtnRef === void 0 ? void 0 : (_nextMeridiemBtnRef$c = nextMeridiemBtnRef.current) === null || _nextMeridiemBtnRef$c === void 0 ? void 0 : (_nextMeridiemBtnRef$c2 = _nextMeridiemBtnRef$c.focus) === null || _nextMeridiemBtnRef$c2 === void 0 ? void 0 : _nextMeridiemBtnRef$c2.call(_nextMeridiemBtnRef$c);
|
|
256
|
-
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (key === 'ArrowLeft') {
|
|
257
301
|
var _nextHourBtnRef$curre, _nextHourBtnRef$curre2;
|
|
258
302
|
|
|
259
303
|
nextHourBtnRef === null || nextHourBtnRef === void 0 ? void 0 : (_nextHourBtnRef$curre = nextHourBtnRef.current) === null || _nextHourBtnRef$curre === void 0 ? void 0 : (_nextHourBtnRef$curre2 = _nextHourBtnRef$curre.focus) === null || _nextHourBtnRef$curre2 === void 0 ? void 0 : _nextHourBtnRef$curre2.call(_nextHourBtnRef$curre);
|
|
260
|
-
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (key === 'ArrowUp') {
|
|
261
307
|
var _currMinutesBtnRef$cu9, _currMinutesBtnRef$cu10;
|
|
262
308
|
|
|
263
309
|
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu9 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu9 === void 0 ? void 0 : (_currMinutesBtnRef$cu10 = _currMinutesBtnRef$cu9.focus) === null || _currMinutesBtnRef$cu10 === void 0 ? void 0 : _currMinutesBtnRef$cu10.call(_currMinutesBtnRef$cu9);
|
|
264
310
|
}
|
|
265
|
-
}, [currMinutesBtnRef, nextHourBtnRef, nextMeridiemBtnRef]); // const handleNextSecondBtnOnKeyDown = useCallback(
|
|
266
|
-
// (e) => {
|
|
267
|
-
// const { key } = e;
|
|
268
|
-
// if (key === 'ArrowRight') {
|
|
269
|
-
// nextMeridiemBtnRef?.current?.focus?.();
|
|
270
|
-
// } else if (key === 'ArrowLeft') {
|
|
271
|
-
// nextMinutesBtnRef?.current?.focus?.();
|
|
272
|
-
// } else if (key === 'ArrowUp') {
|
|
273
|
-
// currSecondsBtnRef?.current?.focus?.();
|
|
274
|
-
// }
|
|
275
|
-
// },
|
|
276
|
-
// [currSecondsBtnRef, nextMeridiemBtnRef, nextMinutesBtnRef],
|
|
277
|
-
// );
|
|
278
311
|
|
|
312
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
313
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
314
|
+
}, [currMinutesBtnRef, nextHourBtnRef, nextMeridiemBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
279
315
|
const handleNextMeridiemBtnOnKeyDown = React.useCallback(e => {
|
|
280
316
|
const {
|
|
281
317
|
key
|
|
282
318
|
} = e;
|
|
319
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
320
|
+
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
283
321
|
|
|
284
322
|
if (key === 'ArrowLeft') {
|
|
285
323
|
var _nextMinutesBtnRef$cu3, _nextMinutesBtnRef$cu4;
|
|
286
324
|
|
|
287
325
|
nextMinutesBtnRef === null || nextMinutesBtnRef === void 0 ? void 0 : (_nextMinutesBtnRef$cu3 = nextMinutesBtnRef.current) === null || _nextMinutesBtnRef$cu3 === void 0 ? void 0 : (_nextMinutesBtnRef$cu4 = _nextMinutesBtnRef$cu3.focus) === null || _nextMinutesBtnRef$cu4 === void 0 ? void 0 : _nextMinutesBtnRef$cu4.call(_nextMinutesBtnRef$cu3);
|
|
288
|
-
}
|
|
289
|
-
var _currMeridiemBtnRef$c9, _currMeridiemBtnRef$c10;
|
|
326
|
+
}
|
|
290
327
|
|
|
291
|
-
|
|
328
|
+
if (key === 'ArrowUp') {
|
|
329
|
+
var _currMeridiemBtnRef$c11, _currMeridiemBtnRef$c12;
|
|
330
|
+
|
|
331
|
+
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c11 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c11 === void 0 ? void 0 : (_currMeridiemBtnRef$c12 = _currMeridiemBtnRef$c11.focus) === null || _currMeridiemBtnRef$c12 === void 0 ? void 0 : _currMeridiemBtnRef$c12.call(_currMeridiemBtnRef$c11);
|
|
292
332
|
}
|
|
293
|
-
|
|
333
|
+
|
|
334
|
+
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
335
|
+
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
336
|
+
}, [currMeridiemBtnRef, nextMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
294
337
|
return React.useMemo(() => ({
|
|
295
338
|
handlePrevHourBtnOnKeyDown,
|
|
296
339
|
handleCurrHourOnKeyDown,
|
|
@@ -298,17 +341,11 @@ const useKeyboardHandlers = ({
|
|
|
298
341
|
handlePrevMinuteBtnOnKeyDown,
|
|
299
342
|
handleCurrMinutesOnKeyDown,
|
|
300
343
|
handleNextMinuteBtnOnKeyDown,
|
|
301
|
-
// handlePrevSecondBtnOnKeyDown,
|
|
302
|
-
// handleCurrSecondsOnKeyDown,
|
|
303
|
-
// handleNextSecondBtnOnKeyDown,
|
|
304
344
|
handlePrevMeridiemBtnOnKeyDown,
|
|
305
345
|
handleCurrMeridiemOnKeyDown,
|
|
306
346
|
handleNextMeridiemBtnOnKeyDown,
|
|
307
347
|
handlePickerIconKeyDown
|
|
308
|
-
}), [handleCurrHourOnKeyDown, handleCurrMeridiemOnKeyDown, handleCurrMinutesOnKeyDown,
|
|
309
|
-
handleNextHourBtnOnKeyDown, handleNextMeridiemBtnOnKeyDown, handleNextMinuteBtnOnKeyDown, // handleNextSecondBtnOnKeyDown,
|
|
310
|
-
handlePrevHourBtnOnKeyDown, handlePrevMeridiemBtnOnKeyDown, handlePrevMinuteBtnOnKeyDown, // handlePrevSecondBtnOnKeyDown,
|
|
311
|
-
handlePickerIconKeyDown]);
|
|
348
|
+
}), [handleCurrHourOnKeyDown, handleCurrMeridiemOnKeyDown, handleCurrMinutesOnKeyDown, handleNextHourBtnOnKeyDown, handleNextMeridiemBtnOnKeyDown, handleNextMinuteBtnOnKeyDown, handlePrevHourBtnOnKeyDown, handlePrevMeridiemBtnOnKeyDown, handlePrevMinuteBtnOnKeyDown, handlePickerIconKeyDown]);
|
|
312
349
|
};
|
|
313
350
|
|
|
314
351
|
exports.useKeyboardHandlers = useKeyboardHandlers;
|
|
@@ -2,15 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var reactPopper = require('react-popper');
|
|
8
|
+
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
7
9
|
var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
|
|
8
10
|
|
|
9
|
-
const usePopperTriggerLogic = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const usePopperTriggerLogic = () => {
|
|
12
|
+
const {
|
|
13
|
+
pickerButtonRef,
|
|
14
|
+
props: {
|
|
15
|
+
onPickerClose,
|
|
16
|
+
onPickerOpen
|
|
17
|
+
},
|
|
18
|
+
currHourBtnRef,
|
|
19
|
+
isWithCalendarToo
|
|
20
|
+
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
14
21
|
const [showTimePicker, setShowTimePicker] = React.useState(false);
|
|
15
22
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
16
23
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
@@ -26,17 +33,21 @@ const usePopperTriggerLogic = ({
|
|
|
26
33
|
const closeTimePicker = React.useCallback(() => {
|
|
27
34
|
setShowTimePicker(false);
|
|
28
35
|
onPickerClose();
|
|
29
|
-
}, [onPickerClose]);
|
|
30
|
-
// setShowTimePicker(true);
|
|
31
|
-
// onPickerOpen();
|
|
32
|
-
// }, [onPickerOpen]);
|
|
33
|
-
|
|
36
|
+
}, [onPickerClose]);
|
|
34
37
|
const handleToggleTimePicker = React.useCallback(() => {
|
|
35
38
|
setShowTimePicker(oldShowCalendar => {
|
|
36
|
-
if (!oldShowCalendar)
|
|
39
|
+
if (!oldShowCalendar) {
|
|
40
|
+
onPickerOpen();
|
|
41
|
+
if (!isWithCalendarToo) setTimeout(() => {
|
|
42
|
+
var _currHourBtnRef$curre, _currHourBtnRef$curre2;
|
|
43
|
+
|
|
44
|
+
return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
|
|
45
|
+
});
|
|
46
|
+
} else onPickerClose();
|
|
47
|
+
|
|
37
48
|
return !oldShowCalendar;
|
|
38
49
|
});
|
|
39
|
-
}, [onPickerClose, onPickerOpen]);
|
|
50
|
+
}, [currHourBtnRef, isWithCalendarToo, onPickerClose, onPickerOpen]);
|
|
40
51
|
useOnClickOutside.useOnClickOutside(popperElement, e => {
|
|
41
52
|
var _pickerButtonRef$curr, _pickerButtonRef$curr2;
|
|
42
53
|
|