@elliemae/ds-controlled-form 2.4.2-rc.1 → 2.4.2-rc.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/autocomplete/config/useAutocomplete.js +0 -1
- package/cjs/autocomplete/parts/A11yFocusedOption.js +46 -0
- package/cjs/autocomplete/parts/container/Container.js +36 -24
- package/cjs/autocomplete/parts/container/styled.js +2 -2
- package/cjs/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
- package/cjs/autocomplete/parts/menu-list/MenuList.js +6 -6
- package/cjs/autocomplete/parts/menu-list/styled.js +2 -2
- package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
- package/cjs/autocomplete/parts/styled.js +2 -0
- package/cjs/autocomplete/utils/listHelper.js +1 -1
- package/cjs/checkbox/ControlledCheckbox.js +1 -1
- package/cjs/checkbox/config/useValidateProps.js +6 -3
- package/cjs/checkbox/react-desc-prop-types.js +2 -1
- package/cjs/checkbox/styles.js +73 -27
- package/cjs/checkbox/utils/styleHelpers.js +20 -2
- package/cjs/combobox/ComboBoxCTX.js +6 -3
- package/cjs/combobox/config/useComboBox.js +16 -6
- package/cjs/combobox/config/useCorrectOptions.js +1 -2
- package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
- package/cjs/combobox/parts/A11ySelectedValues.js +2 -4
- package/cjs/combobox/parts/DropdownIndicator.js +15 -7
- package/cjs/combobox/parts/container/Container.js +11 -14
- package/cjs/combobox/parts/container/styled.js +11 -10
- package/cjs/combobox/parts/controls/Controls.js +19 -27
- package/cjs/combobox/parts/controls/styled.js +54 -22
- package/cjs/combobox/parts/controls/useOnPillsNavigation.js +7 -15
- package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -2
- package/cjs/combobox/parts/controls-input/styled.js +41 -11
- package/cjs/combobox/parts/controls-input/useControlsInput.js +4 -7
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +19 -28
- package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
- package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/cjs/combobox/parts/header-list/HeaderList.js +1 -1
- package/cjs/combobox/parts/header-list/styled.js +39 -10
- package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
- package/cjs/combobox/parts/menu-list/MenuList.js +8 -6
- package/cjs/combobox/parts/menu-list/styled.js +38 -20
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +18 -17
- package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
- package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
- package/cjs/combobox/parts/styled.js +6 -7
- package/cjs/combobox/react-desc-prop-types.js +3 -2
- package/cjs/combobox/sharedTypes.js +2 -2
- package/cjs/combobox/utils/listHelper.js +14 -9
- package/cjs/date-range-picker/config/useRangePickerLogic.js +4 -8
- package/cjs/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
- package/cjs/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
- package/cjs/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
- package/cjs/date-time-picker/config/useChangeHandlers.js +11 -15
- package/cjs/date-time-picker/config/useControlledDateTimePicker.js +14 -10
- package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
- package/cjs/date-time-picker/config/useGetDestructuredValues.js +6 -6
- package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
- package/cjs/date-time-picker/config/useGetReferences.js +39 -18
- package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
- package/cjs/date-time-picker/config/useRelevantValueFromProps.js +1 -1
- package/cjs/date-time-picker/config/useValidateProps.js +42 -11
- package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +10 -2
- package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
- package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
- package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -6
- package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
- package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -6
- package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -6
- package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +84 -113
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +25 -7
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +21 -17
- package/cjs/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -15
- package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +13 -14
- package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -39
- package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
- package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -29
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -1
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +19 -27
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +15 -11
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +17 -13
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +15 -11
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -15
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +12 -17
- package/cjs/date-time-picker/parts/Styleds.js +12 -6
- package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +7 -3
- package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -7
- package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -6
- package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
- package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +55 -97
- package/cjs/date-time-picker/utils/constants.js +0 -12
- package/cjs/date-time-picker/utils/dateHelpers.js +17 -34
- package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
- package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
- package/cjs/date-time-picker/utils/stringHelpers.js +5 -11
- package/cjs/input-group/InputGroup.js +8 -7
- package/cjs/input-group/exported-related/data-test-ids.js +12 -0
- package/cjs/input-group/exported-related/index.js +12 -0
- package/cjs/input-group/exported-related/theming.js +13 -0
- package/cjs/input-group/styled.js +90 -23
- package/cjs/large-text-input/DSControlledLargeTextInput.js +1 -1
- package/cjs/large-text-input/styles.js +27 -13
- package/cjs/mask-hook/hooks/useNumberMask.js +1 -5
- package/cjs/mask-hook/hooks/usePhoneMask.js +1 -4
- package/cjs/mask-hook/hooks/useRegExpMask.js +4 -7
- package/cjs/mask-hook/hooks/useSSNMask.js +1 -4
- package/cjs/mask-hook/hooks/useZipCodeMask.js +1 -4
- package/cjs/mask-hook/utils/addSpecialCharacters.js +0 -1
- package/cjs/mask-hook/utils/flatStringArray.js +0 -1
- package/cjs/text-input/config/useInputText.js +0 -1
- package/cjs/text-input/styled/borders.js +18 -11
- package/cjs/text-input/styled/components.js +49 -10
- package/cjs/toggle/ControlledToggle.js +2 -3
- package/cjs/toggle/styles.js +7 -5
- package/esm/autocomplete/config/useAutocomplete.js +0 -1
- package/esm/autocomplete/parts/A11yFocusedOption.js +36 -0
- package/esm/autocomplete/parts/container/Container.js +39 -27
- package/esm/autocomplete/parts/container/styled.js +2 -2
- package/esm/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
- package/esm/autocomplete/parts/menu-list/MenuList.js +7 -7
- package/esm/autocomplete/parts/menu-list/styled.js +2 -2
- package/esm/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
- package/esm/autocomplete/parts/styled.js +1 -0
- package/esm/autocomplete/utils/listHelper.js +1 -1
- package/esm/checkbox/ControlledCheckbox.js +2 -2
- package/esm/checkbox/config/useValidateProps.js +6 -3
- package/esm/checkbox/react-desc-prop-types.js +2 -1
- package/esm/checkbox/styles.js +73 -24
- package/esm/checkbox/utils/styleHelpers.js +20 -2
- package/esm/combobox/ComboBoxCTX.js +6 -3
- package/esm/combobox/config/useComboBox.js +16 -6
- package/esm/combobox/config/useCorrectOptions.js +1 -2
- package/esm/combobox/parts/A11yFocusedOption.js +15 -7
- package/esm/combobox/parts/A11ySelectedValues.js +2 -4
- package/esm/combobox/parts/DropdownIndicator.js +15 -6
- package/esm/combobox/parts/container/Container.js +11 -14
- package/esm/combobox/parts/container/styled.js +11 -6
- package/esm/combobox/parts/controls/Controls.js +19 -27
- package/esm/combobox/parts/controls/styled.js +54 -18
- package/esm/combobox/parts/controls/useOnPillsNavigation.js +7 -15
- package/esm/combobox/parts/controls-input/ControlsInput.js +2 -2
- package/esm/combobox/parts/controls-input/styled.js +41 -7
- package/esm/combobox/parts/controls-input/useControlsInput.js +4 -7
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +20 -29
- package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
- package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/header-list/HeaderList.js +1 -1
- package/esm/combobox/parts/header-list/styled.js +40 -7
- package/esm/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
- package/esm/combobox/parts/menu-list/MenuList.js +8 -6
- package/esm/combobox/parts/menu-list/styled.js +38 -17
- package/esm/combobox/parts/menu-list/useItemRenderer.js +20 -19
- package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
- package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
- package/esm/combobox/parts/styled.js +6 -3
- package/esm/combobox/react-desc-prop-types.js +3 -2
- package/esm/combobox/sharedTypes.js +2 -2
- package/esm/combobox/utils/listHelper.js +14 -10
- package/esm/date-range-picker/config/useRangePickerLogic.js +3 -7
- package/esm/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
- package/esm/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
- package/esm/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
- package/esm/date-time-picker/config/useChangeHandlers.js +11 -15
- package/esm/date-time-picker/config/useControlledDateTimePicker.js +14 -10
- package/esm/date-time-picker/config/useFocusTracker.js +132 -0
- package/esm/date-time-picker/config/useGetDestructuredValues.js +6 -6
- package/esm/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
- package/esm/date-time-picker/config/useGetReferences.js +40 -19
- package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
- package/esm/date-time-picker/config/useRelevantValueFromProps.js +1 -1
- package/esm/date-time-picker/config/useValidateProps.js +42 -11
- package/esm/date-time-picker/parts/ClearButton/ClearButton.js +10 -2
- package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
- package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
- package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -6
- package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
- package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -6
- package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -6
- package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +85 -114
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +26 -8
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +21 -17
- package/esm/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -13
- package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -40
- package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
- package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -29
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -1
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +19 -27
- package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +16 -12
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +18 -14
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +16 -12
- package/esm/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
- package/esm/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -14
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
- package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +12 -17
- package/esm/date-time-picker/parts/Styleds.js +12 -6
- package/esm/date-time-picker/parts/TimeInputs/HHInput.js +7 -3
- package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -7
- package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -6
- package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
- package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +55 -97
- package/esm/date-time-picker/utils/constants.js +1 -7
- package/esm/date-time-picker/utils/dateHelpers.js +17 -34
- package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
- package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
- package/esm/date-time-picker/utils/stringHelpers.js +5 -11
- package/esm/input-group/InputGroup.js +5 -4
- package/esm/input-group/exported-related/data-test-ids.js +8 -0
- package/esm/input-group/exported-related/index.js +2 -0
- package/esm/input-group/exported-related/theming.js +8 -0
- package/esm/input-group/styled.js +89 -18
- package/esm/large-text-input/DSControlledLargeTextInput.js +1 -1
- package/esm/large-text-input/styles.js +27 -9
- package/esm/mask-hook/hooks/useNumberMask.js +1 -5
- package/esm/mask-hook/hooks/usePhoneMask.js +1 -4
- package/esm/mask-hook/hooks/useRegExpMask.js +4 -7
- package/esm/mask-hook/hooks/useSSNMask.js +1 -4
- package/esm/mask-hook/hooks/useZipCodeMask.js +1 -4
- package/esm/mask-hook/utils/addSpecialCharacters.js +0 -1
- package/esm/mask-hook/utils/flatStringArray.js +0 -1
- package/esm/text-input/config/useInputText.js +0 -1
- package/esm/text-input/styled/borders.js +18 -7
- package/esm/text-input/styled/components.js +49 -6
- package/esm/toggle/ControlledToggle.js +0 -1
- package/esm/toggle/styles.js +7 -5
- package/package.json +39 -15
- package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
- package/types/autocomplete/parts/container/styled.d.ts +1 -1
- package/types/autocomplete/parts/styled.d.ts +0 -0
- package/types/autocomplete/utils/listHelper.d.ts +5 -5
- package/types/checkbox/react-desc-prop-types.d.ts +1 -1
- package/types/checkbox/styles.d.ts +1 -0
- package/types/combobox/parts/menu-list/styled.d.ts +1 -0
- package/types/combobox/react-desc-prop-types.d.ts +8 -6
- package/types/combobox/sharedTypes.d.ts +3 -2
- package/types/combobox/utils/listHelper.d.ts +1 -0
- package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
- package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
- package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
- package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
- package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
- package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
- package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
- package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
- package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
- package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
- package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
- package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
- package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
- package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
- package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
- package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
- package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
- package/types/date-time-picker/propTypes.d.ts +117 -0
- package/types/date-time-picker/sharedTypes.d.ts +1 -1
- package/types/date-time-picker/utils/constants.d.ts +0 -6
- package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
- package/types/input-group/exported-related/index.d.ts +2 -0
- package/types/input-group/exported-related/theming.d.ts +6 -0
- package/types/input-group/styled.d.ts +4 -7
- package/types/text-input/config/useInputText.d.ts +4 -4
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
11
|
var React = require('react');
|
|
13
12
|
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
14
13
|
var useCurrentDisplayedMonthYearLogic = require('./useCurrentDisplayedMonthYearLogic.js');
|
|
@@ -25,24 +24,24 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
25
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
25
|
const useConfigCalendarCTX = () => {
|
|
27
26
|
const {
|
|
28
|
-
|
|
27
|
+
trackFocusCalendarPrevYear,
|
|
28
|
+
trackFocusCalendarNextYear,
|
|
29
|
+
trackFocusCalendarPrevMonth,
|
|
30
|
+
trackFocusCalendarNextMonth
|
|
29
31
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
30
32
|
const [showCalendar, setShowCalendar] = React.useState(false);
|
|
31
|
-
const setLatestInteractionRegionCalendarHead = React.useCallback(() => {
|
|
32
|
-
setLatestInteractionRegion('calendar-head');
|
|
33
|
-
}, [setLatestInteractionRegion]);
|
|
34
33
|
const onPrevYearFocus = React.useCallback(() => {
|
|
35
|
-
|
|
36
|
-
}, [
|
|
34
|
+
trackFocusCalendarPrevYear();
|
|
35
|
+
}, [trackFocusCalendarPrevYear]);
|
|
37
36
|
const onPrevMonthFocus = React.useCallback(() => {
|
|
38
|
-
|
|
39
|
-
}, [
|
|
37
|
+
trackFocusCalendarPrevMonth();
|
|
38
|
+
}, [trackFocusCalendarPrevMonth]);
|
|
40
39
|
const onNextMonthFocus = React.useCallback(() => {
|
|
41
|
-
|
|
42
|
-
}, [
|
|
40
|
+
trackFocusCalendarNextMonth();
|
|
41
|
+
}, [trackFocusCalendarNextMonth]);
|
|
43
42
|
const onNextYearFocus = React.useCallback(() => {
|
|
44
|
-
|
|
45
|
-
}, [
|
|
43
|
+
trackFocusCalendarNextYear();
|
|
44
|
+
}, [trackFocusCalendarNextYear]);
|
|
46
45
|
const currentDisplayedMonthLogic = useCurrentDisplayedMonthYearLogic.useCurrentDisplayedMonthYearLogic();
|
|
47
46
|
const focusLogic = useFocusLogic.useFocusLogic({
|
|
48
47
|
currentDisplayedMonthLogic,
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var useGetMonthYearFromDateStringOrEmptyStartingMonth = require('../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js');
|
|
8
7
|
var dateHelpers = require('../../../utils/dateHelpers.js');
|
|
9
8
|
|
|
9
|
+
/* eslint-disable complexity */
|
|
10
|
+
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
function sliceIntoChunks(arr, chunkSize) {
|
|
12
13
|
const res = [];
|
|
@@ -2,36 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
require('core-js/modules/esnext.async-iterator.find.js');
|
|
7
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
7
|
require('core-js/modules/esnext.iterator.find.js');
|
|
9
8
|
var React = require('react');
|
|
10
|
-
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
11
9
|
var dateHelpers = require('../../../utils/dateHelpers.js');
|
|
12
10
|
var useGetStartingFocusedDay = require('../../../utils/hooks/useGetStartingFocusedDay.js');
|
|
13
11
|
|
|
14
|
-
// eslint-disable-next-line max-params
|
|
15
|
-
const loopWhileWaiting = function (cb) {
|
|
16
|
-
let shortcircuit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => false;
|
|
17
|
-
let timePerTry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
18
|
-
let maxTries = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
|
|
19
|
-
let ab = maxTries;
|
|
20
|
-
const inter = setInterval(() => {
|
|
21
|
-
cb();
|
|
22
|
-
if (shortcircuit() || ab === 0) clearInterval(inter);
|
|
23
|
-
ab -= 1;
|
|
24
|
-
}, timePerTry);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
12
|
const useFocusLogic = _ref => {
|
|
28
13
|
let {
|
|
29
|
-
currentDisplayedMonthLogic
|
|
30
|
-
showCalendar
|
|
14
|
+
currentDisplayedMonthLogic
|
|
31
15
|
} = _ref;
|
|
32
|
-
const {
|
|
33
|
-
calendarDaysWrapperRef
|
|
34
|
-
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
35
16
|
const {
|
|
36
17
|
daysArray
|
|
37
18
|
} = currentDisplayedMonthLogic;
|
|
@@ -63,23 +44,6 @@ const useFocusLogic = _ref => {
|
|
|
63
44
|
});
|
|
64
45
|
return newFocusedDay;
|
|
65
46
|
}, [daysArray, startFocusedDate, metadayToFocus]);
|
|
66
|
-
const tryToFocusCurrentlyDataIsFocusedDay = React.useCallback(function () {
|
|
67
|
-
let wrapperDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (calendarDaysWrapperRef === null || calendarDaysWrapperRef === void 0 ? void 0 : calendarDaysWrapperRef.current) || document;
|
|
68
|
-
let shortcircuit = false;
|
|
69
|
-
loopWhileWaiting(() => {
|
|
70
|
-
const domElem = wrapperDOM === null || wrapperDOM === void 0 ? void 0 : wrapperDOM.querySelector('[data-isfocused="true"]');
|
|
71
|
-
|
|
72
|
-
if (domElem) {
|
|
73
|
-
var _domElem$focus;
|
|
74
|
-
|
|
75
|
-
domElem === null || domElem === void 0 ? void 0 : (_domElem$focus = domElem.focus) === null || _domElem$focus === void 0 ? void 0 : _domElem$focus.call(domElem);
|
|
76
|
-
shortcircuit = true;
|
|
77
|
-
}
|
|
78
|
-
}, () => shortcircuit);
|
|
79
|
-
}, [calendarDaysWrapperRef]);
|
|
80
|
-
React.useLayoutEffect(() => {
|
|
81
|
-
if (showCalendar) tryToFocusCurrentlyDataIsFocusedDay(calendarDaysWrapperRef === null || calendarDaysWrapperRef === void 0 ? void 0 : calendarDaysWrapperRef.current);
|
|
82
|
-
}, [calendarDaysWrapperRef, focusedDay, showCalendar, tryToFocusCurrentlyDataIsFocusedDay]);
|
|
83
47
|
const handleFocusMetaDay = React.useCallback(metaDayToFocus => {
|
|
84
48
|
// if focusedDay is inside current daysArray we set Focused day
|
|
85
49
|
const newFocusedMetaDay = daysArray.find(_ref5 => {
|
|
@@ -105,11 +69,10 @@ const useFocusLogic = _ref => {
|
|
|
105
69
|
}, []);
|
|
106
70
|
return React.useMemo(() => ({
|
|
107
71
|
focusedDay,
|
|
108
|
-
tryToFocusCurrentlyDataIsFocusedDay,
|
|
109
72
|
resetFocusedDayToStartDate,
|
|
110
73
|
handleFocusMetaDay,
|
|
111
74
|
handleFocusMetaDayByDay
|
|
112
|
-
}), [focusedDay,
|
|
75
|
+
}), [focusedDay, resetFocusedDayToStartDate, handleFocusMetaDay, handleFocusMetaDayByDay]);
|
|
113
76
|
};
|
|
114
77
|
|
|
115
78
|
exports.useFocusLogic = useFocusLogic;
|
|
@@ -8,7 +8,6 @@ require('core-js/modules/esnext.iterator.find.js');
|
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
10
10
|
var dateHelpers = require('../../../utils/dateHelpers.js');
|
|
11
|
-
var constants = require('../../../utils/constants.js');
|
|
12
11
|
|
|
13
12
|
const useKeyboardHandlers = _ref => {
|
|
14
13
|
let {
|
|
@@ -16,29 +15,26 @@ const useKeyboardHandlers = _ref => {
|
|
|
16
15
|
focusLogic
|
|
17
16
|
} = _ref;
|
|
18
17
|
const {
|
|
19
|
-
hideDate,
|
|
20
|
-
hideTime,
|
|
21
|
-
monthInputRef,
|
|
22
|
-
hourInputRef,
|
|
23
|
-
prevYearBtnRef,
|
|
24
|
-
prevMonthBtnRef,
|
|
25
|
-
nextMonthBtnRef,
|
|
26
|
-
nextYearBtnRef,
|
|
27
|
-
currMeridiemBtnRef,
|
|
28
18
|
isControllerOnly,
|
|
29
19
|
isWithTimeWheelToo,
|
|
30
|
-
setLatestInteractionRegion,
|
|
31
20
|
withAnyInputs,
|
|
32
21
|
isWithTimeInputs,
|
|
33
|
-
meridiemInputRef,
|
|
34
22
|
isWithDateInputs,
|
|
35
|
-
|
|
23
|
+
trackFocusFirstSegment,
|
|
24
|
+
trackFocusMeridiemInput,
|
|
25
|
+
trackFocusYearInput,
|
|
26
|
+
trackFocusCalendarPrevMonth,
|
|
27
|
+
trackFocusCalendarNextMonth,
|
|
28
|
+
trackFocusCalendarNextYear,
|
|
29
|
+
trackFocusCalendarPrevYear,
|
|
30
|
+
trackFocusTimewheelCurrMeridiem,
|
|
31
|
+
trackFocusCalendarMetafocusedDay
|
|
36
32
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
37
33
|
const {
|
|
38
34
|
focusedDay,
|
|
39
35
|
handleFocusMetaDay,
|
|
40
|
-
handleFocusMetaDayByDay
|
|
41
|
-
|
|
36
|
+
handleFocusMetaDayByDay // tryToFocusCurrentlyDataIsFocusedDay
|
|
37
|
+
|
|
42
38
|
} = focusLogic;
|
|
43
39
|
const {
|
|
44
40
|
daysArray,
|
|
@@ -46,8 +42,6 @@ const useKeyboardHandlers = _ref => {
|
|
|
46
42
|
handleNextMonth
|
|
47
43
|
} = currentDisplayedMonthLogic;
|
|
48
44
|
const tryToFocusDayRegion = React.useCallback(() => {
|
|
49
|
-
setLatestInteractionRegion('calendar-days');
|
|
50
|
-
|
|
51
45
|
if (!focusedDay) {
|
|
52
46
|
const newFocusDay = daysArray.find(_ref2 => {
|
|
53
47
|
let {
|
|
@@ -55,42 +49,32 @@ const useKeyboardHandlers = _ref => {
|
|
|
55
49
|
} = _ref2;
|
|
56
50
|
return isCurrMonthDay;
|
|
57
51
|
});
|
|
58
|
-
if (newFocusDay)
|
|
59
|
-
handleFocusMetaDay(newFocusDay);
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
tryToFocusCurrentlyDataIsFocusedDay();
|
|
52
|
+
if (newFocusDay) handleFocusMetaDay(newFocusDay);
|
|
63
53
|
}
|
|
64
|
-
}, [daysArray, focusedDay, handleFocusMetaDay, setLatestInteractionRegion, tryToFocusCurrentlyDataIsFocusedDay]);
|
|
65
|
-
const onHomeKeyDownInsideCalendar = React.useCallback(() => {
|
|
66
|
-
var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
|
|
67
54
|
|
|
68
|
-
|
|
69
|
-
}, [
|
|
55
|
+
trackFocusCalendarMetafocusedDay();
|
|
56
|
+
}, [daysArray, focusedDay, handleFocusMetaDay, trackFocusCalendarMetafocusedDay]);
|
|
57
|
+
const onHomeKeyDownInsideCalendar = React.useCallback(() => {
|
|
58
|
+
trackFocusCalendarPrevMonth();
|
|
59
|
+
}, [trackFocusCalendarPrevMonth]);
|
|
70
60
|
const onEndKeyDownInsideCalendar = React.useCallback(() => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (isWithTimeWheelToo) 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);else tryToFocusDayRegion();
|
|
74
|
-
}, [currMeridiemBtnRef, isWithTimeWheelToo, tryToFocusDayRegion]);
|
|
61
|
+
if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
|
|
62
|
+
}, [isWithTimeWheelToo, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
|
|
75
63
|
const onHomeKeyDownTriggerIcon = React.useCallback(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
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);
|
|
79
|
-
}, [hideDate, hideTime, monthInputRef, hourInputRef]);
|
|
64
|
+
trackFocusFirstSegment();
|
|
65
|
+
}, [trackFocusFirstSegment]);
|
|
80
66
|
const handlePickerIconKeyDown = React.useCallback(e => {
|
|
81
67
|
const {
|
|
82
68
|
key
|
|
83
69
|
} = e;
|
|
84
|
-
if (
|
|
85
|
-
if (
|
|
70
|
+
if (['Home', 'End'].includes(key)) e.preventDefault();
|
|
71
|
+
if (['Home', 'End'].includes(key)) e.stopPropagation();
|
|
86
72
|
if (key === 'Home') onHomeKeyDownTriggerIcon();
|
|
87
73
|
|
|
88
74
|
if (key === 'Backspace' && withAnyInputs) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
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);
|
|
75
|
+
if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
|
|
92
76
|
}
|
|
93
|
-
}, [isWithDateInputs, isWithTimeInputs,
|
|
77
|
+
}, [isWithDateInputs, isWithTimeInputs, onHomeKeyDownTriggerIcon, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
|
|
94
78
|
const handleDayOnKeyDown = React.useCallback((e, metaDay) => {
|
|
95
79
|
let newFocusedDayDate;
|
|
96
80
|
const {
|
|
@@ -100,8 +84,8 @@ const useKeyboardHandlers = _ref => {
|
|
|
100
84
|
key,
|
|
101
85
|
shiftKey
|
|
102
86
|
} = e;
|
|
103
|
-
if (
|
|
104
|
-
if (
|
|
87
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
|
|
88
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
|
|
105
89
|
if (key === 'ArrowUp') newFocusedDayDate = dateHelpers.sumValuesToDate(day, {
|
|
106
90
|
daysToSum: -7
|
|
107
91
|
});
|
|
@@ -131,21 +115,18 @@ const useKeyboardHandlers = _ref => {
|
|
|
131
115
|
|
|
132
116
|
if (newFocusedDayDate) {
|
|
133
117
|
handleFocusMetaDayByDay(newFocusedDayDate);
|
|
134
|
-
setTimeout(tryToFocusCurrentlyDataIsFocusedDay);
|
|
135
118
|
}
|
|
136
119
|
|
|
137
120
|
if (key === 'Home') onHomeKeyDownInsideCalendar();
|
|
138
121
|
if (key === 'End') onEndKeyDownInsideCalendar(); // TAB CYCLE IMPLEMENTATION
|
|
139
122
|
|
|
140
123
|
if (key === 'Tab' && !shiftKey && isControllerOnly === false && !isWithTimeWheelToo) {
|
|
141
|
-
var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4;
|
|
142
|
-
|
|
143
124
|
// MUST prevent default since this is a custom focus switch
|
|
144
125
|
// NOT preventing the default event will cause unexpected result
|
|
145
126
|
e.preventDefault();
|
|
146
|
-
|
|
127
|
+
trackFocusCalendarPrevMonth();
|
|
147
128
|
}
|
|
148
|
-
}, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar,
|
|
129
|
+
}, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth]);
|
|
149
130
|
const handlePrevYearKeyDown = React.useCallback(e => {
|
|
150
131
|
const {
|
|
151
132
|
key,
|
|
@@ -156,13 +137,9 @@ const useKeyboardHandlers = _ref => {
|
|
|
156
137
|
e.preventDefault();
|
|
157
138
|
|
|
158
139
|
if (shiftKey) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
(_nextMonthBtnRef$curr = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr === void 0 ? void 0 : _nextMonthBtnRef$curr.focus();
|
|
140
|
+
trackFocusCalendarNextMonth();
|
|
162
141
|
} else {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(_nextYearBtnRef$curre = nextYearBtnRef.current) === null || _nextYearBtnRef$curre === void 0 ? void 0 : _nextYearBtnRef$curre.focus();
|
|
142
|
+
trackFocusCalendarNextYear();
|
|
166
143
|
}
|
|
167
144
|
}
|
|
168
145
|
|
|
@@ -175,7 +152,7 @@ const useKeyboardHandlers = _ref => {
|
|
|
175
152
|
onEndKeyDownInsideCalendar();
|
|
176
153
|
e.preventDefault();
|
|
177
154
|
}
|
|
178
|
-
}, [
|
|
155
|
+
}, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusCalendarNextYear]);
|
|
179
156
|
const handlePrevMonthKeyDown = React.useCallback(e => {
|
|
180
157
|
const {
|
|
181
158
|
key,
|
|
@@ -186,16 +163,12 @@ const useKeyboardHandlers = _ref => {
|
|
|
186
163
|
if (shiftKey) {
|
|
187
164
|
// TAB CYCLE IMPLEMENTATION
|
|
188
165
|
if (!isControllerOnly) {
|
|
189
|
-
var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
|
|
190
|
-
|
|
191
166
|
e.preventDefault();
|
|
192
|
-
if (isWithTimeWheelToo)
|
|
167
|
+
if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
|
|
193
168
|
}
|
|
194
169
|
} else {
|
|
195
|
-
var _nextMonthBtnRef$curr2;
|
|
196
|
-
|
|
197
170
|
e.preventDefault();
|
|
198
|
-
(
|
|
171
|
+
trackFocusCalendarNextMonth();
|
|
199
172
|
}
|
|
200
173
|
}
|
|
201
174
|
|
|
@@ -208,7 +181,7 @@ const useKeyboardHandlers = _ref => {
|
|
|
208
181
|
onEndKeyDownInsideCalendar();
|
|
209
182
|
e.preventDefault();
|
|
210
183
|
}
|
|
211
|
-
}, [
|
|
184
|
+
}, [isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
|
|
212
185
|
const handleNextMonthKeyDown = React.useCallback(e => {
|
|
213
186
|
const {
|
|
214
187
|
key,
|
|
@@ -219,13 +192,9 @@ const useKeyboardHandlers = _ref => {
|
|
|
219
192
|
e.preventDefault();
|
|
220
193
|
|
|
221
194
|
if (shiftKey) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
(_prevMonthBtnRef$curr5 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr5 === void 0 ? void 0 : _prevMonthBtnRef$curr5.focus();
|
|
195
|
+
trackFocusCalendarPrevMonth();
|
|
225
196
|
} else {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
(_prevYearBtnRef$curre = prevYearBtnRef.current) === null || _prevYearBtnRef$curre === void 0 ? void 0 : _prevYearBtnRef$curre.focus();
|
|
197
|
+
trackFocusCalendarPrevYear();
|
|
229
198
|
}
|
|
230
199
|
}
|
|
231
200
|
|
|
@@ -238,7 +207,7 @@ const useKeyboardHandlers = _ref => {
|
|
|
238
207
|
onEndKeyDownInsideCalendar();
|
|
239
208
|
e.preventDefault();
|
|
240
209
|
}
|
|
241
|
-
}, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar,
|
|
210
|
+
}, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth, trackFocusCalendarPrevYear]);
|
|
242
211
|
const handleNextYearKeyDown = React.useCallback(e => {
|
|
243
212
|
const {
|
|
244
213
|
key,
|
|
@@ -249,9 +218,7 @@ const useKeyboardHandlers = _ref => {
|
|
|
249
218
|
e.preventDefault();
|
|
250
219
|
|
|
251
220
|
if (shiftKey) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
prevYearBtnRef === null || prevYearBtnRef === void 0 ? void 0 : (_prevYearBtnRef$curre2 = prevYearBtnRef.current) === null || _prevYearBtnRef$curre2 === void 0 ? void 0 : (_prevYearBtnRef$curre3 = _prevYearBtnRef$curre2.focus) === null || _prevYearBtnRef$curre3 === void 0 ? void 0 : _prevYearBtnRef$curre3.call(_prevYearBtnRef$curre2);
|
|
221
|
+
trackFocusCalendarPrevYear();
|
|
255
222
|
}
|
|
256
223
|
|
|
257
224
|
if (!shiftKey) tryToFocusDayRegion();
|
|
@@ -266,7 +233,7 @@ const useKeyboardHandlers = _ref => {
|
|
|
266
233
|
onEndKeyDownInsideCalendar();
|
|
267
234
|
e.preventDefault();
|
|
268
235
|
}
|
|
269
|
-
}, [tryToFocusDayRegion,
|
|
236
|
+
}, [tryToFocusDayRegion, trackFocusCalendarPrevYear, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
|
|
270
237
|
return React.useMemo(() => ({
|
|
271
238
|
handleDayOnKeyDown,
|
|
272
239
|
handlePrevYearKeyDown,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var reactPopper = require('react-popper');
|
|
8
7
|
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
9
8
|
var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
|
|
10
9
|
|
|
10
|
+
/* eslint-disable complexity */
|
|
11
11
|
const usePopperTriggerLogic = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
focusLogic,
|
|
@@ -16,16 +16,19 @@ const usePopperTriggerLogic = _ref => {
|
|
|
16
16
|
} = _ref;
|
|
17
17
|
const {
|
|
18
18
|
focusedDay,
|
|
19
|
-
resetFocusedDayToStartDate
|
|
20
|
-
tryToFocusCurrentlyDataIsFocusedDay
|
|
19
|
+
resetFocusedDayToStartDate
|
|
21
20
|
} = focusLogic;
|
|
22
21
|
const {
|
|
23
22
|
props: {
|
|
24
23
|
onPickerOpen,
|
|
25
24
|
onPickerClose
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
pickerButtonRef,
|
|
27
|
+
trackFocusCalendarMetafocusedDay,
|
|
28
|
+
trackFocusCalendarPrevMonth,
|
|
29
|
+
trackFocusPicker,
|
|
30
|
+
latestInteractionRegion,
|
|
31
|
+
currFocusDescriber
|
|
29
32
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
30
33
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
31
34
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
@@ -41,29 +44,18 @@ const usePopperTriggerLogic = _ref => {
|
|
|
41
44
|
|
|
42
45
|
const handleOnPickerOpen = React.useCallback(() => {
|
|
43
46
|
onPickerOpen();
|
|
44
|
-
|
|
45
|
-
}, [onPickerOpen, tryToFocusCurrentlyDataIsFocusedDay]);
|
|
47
|
+
}, [onPickerOpen]);
|
|
46
48
|
const openCalendar = React.useCallback(() => {
|
|
47
|
-
if (focusedDay)
|
|
48
|
-
var _focusedDay$dayBtnRef, _focusedDay$dayBtnRef2, _focusedDay$dayBtnRef3;
|
|
49
|
-
|
|
50
|
-
return focusedDay === null || focusedDay === void 0 ? void 0 : (_focusedDay$dayBtnRef = focusedDay.dayBtnRef) === null || _focusedDay$dayBtnRef === void 0 ? void 0 : (_focusedDay$dayBtnRef2 = _focusedDay$dayBtnRef.current) === null || _focusedDay$dayBtnRef2 === void 0 ? void 0 : (_focusedDay$dayBtnRef3 = _focusedDay$dayBtnRef2.focus) === null || _focusedDay$dayBtnRef3 === void 0 ? void 0 : _focusedDay$dayBtnRef3.call(_focusedDay$dayBtnRef2);
|
|
51
|
-
}, 100);else setTimeout(() => {
|
|
52
|
-
var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
|
|
53
|
-
|
|
54
|
-
return 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);
|
|
55
|
-
}, 100);
|
|
49
|
+
if (focusedDay) trackFocusCalendarMetafocusedDay();else trackFocusCalendarPrevMonth();
|
|
56
50
|
setShowCalendar(true);
|
|
57
51
|
handleOnPickerOpen();
|
|
58
|
-
}, [focusedDay, handleOnPickerOpen,
|
|
52
|
+
}, [focusedDay, handleOnPickerOpen, setShowCalendar, trackFocusCalendarMetafocusedDay, trackFocusCalendarPrevMonth]);
|
|
59
53
|
const closeCalendar = React.useCallback(() => {
|
|
60
|
-
var _pickerButtonRef$curr, _pickerButtonRef$curr2;
|
|
61
|
-
|
|
62
54
|
setShowCalendar(false);
|
|
63
55
|
onPickerClose();
|
|
64
56
|
resetFocusedDayToStartDate();
|
|
65
|
-
|
|
66
|
-
}, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate,
|
|
57
|
+
trackFocusPicker();
|
|
58
|
+
}, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker]);
|
|
67
59
|
const handleToggleCalendar = React.useCallback(() => {
|
|
68
60
|
const isOpening = !showCalendar;
|
|
69
61
|
if (isOpening) openCalendar();else closeCalendar();
|
|
@@ -71,23 +63,20 @@ const usePopperTriggerLogic = _ref => {
|
|
|
71
63
|
const handleSetTriggerRef = React.useCallback(newRef => {
|
|
72
64
|
pickerButtonRef.current = newRef;
|
|
73
65
|
setReferenceElement(newRef);
|
|
74
|
-
|
|
66
|
+
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef?.focus();
|
|
67
|
+
}, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
|
|
75
68
|
const handleMenuWrapperKeyDown = React.useCallback(e => {
|
|
76
69
|
const {
|
|
77
70
|
key
|
|
78
71
|
} = e;
|
|
79
72
|
|
|
80
73
|
if (key === 'Escape') {
|
|
81
|
-
var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
|
|
82
|
-
|
|
83
74
|
closeCalendar();
|
|
84
|
-
|
|
75
|
+
trackFocusPicker();
|
|
85
76
|
}
|
|
86
|
-
}, [closeCalendar,
|
|
77
|
+
}, [closeCalendar, trackFocusPicker]);
|
|
87
78
|
useOnClickOutside.useOnClickOutside(popperElement, e => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr5 = pickerButtonRef.current) !== null && _pickerButtonRef$curr5 !== void 0 && (_pickerButtonRef$curr6 = _pickerButtonRef$curr5.contains) !== null && _pickerButtonRef$curr6 !== void 0 && _pickerButtonRef$curr6.call(_pickerButtonRef$curr5, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
|
|
79
|
+
if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
|
|
91
80
|
});
|
|
92
81
|
return React.useMemo(() => ({
|
|
93
82
|
closeCalendar,
|
package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js
CHANGED
|
@@ -27,8 +27,9 @@ const CalendarWithTimeWheelIconTrigger = () => {
|
|
|
27
27
|
disabled
|
|
28
28
|
} = React.useContext(CalendarWithTimeWheelContext.CalendarWithTimeWheelContext);
|
|
29
29
|
return React.useMemo(() => /*#__PURE__*/_jsx__default["default"](Styleds.StyledIconTriggerButton, {
|
|
30
|
-
"aria-label":
|
|
30
|
+
"aria-label": `date time picker context menu trigger, ${ariaCurrentValueForInputs}`,
|
|
31
31
|
buttonType: "icon",
|
|
32
|
+
type: "button",
|
|
32
33
|
size: DSButton.BUTTON_SIZES.M,
|
|
33
34
|
innerRef: handleSetTriggerRef,
|
|
34
35
|
onClick: handleToggleCalendarWithTimeWheel,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var reactPopper = require('react-popper');
|
|
8
7
|
var ControlledDateTimePickerTypes = require('../../../ControlledDateTimePickerTypes.js');
|
|
@@ -10,8 +9,8 @@ var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.
|
|
|
10
9
|
var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
|
|
11
10
|
var CalendarContext = require('../Calendar/CalendarContext.js');
|
|
12
11
|
var TimeWheelContext = require('../TimeWheel/TimeWheelContext.js');
|
|
13
|
-
var constants = require('../../../utils/constants.js');
|
|
14
12
|
|
|
13
|
+
/* eslint-disable max-statements */
|
|
15
14
|
const useConfigCalendarWithTimeWheelCTX = () => {
|
|
16
15
|
const {
|
|
17
16
|
pickerButtonRef,
|
|
@@ -21,15 +20,15 @@ const useConfigCalendarWithTimeWheelCTX = () => {
|
|
|
21
20
|
onPickerClose,
|
|
22
21
|
disabled
|
|
23
22
|
},
|
|
24
|
-
hideDate,
|
|
25
|
-
hideTime,
|
|
26
|
-
monthInputRef,
|
|
27
|
-
hourInputRef,
|
|
28
23
|
withAnyInputs,
|
|
29
24
|
isWithTimeInputs,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
ariaCurrentValueForInputs,
|
|
26
|
+
trackFocusFirstSegment,
|
|
27
|
+
trackFocusMeridiemInput,
|
|
28
|
+
trackFocusYearInput,
|
|
29
|
+
trackFocusPicker,
|
|
30
|
+
latestInteractionRegion,
|
|
31
|
+
currFocusDescriber
|
|
33
32
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
34
33
|
const {
|
|
35
34
|
handleToggleCalendar
|
|
@@ -39,24 +38,20 @@ const useConfigCalendarWithTimeWheelCTX = () => {
|
|
|
39
38
|
} = React.useContext(TimeWheelContext.TimeWheelContext);
|
|
40
39
|
const [showCalendarWithTimeWheel, setShowCalendarWithTimeWheel] = React.useState(false);
|
|
41
40
|
const onHomeKeyDown = React.useCallback(() => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
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);
|
|
45
|
-
}, [hideDate, hideTime, monthInputRef, hourInputRef]);
|
|
41
|
+
trackFocusFirstSegment();
|
|
42
|
+
}, [trackFocusFirstSegment]);
|
|
46
43
|
const handlePickerIconKeyDown = React.useCallback(e => {
|
|
47
44
|
const {
|
|
48
45
|
key
|
|
49
46
|
} = e;
|
|
50
|
-
if (
|
|
51
|
-
if (
|
|
47
|
+
if (['Home', 'End'].includes(key)) e.preventDefault();
|
|
48
|
+
if (['Home', 'End'].includes(key)) e.stopPropagation();
|
|
52
49
|
if (key === 'Home') onHomeKeyDown();
|
|
53
50
|
|
|
54
51
|
if (key === 'Backspace' && withAnyInputs) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
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 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);
|
|
52
|
+
if (isWithTimeInputs) trackFocusMeridiemInput();else trackFocusYearInput();
|
|
58
53
|
}
|
|
59
|
-
}, [isWithTimeInputs,
|
|
54
|
+
}, [isWithTimeInputs, onHomeKeyDown, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
|
|
60
55
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
61
56
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
62
57
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
@@ -84,26 +79,23 @@ const useConfigCalendarWithTimeWheelCTX = () => {
|
|
|
84
79
|
if (!showCalendarWithTimeWheel) openCalendar();else closeCalendar();
|
|
85
80
|
}, [closeCalendar, openCalendar, showCalendarWithTimeWheel]);
|
|
86
81
|
useOnClickOutside.useOnClickOutside(popperElement, e => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr = pickerButtonRef.current) !== null && _pickerButtonRef$curr !== void 0 && (_pickerButtonRef$curr2 = _pickerButtonRef$curr.contains) !== null && _pickerButtonRef$curr2 !== void 0 && _pickerButtonRef$curr2.call(_pickerButtonRef$curr, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
|
|
82
|
+
if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
|
|
90
83
|
});
|
|
91
84
|
const handleSetTriggerRef = React.useCallback(newRef => {
|
|
92
85
|
pickerButtonRef.current = newRef;
|
|
93
86
|
setReferenceElement(newRef);
|
|
94
|
-
|
|
87
|
+
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'datetime-picker-icon') newRef?.focus();
|
|
88
|
+
}, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
|
|
95
89
|
const handleMenuWrapperKeyDown = React.useCallback(e => {
|
|
96
90
|
const {
|
|
97
91
|
key
|
|
98
92
|
} = e;
|
|
99
93
|
|
|
100
94
|
if (key === 'Escape') {
|
|
101
|
-
var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
|
|
102
|
-
|
|
103
95
|
closeCalendar();
|
|
104
|
-
|
|
96
|
+
trackFocusPicker();
|
|
105
97
|
}
|
|
106
|
-
}, [closeCalendar,
|
|
98
|
+
}, [closeCalendar, trackFocusPicker]);
|
|
107
99
|
const isControllerOnly = React.useMemo(() => type === ControlledDateTimePickerTypes.CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY, [type]);
|
|
108
100
|
return React.useMemo(() => ({
|
|
109
101
|
showCalendarWithTimeWheel,
|