@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
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var React = require('react');
|
|
7
12
|
var ControlledDateTimePickerCTX = require('../../ControlledDateTimePickerCTX.js');
|
|
8
13
|
var stringHelpers = require('../../utils/stringHelpers.js');
|
|
9
14
|
var dateHelpers = require('../../utils/dateHelpers.js');
|
|
15
|
+
var constants = require('../../utils/constants.js');
|
|
10
16
|
|
|
11
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
18
|
|
|
@@ -14,35 +20,21 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
14
20
|
|
|
15
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
16
22
|
|
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
18
|
-
// our source of truth is either the date props or dateTime props
|
|
19
|
-
// based on wheter it's a dateTime picker
|
|
20
|
-
// or a date picker (it's date picker when hideTime is true)
|
|
21
|
-
|
|
22
|
-
const useGetDestructuredDateValues = ({
|
|
23
|
-
date,
|
|
24
|
-
dateTime,
|
|
25
|
-
hideTime
|
|
26
|
-
}) => {
|
|
27
|
-
const dateStringFromProps = React.useMemo(() => hideTime ? date : stringHelpers.dateTimeToDate(dateTime), [date, dateTime, hideTime]);
|
|
28
|
-
const deconstructedValues = React.useMemo(() => stringHelpers.deconstructValuesFromDateString(dateStringFromProps), [dateStringFromProps]);
|
|
29
|
-
return deconstructedValues;
|
|
30
|
-
};
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
24
|
const useDateInputs = () => {
|
|
32
25
|
const {
|
|
33
26
|
props: {
|
|
34
|
-
date,
|
|
35
|
-
dateTime,
|
|
36
27
|
onMonthChange: appOnMonthChange,
|
|
37
28
|
onDayChange: appOnDayChange,
|
|
38
29
|
onYearChange: appOnYearChange,
|
|
39
30
|
getIsDisabledDay,
|
|
40
|
-
getIsOutOfRangeDay
|
|
31
|
+
getIsOutOfRangeDay,
|
|
32
|
+
disabled
|
|
41
33
|
},
|
|
34
|
+
month,
|
|
35
|
+
day,
|
|
36
|
+
year,
|
|
42
37
|
hideTime,
|
|
43
|
-
hideDateTimePicker,
|
|
44
|
-
hideDatePicker,
|
|
45
|
-
hideTimePicker,
|
|
46
38
|
monthInputRef,
|
|
47
39
|
dayInputRef,
|
|
48
40
|
yearInputRef,
|
|
@@ -54,33 +46,25 @@ const useDateInputs = () => {
|
|
|
54
46
|
setLatestInteractionRegion,
|
|
55
47
|
withClearBtn,
|
|
56
48
|
withAnyPicker,
|
|
57
|
-
withAnyRightController
|
|
49
|
+
withAnyRightController,
|
|
50
|
+
autoFocusMonthInput,
|
|
51
|
+
lastSegmentRef
|
|
58
52
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
59
|
-
const {
|
|
60
|
-
month,
|
|
61
|
-
day,
|
|
62
|
-
year
|
|
63
|
-
} = useGetDestructuredDateValues({
|
|
64
|
-
date,
|
|
65
|
-
dateTime,
|
|
66
|
-
hideTime
|
|
67
|
-
});
|
|
68
53
|
const onHomeKeyDown = React.useCallback(() => {
|
|
69
54
|
var _monthInputRef$curren, _monthInputRef$curren2;
|
|
70
55
|
|
|
71
56
|
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);
|
|
72
57
|
}, [monthInputRef]);
|
|
73
58
|
const onEndKeyDown = React.useCallback(() => {
|
|
74
|
-
var _pickerButtonRef$curr, _pickerButtonRef$curr2,
|
|
59
|
+
var _pickerButtonRef$curr, _pickerButtonRef$curr2, _clearButtonRef$curre, _clearButtonRef$curre2, _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
|
|
75
60
|
|
|
76
|
-
if (
|
|
77
|
-
}, [
|
|
61
|
+
if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (withClearBtn) clearButtonRef === null || clearButtonRef === void 0 ? void 0 : (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else if (!hideTime) 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 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);
|
|
62
|
+
}, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, hideTime, meridiemInputRef, yearInputRef]);
|
|
78
63
|
const setLatestInteractionRegionDateInputs = React.useCallback(() => {
|
|
79
64
|
setLatestInteractionRegion('date-inputs');
|
|
80
65
|
}, [setLatestInteractionRegion]);
|
|
81
|
-
const handleChangeMonth = React.useCallback((newMonth, e
|
|
82
|
-
|
|
83
|
-
}) => {
|
|
66
|
+
const handleChangeMonth = React.useCallback(function (newMonth, e) {
|
|
67
|
+
let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : constants.defaultMetaInfo;
|
|
84
68
|
const newDateString = stringHelpers.getFormattedDateString({
|
|
85
69
|
month: newMonth,
|
|
86
70
|
day,
|
|
@@ -108,36 +92,51 @@ const useDateInputs = () => {
|
|
|
108
92
|
if (newMonth.length === 2) dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current = dayInputRef.current) === null || _dayInputRef$current === void 0 ? void 0 : (_dayInputRef$current$ = _dayInputRef$current.focus) === null || _dayInputRef$current$ === void 0 ? void 0 : _dayInputRef$current$.call(_dayInputRef$current);
|
|
109
93
|
}, [dayInputRef, handleChangeMonth]);
|
|
110
94
|
const onMonthKeyDown = React.useCallback(e => {
|
|
95
|
+
var _lastSegmentRef$curre, _lastSegmentRef$curre2;
|
|
96
|
+
|
|
111
97
|
const {
|
|
112
|
-
key
|
|
98
|
+
key,
|
|
99
|
+
ctrlKey,
|
|
100
|
+
metaKey
|
|
113
101
|
} = e;
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
102
|
+
const monthStringConvertedToInteger = Number.parseInt(month, 10);
|
|
103
|
+
if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
|
|
104
|
+
if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
|
|
116
105
|
if (key === 'Home') onHomeKeyDown();
|
|
117
106
|
if (key === 'End') onEndKeyDown();
|
|
118
107
|
|
|
119
108
|
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
120
|
-
const monthStringConvertedToInteger = Number.parseInt(month, 10);
|
|
121
109
|
const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
|
|
122
110
|
let newMonth;
|
|
123
111
|
if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
|
|
124
|
-
newMonth = stringHelpers.prependStringWithPlaceHolders(
|
|
112
|
+
newMonth = stringHelpers.prependStringWithPlaceHolders("".concat(newMonth), 2);
|
|
125
113
|
handleChangeMonth(newMonth, e);
|
|
126
114
|
}
|
|
127
|
-
|
|
115
|
+
|
|
116
|
+
if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
|
|
117
|
+
var _dayInputRef$current2, _dayInputRef$current3;
|
|
118
|
+
|
|
119
|
+
const newMonth = stringHelpers.prependStringWithPlaceHolders("".concat(monthStringConvertedToInteger), 2);
|
|
120
|
+
handleChangeMonth(newMonth, e); // auto-advance functionality:
|
|
121
|
+
|
|
122
|
+
if (newMonth.length === 2) dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current2 = dayInputRef.current) === null || _dayInputRef$current2 === void 0 ? void 0 : (_dayInputRef$current3 = _dayInputRef$current2.focus) === null || _dayInputRef$current3 === void 0 ? void 0 : _dayInputRef$current3.call(_dayInputRef$current2);
|
|
123
|
+
} // focus last fragment on fill with now
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : (_lastSegmentRef$curre2 = _lastSegmentRef$curre.focus) === null || _lastSegmentRef$curre2 === void 0 ? void 0 : _lastSegmentRef$curre2.call(_lastSegmentRef$curre);
|
|
127
|
+
}, [month, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeMonth, dayInputRef]);
|
|
128
128
|
const onMonthBlur = React.useCallback(e => {
|
|
129
129
|
var _e$target2;
|
|
130
130
|
|
|
131
131
|
const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
|
|
132
|
-
if (newMonth === '0') handleChangeMonth('', e, {
|
|
132
|
+
if (newMonth === '0') handleChangeMonth('01', e, {
|
|
133
133
|
isAutomaticFillTrigger: true
|
|
134
134
|
});else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(stringHelpers.prependStringWithPlaceHolders(newMonth, 2), e, {
|
|
135
135
|
isAutomaticFillTrigger: true
|
|
136
136
|
});
|
|
137
137
|
}, [handleChangeMonth]);
|
|
138
|
-
const handleChangeDay = React.useCallback((newDay, e
|
|
139
|
-
|
|
140
|
-
}) => {
|
|
138
|
+
const handleChangeDay = React.useCallback(function (newDay, e) {
|
|
139
|
+
let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : constants.defaultMetaInfo;
|
|
141
140
|
const newDateString = stringHelpers.getFormattedDateString({
|
|
142
141
|
month,
|
|
143
142
|
day: newDay,
|
|
@@ -165,36 +164,58 @@ const useDateInputs = () => {
|
|
|
165
164
|
if (newDay.length === 2) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current3 = yearInputRef.current) === null || _yearInputRef$current3 === void 0 ? void 0 : (_yearInputRef$current4 = _yearInputRef$current3.focus) === null || _yearInputRef$current4 === void 0 ? void 0 : _yearInputRef$current4.call(_yearInputRef$current3);
|
|
166
165
|
}, [handleChangeDay, yearInputRef]);
|
|
167
166
|
const onDayKeyDown = React.useCallback(e => {
|
|
167
|
+
var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
|
|
168
|
+
|
|
168
169
|
const {
|
|
169
|
-
key
|
|
170
|
+
key,
|
|
171
|
+
ctrlKey,
|
|
172
|
+
metaKey
|
|
170
173
|
} = e;
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
174
|
+
const dayStringConvertedToInteger = Number.parseInt(day, 10);
|
|
175
|
+
if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
|
|
176
|
+
if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
|
|
173
177
|
if (key === 'Home') onHomeKeyDown();
|
|
174
178
|
if (key === 'End') onEndKeyDown();
|
|
175
179
|
|
|
176
180
|
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
177
|
-
const dayStringConvertedToInteger = Number.parseInt(day, 10);
|
|
178
181
|
const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
|
|
179
182
|
let newDay;
|
|
180
183
|
if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
|
|
181
|
-
newDay = stringHelpers.prependStringWithPlaceHolders(
|
|
184
|
+
newDay = stringHelpers.prependStringWithPlaceHolders("".concat(newDay), 2);
|
|
182
185
|
handleChangeDay(newDay, e);
|
|
183
186
|
}
|
|
184
|
-
|
|
187
|
+
|
|
188
|
+
if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
|
|
189
|
+
var _yearInputRef$current5, _yearInputRef$current6;
|
|
190
|
+
|
|
191
|
+
const newDay = stringHelpers.prependStringWithPlaceHolders("".concat(dayStringConvertedToInteger), 2);
|
|
192
|
+
handleChangeDay(newDay, e); // auto-advance functionality:
|
|
193
|
+
|
|
194
|
+
if (newDay.length === 2) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current5 = yearInputRef.current) === null || _yearInputRef$current5 === void 0 ? void 0 : (_yearInputRef$current6 = _yearInputRef$current5.focus) === null || _yearInputRef$current6 === void 0 ? void 0 : _yearInputRef$current6.call(_yearInputRef$current5);
|
|
195
|
+
} // regressive backspace functionality
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
if (key === 'Backspace' && (day === null || day === void 0 ? void 0 : day.length) === 0) {
|
|
199
|
+
var _monthInputRef$curren3, _monthInputRef$curren4;
|
|
200
|
+
|
|
201
|
+
monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren3 = monthInputRef.current) === null || _monthInputRef$curren3 === void 0 ? void 0 : (_monthInputRef$curren4 = _monthInputRef$curren3.focus) === null || _monthInputRef$curren4 === void 0 ? void 0 : _monthInputRef$curren4.call(_monthInputRef$curren3);
|
|
202
|
+
} // focus last fragment on fill with now
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre3 = lastSegmentRef.current) === null || _lastSegmentRef$curre3 === void 0 ? void 0 : (_lastSegmentRef$curre4 = _lastSegmentRef$curre3.focus) === null || _lastSegmentRef$curre4 === void 0 ? void 0 : _lastSegmentRef$curre4.call(_lastSegmentRef$curre3);
|
|
206
|
+
}, [day, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeDay, yearInputRef, monthInputRef]);
|
|
185
207
|
const onDayBlur = React.useCallback(e => {
|
|
186
208
|
var _e$target4;
|
|
187
209
|
|
|
188
210
|
const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
|
|
189
|
-
if (newDay === '0') handleChangeDay('', e, {
|
|
211
|
+
if (newDay === '0') handleChangeDay('01', e, {
|
|
190
212
|
isAutomaticFillTrigger: true
|
|
191
213
|
});else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(stringHelpers.prependStringWithPlaceHolders(newDay, 2), e, {
|
|
192
214
|
isAutomaticFillTrigger: true
|
|
193
215
|
});
|
|
194
216
|
}, [handleChangeDay]);
|
|
195
|
-
const handleChangeYear = React.useCallback((newYear, e
|
|
196
|
-
|
|
197
|
-
}) => {
|
|
217
|
+
const handleChangeYear = React.useCallback(function (newYear, e) {
|
|
218
|
+
let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : constants.defaultMetaInfo;
|
|
198
219
|
const newDateString = stringHelpers.getFormattedDateString({
|
|
199
220
|
month,
|
|
200
221
|
day,
|
|
@@ -221,30 +242,59 @@ const useDateInputs = () => {
|
|
|
221
242
|
var _hourInputRef$current, _hourInputRef$current2;
|
|
222
243
|
|
|
223
244
|
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);else if (withAnyRightController) {
|
|
224
|
-
var _clearButtonRef$
|
|
245
|
+
var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
|
|
225
246
|
|
|
226
|
-
if (withClearBtn) (_clearButtonRef$
|
|
247
|
+
if (withClearBtn) (_clearButtonRef$curre3 = clearButtonRef.current) === null || _clearButtonRef$curre3 === void 0 ? void 0 : (_clearButtonRef$curre4 = _clearButtonRef$curre3.focus) === null || _clearButtonRef$curre4 === void 0 ? void 0 : _clearButtonRef$curre4.call(_clearButtonRef$curre3);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3); // pending approval from Seda, check which one should be focused first...
|
|
227
248
|
}
|
|
228
249
|
}
|
|
229
250
|
}, [handleChangeYear, hideTime, hourInputRef, withAnyRightController, withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef]);
|
|
230
251
|
const onYearKeyDown = React.useCallback(e => {
|
|
252
|
+
var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
|
|
253
|
+
|
|
231
254
|
const {
|
|
232
|
-
key
|
|
255
|
+
key,
|
|
256
|
+
ctrlKey,
|
|
257
|
+
metaKey
|
|
233
258
|
} = e;
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
259
|
+
const yearStringConvertedToInteger = Number.parseInt(year, 10);
|
|
260
|
+
if (constants.homeEndArrowUpDownSpaceKeys.includes(key)) e.preventDefault();
|
|
261
|
+
if (constants.homeEndArrowUpDownSpaceKeys.includes(key)) e.stopPropagation();
|
|
236
262
|
if (key === 'Home') onHomeKeyDown();
|
|
237
263
|
if (key === 'End') onEndKeyDown();
|
|
238
264
|
|
|
239
265
|
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
240
|
-
const yearStringConvertedToInteger = Number.parseInt(year, 10);
|
|
241
266
|
const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
|
|
242
267
|
let newYear;
|
|
243
268
|
if (key === 'ArrowUp') newYear = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYear = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
|
|
244
|
-
newYear = stringHelpers.prependStringWithPlaceHolders(
|
|
269
|
+
newYear = stringHelpers.prependStringWithPlaceHolders("".concat(newYear), 4);
|
|
245
270
|
handleChangeYear(newYear, e);
|
|
246
271
|
}
|
|
247
|
-
|
|
272
|
+
|
|
273
|
+
if (!Number.isNaN(yearStringConvertedToInteger) && key === ' ') {
|
|
274
|
+
const newYear = stringHelpers.prependStringWithPlaceHolders("".concat(yearStringConvertedToInteger), 4);
|
|
275
|
+
handleChangeYear(newYear, e); // auto-advance functionality:
|
|
276
|
+
|
|
277
|
+
if (newYear.length === 4) {
|
|
278
|
+
var _hourInputRef$current3, _hourInputRef$current4;
|
|
279
|
+
|
|
280
|
+
if (!hideTime) hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current3 = hourInputRef.current) === null || _hourInputRef$current3 === void 0 ? void 0 : (_hourInputRef$current4 = _hourInputRef$current3.focus) === null || _hourInputRef$current4 === void 0 ? void 0 : _hourInputRef$current4.call(_hourInputRef$current3);else if (withAnyRightController) {
|
|
281
|
+
var _clearButtonRef$curre5, _clearButtonRef$curre6, _pickerButtonRef$curr5, _pickerButtonRef$curr6;
|
|
282
|
+
|
|
283
|
+
if (withClearBtn) (_clearButtonRef$curre5 = clearButtonRef.current) === null || _clearButtonRef$curre5 === void 0 ? void 0 : (_clearButtonRef$curre6 = _clearButtonRef$curre5.focus) === null || _clearButtonRef$curre6 === void 0 ? void 0 : _clearButtonRef$curre6.call(_clearButtonRef$curre5);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr5 = pickerButtonRef.current) === null || _pickerButtonRef$curr5 === void 0 ? void 0 : (_pickerButtonRef$curr6 = _pickerButtonRef$curr5.focus) === null || _pickerButtonRef$curr6 === void 0 ? void 0 : _pickerButtonRef$curr6.call(_pickerButtonRef$curr5); // pending approval from Seda, check which one should be focused first...
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
} // regressive backspace functionality
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
if (key === 'Backspace' && (year === null || year === void 0 ? void 0 : year.length) === 0) {
|
|
290
|
+
var _dayInputRef$current4, _dayInputRef$current5;
|
|
291
|
+
|
|
292
|
+
dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current4 = dayInputRef.current) === null || _dayInputRef$current4 === void 0 ? void 0 : (_dayInputRef$current5 = _dayInputRef$current4.focus) === null || _dayInputRef$current5 === void 0 ? void 0 : _dayInputRef$current5.call(_dayInputRef$current4);
|
|
293
|
+
} // focus last fragment on fill with now
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre5 = lastSegmentRef.current) === null || _lastSegmentRef$curre5 === void 0 ? void 0 : (_lastSegmentRef$curre6 = _lastSegmentRef$curre5.focus) === null || _lastSegmentRef$curre6 === void 0 ? void 0 : _lastSegmentRef$curre6.call(_lastSegmentRef$curre5);
|
|
297
|
+
}, [year, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeYear, hideTime, hourInputRef, withAnyRightController, withClearBtn, clearButtonRef, withAnyPicker, pickerButtonRef, dayInputRef]);
|
|
248
298
|
const onYearBlur = React.useCallback(e => {
|
|
249
299
|
var _e$target6;
|
|
250
300
|
|
|
@@ -257,6 +307,8 @@ const useDateInputs = () => {
|
|
|
257
307
|
month,
|
|
258
308
|
day,
|
|
259
309
|
year,
|
|
310
|
+
autoFocusMonthInput,
|
|
311
|
+
disabled,
|
|
260
312
|
onMonthFocus,
|
|
261
313
|
onMonthChange,
|
|
262
314
|
onDayFocus,
|
|
@@ -269,8 +321,7 @@ const useDateInputs = () => {
|
|
|
269
321
|
onMonthKeyDown,
|
|
270
322
|
onDayKeyDown,
|
|
271
323
|
onYearKeyDown
|
|
272
|
-
}), [month, day, year, onMonthFocus, onMonthChange, onDayFocus, onDayChange, onYearFocus, onYearChange, onMonthBlur, onDayBlur, onYearBlur, onMonthKeyDown, onDayKeyDown, onYearKeyDown]);
|
|
324
|
+
}), [month, day, year, autoFocusMonthInput, disabled, onMonthFocus, onMonthChange, onDayFocus, onDayChange, onYearFocus, onYearChange, onMonthBlur, onDayBlur, onYearBlur, onMonthKeyDown, onDayKeyDown, onYearKeyDown]);
|
|
273
325
|
};
|
|
274
326
|
|
|
275
327
|
exports.useDateInputs = useDateInputs;
|
|
276
|
-
exports.useGetDestructuredDateValues = useGetDestructuredDateValues;
|
|
@@ -16,11 +16,12 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
16
16
|
|
|
17
17
|
var _CalendarIconTrigger, _CalendarWrapper;
|
|
18
18
|
|
|
19
|
-
const WrappedCalendarContext =
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const WrappedCalendarContext = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
children
|
|
22
|
+
} = _ref;
|
|
22
23
|
const ctx = useConfigCalendarCTX.useConfigCalendarCTX();
|
|
23
|
-
return /*#__PURE__*/_jsx__default[
|
|
24
|
+
return /*#__PURE__*/_jsx__default["default"](CalendarContext.CalendarContext.Provider, {
|
|
24
25
|
value: ctx
|
|
25
26
|
}, void 0, children);
|
|
26
27
|
};
|
|
@@ -28,7 +29,7 @@ const WrappedCalendarContext = ({
|
|
|
28
29
|
const WrapWithCalendarContext = Component => {
|
|
29
30
|
var _WrappedCalendarConte;
|
|
30
31
|
|
|
31
|
-
return () => _WrappedCalendarConte || (_WrappedCalendarConte = /*#__PURE__*/_jsx__default[
|
|
32
|
+
return () => _WrappedCalendarConte || (_WrappedCalendarConte = /*#__PURE__*/_jsx__default["default"](WrappedCalendarContext, {}, void 0, /*#__PURE__*/_jsx__default["default"](Component, {})));
|
|
32
33
|
}; // we use the HoC to be able to use the useContext
|
|
33
34
|
// the HoC is Reused in CalendarWithTimeWheel
|
|
34
35
|
|
|
@@ -39,10 +40,10 @@ const Calendar = WrapWithCalendarContext(() => {
|
|
|
39
40
|
handleMenuWrapperKeyDown
|
|
40
41
|
} = React.useContext(CalendarContext.CalendarContext);
|
|
41
42
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
42
|
-
children: [isControllerOnly ? null : _CalendarIconTrigger || (_CalendarIconTrigger = /*#__PURE__*/_jsx__default[
|
|
43
|
-
children: /*#__PURE__*/_jsx__default[
|
|
43
|
+
children: [isControllerOnly ? null : _CalendarIconTrigger || (_CalendarIconTrigger = /*#__PURE__*/_jsx__default["default"](CalendarIconTrigger.CalendarIconTrigger, {})), isControllerOnly || showCalendar ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
44
|
+
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
44
45
|
onKeyDown: handleMenuWrapperKeyDown
|
|
45
|
-
}, void 0, _CalendarWrapper || (_CalendarWrapper = /*#__PURE__*/_jsx__default[
|
|
46
|
+
}, void 0, _CalendarWrapper || (_CalendarWrapper = /*#__PURE__*/_jsx__default["default"](CalendarWrapper.CalendarWrapper, {})))
|
|
46
47
|
}) : null]
|
|
47
48
|
});
|
|
48
49
|
});
|
|
@@ -7,7 +7,6 @@ var React = require('react');
|
|
|
7
7
|
var CalendarMonthDays = require('./CalendarMonthDays.js');
|
|
8
8
|
var CalendarWeekDays = require('./CalendarWeekDays.js');
|
|
9
9
|
var Styleds = require('./Styleds.js');
|
|
10
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
11
10
|
|
|
12
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
12
|
|
|
@@ -15,8 +14,15 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
15
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
15
|
|
|
17
16
|
var _CalendarWeekDays, _StyledBody;
|
|
18
|
-
const CalendarBody = /*#__PURE__*/React__default[
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const CalendarBody = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
18
|
+
let {
|
|
19
|
+
weekRowsNum
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_jsx__default["default"]("span", {
|
|
22
|
+
role: "grid",
|
|
23
|
+
"aria-colcount": 7,
|
|
24
|
+
"aria-rowcount": weekRowsNum
|
|
25
|
+
}, void 0, _CalendarWeekDays || (_CalendarWeekDays = /*#__PURE__*/_jsx__default["default"](CalendarWeekDays.CalendarWeekDays, {})), _StyledBody || (_StyledBody = /*#__PURE__*/_jsx__default["default"](Styleds.StyledBody, {}, void 0, /*#__PURE__*/_jsx__default["default"](CalendarMonthDays.CalendarMonthDays, {}))));
|
|
26
|
+
});
|
|
21
27
|
|
|
22
28
|
exports.CalendarBody = CalendarBody;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var ControlledDateTimePickerDatatestid = require('../../../ControlledDateTimePickerDatatestid.js');
|
|
7
8
|
var CalendarBody = require('./CalendarBody.js');
|
|
8
9
|
var CalendarHead = require('./CalendarHead.js');
|
|
9
10
|
var CalendarFooter = require('./CalendarFooter.js');
|
|
@@ -14,21 +15,26 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
15
|
|
|
15
16
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
17
|
|
|
17
|
-
var
|
|
18
|
-
// <
|
|
18
|
+
var _CalendarHead, _CalendarFooter;
|
|
19
|
+
// <StyledShadowWrapper className={className}>
|
|
19
20
|
// is required for styled-components, without this we can't styled(CalendarContent)...
|
|
20
21
|
// https://stackoverflow.com/questions/52542817/styled-components-not-applying-style-to-custom-functional-react-component
|
|
21
22
|
|
|
22
|
-
const CalendarContent =
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const CalendarContent = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
className = ''
|
|
26
|
+
} = _ref;
|
|
25
27
|
const {
|
|
26
|
-
isControllerOnly
|
|
28
|
+
isControllerOnly,
|
|
29
|
+
daysMatrixByWeekday
|
|
27
30
|
} = React.useContext(CalendarContext.CalendarContext);
|
|
28
|
-
return /*#__PURE__*/_jsx__default[
|
|
31
|
+
return /*#__PURE__*/_jsx__default["default"](Styleds.StyledShadowWrapper, {
|
|
29
32
|
className: className,
|
|
30
|
-
isControllerOnly: isControllerOnly
|
|
31
|
-
|
|
33
|
+
isControllerOnly: isControllerOnly,
|
|
34
|
+
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR
|
|
35
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledCalendarWrapper, {}, void 0, _CalendarHead || (_CalendarHead = /*#__PURE__*/_jsx__default["default"](CalendarHead.CalendarHead, {})), /*#__PURE__*/_jsx__default["default"](CalendarBody.CalendarBody, {
|
|
36
|
+
weekRowsNum: daysMatrixByWeekday.length
|
|
37
|
+
}), _CalendarFooter || (_CalendarFooter = /*#__PURE__*/_jsx__default["default"](CalendarFooter.CalendarFooter, {}))));
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
exports.CalendarContent = CalendarContent;
|
|
@@ -8,7 +8,9 @@ var React = require('react');
|
|
|
8
8
|
const noop = () => {};
|
|
9
9
|
|
|
10
10
|
const defaultCalendarContext = {
|
|
11
|
+
ariaCurrentValueForInputs: '',
|
|
11
12
|
showCalendar: false,
|
|
13
|
+
disabled: false,
|
|
12
14
|
setShowCalendar: noop,
|
|
13
15
|
closeCalendar: noop,
|
|
14
16
|
setPopperElement: noop,
|
|
@@ -25,6 +27,9 @@ const defaultCalendarContext = {
|
|
|
25
27
|
currentMonth: undefined,
|
|
26
28
|
currentYear: undefined,
|
|
27
29
|
daysArray: [],
|
|
30
|
+
invisibleFirstDay: undefined,
|
|
31
|
+
daysMatrixByWeekday: [],
|
|
32
|
+
invisibleLastDay: undefined,
|
|
28
33
|
focusedDay: undefined,
|
|
29
34
|
tryToFocusCurrentlyDataIsFocusedDay: noop,
|
|
30
35
|
resetFocusedDayToStartDate: noop,
|
|
@@ -42,6 +47,7 @@ const defaultCalendarContext = {
|
|
|
42
47
|
handlePickerIconKeyDown: noop,
|
|
43
48
|
isControllerOnly: false,
|
|
44
49
|
isWithTimeWheelToo: true,
|
|
50
|
+
autoFocusPrevMonthArrow: false,
|
|
45
51
|
onPrevYearFocus: noop,
|
|
46
52
|
onPrevMonthFocus: noop,
|
|
47
53
|
onNextMonthFocus: noop,
|
|
@@ -52,5 +58,5 @@ const defaultCalendarContext = {
|
|
|
52
58
|
const CalendarContext = /*#__PURE__*/React.createContext(defaultCalendarContext);
|
|
53
59
|
|
|
54
60
|
exports.CalendarContext = CalendarContext;
|
|
55
|
-
exports[
|
|
61
|
+
exports["default"] = CalendarContext;
|
|
56
62
|
exports.defaultCalendarContext = defaultCalendarContext;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
6
8
|
var React = require('react');
|
|
7
9
|
var Day = require('./Day.js');
|
|
8
10
|
var Styleds = require('./Styleds.js');
|
|
@@ -13,14 +15,36 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
17
|
|
|
16
|
-
const CalendarDaysList = /*#__PURE__*/React__default[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const CalendarDaysList = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
19
|
+
let {
|
|
20
|
+
invisibleFirstDay,
|
|
21
|
+
daysMatrixByWeekday,
|
|
22
|
+
invisibleLastDay,
|
|
23
|
+
innerRef
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26
|
+
ref: innerRef,
|
|
27
|
+
role: "rowgroup",
|
|
28
|
+
children: [/*#__PURE__*/_jsx__default["default"](Day.Day, {
|
|
29
|
+
metaDay: invisibleFirstDay,
|
|
30
|
+
isInvisible: true
|
|
31
|
+
}, "ds-calendar-".concat(invisibleFirstDay.day.toString())), daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx__default["default"](Styleds.StyledWeekDaysListWrapper, {
|
|
32
|
+
role: "row",
|
|
33
|
+
"aria-rowindex": i + 1,
|
|
34
|
+
cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
|
|
35
|
+
rows: ['28px'],
|
|
36
|
+
py: "xxxs",
|
|
37
|
+
px: "2px",
|
|
38
|
+
justifyContent: "space-between",
|
|
39
|
+
alignItems: "center"
|
|
40
|
+
}, "ds-calendar-week-".concat(week[0].day.toString(), "-").concat(week[6].day.toString()), week.map((metaDay, z) => /*#__PURE__*/_jsx__default["default"](Day.Day, {
|
|
41
|
+
metaDay: metaDay,
|
|
42
|
+
colIndex: z + 1
|
|
43
|
+
}, "ds-calendar-".concat(metaDay.day.toString()))))), /*#__PURE__*/_jsx__default["default"](Day.Day, {
|
|
44
|
+
metaDay: invisibleLastDay,
|
|
45
|
+
isInvisible: true
|
|
46
|
+
}, "ds-calendar-".concat(invisibleLastDay.day.toString()))]
|
|
47
|
+
});
|
|
48
|
+
});
|
|
25
49
|
|
|
26
50
|
exports.CalendarDaysList = CalendarDaysList;
|
|
@@ -19,7 +19,9 @@ const CalendarFooter = () => {
|
|
|
19
19
|
},
|
|
20
20
|
isWithTimeWheelToo
|
|
21
21
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
22
|
-
if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError) return /*#__PURE__*/_jsx__default[
|
|
22
|
+
if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError) return /*#__PURE__*/_jsx__default["default"](Styleds.CalendarFooterMessage, {
|
|
23
|
+
role: "alert"
|
|
24
|
+
}, void 0, pickerFooterMsg);
|
|
23
25
|
return null;
|
|
24
26
|
};
|
|
25
27
|
|