@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
|
@@ -35,34 +35,27 @@ const useDateInputs = () => {
|
|
|
35
35
|
day,
|
|
36
36
|
year,
|
|
37
37
|
hideTime,
|
|
38
|
-
monthInputRef,
|
|
39
|
-
dayInputRef,
|
|
40
|
-
yearInputRef,
|
|
41
|
-
hourInputRef,
|
|
42
|
-
meridiemInputRef,
|
|
43
|
-
clearButtonRef,
|
|
44
|
-
pickerButtonRef,
|
|
45
38
|
handleChangeComposedDateString,
|
|
46
|
-
setLatestInteractionRegion,
|
|
47
39
|
withClearBtn,
|
|
48
40
|
withAnyPicker,
|
|
49
41
|
withAnyRightController,
|
|
50
42
|
autoFocusMonthInput,
|
|
51
|
-
|
|
43
|
+
trackFocusResetter,
|
|
44
|
+
trackFocusFirstSegment,
|
|
45
|
+
trackFocusLastSegment,
|
|
46
|
+
trackFocusDayInput,
|
|
47
|
+
trackFocusMonthInput,
|
|
48
|
+
trackFocusYearInput,
|
|
49
|
+
trackFocusHourInput,
|
|
50
|
+
trackFocusClearBtn,
|
|
51
|
+
trackFocusPicker
|
|
52
52
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
53
53
|
const onHomeKeyDown = React.useCallback(() => {
|
|
54
|
-
|
|
55
|
-
|
|
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);
|
|
57
|
-
}, [monthInputRef]);
|
|
54
|
+
trackFocusFirstSegment();
|
|
55
|
+
}, [trackFocusFirstSegment]);
|
|
58
56
|
const onEndKeyDown = React.useCallback(() => {
|
|
59
|
-
|
|
60
|
-
|
|
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]);
|
|
63
|
-
const setLatestInteractionRegionDateInputs = React.useCallback(() => {
|
|
64
|
-
setLatestInteractionRegion('date-inputs');
|
|
65
|
-
}, [setLatestInteractionRegion]);
|
|
57
|
+
trackFocusLastSegment();
|
|
58
|
+
}, [trackFocusLastSegment]);
|
|
66
59
|
const handleChangeMonth = React.useCallback(function (newMonth, e) {
|
|
67
60
|
let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : constants.defaultMetaInfo;
|
|
68
61
|
const newDateString = stringHelpers.getFormattedDateString({
|
|
@@ -79,29 +72,25 @@ const useDateInputs = () => {
|
|
|
79
72
|
handleChangeComposedDateString(newDateString, finalMetaInfo);
|
|
80
73
|
}, [day, year, getIsOutOfRangeDay, getIsDisabledDay, appOnMonthChange, handleChangeComposedDateString]);
|
|
81
74
|
const onMonthFocus = React.useCallback(() => {
|
|
82
|
-
|
|
83
|
-
}, [
|
|
75
|
+
trackFocusMonthInput();
|
|
76
|
+
}, [trackFocusMonthInput]);
|
|
84
77
|
const onMonthChange = React.useCallback(e => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
let newMonth = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts months 2~9 to 02~09
|
|
78
|
+
let newMonth = e?.target?.value; // converts months 2~9 to 02~09
|
|
88
79
|
|
|
89
80
|
if (Number.parseInt(newMonth, 10) > 1) newMonth = stringHelpers.prependStringWithPlaceHolders(newMonth, 2);
|
|
90
81
|
handleChangeMonth(newMonth, e); // auto-advance functionality:
|
|
91
82
|
|
|
92
|
-
if (newMonth.length === 2)
|
|
93
|
-
}, [
|
|
83
|
+
if (newMonth.length === 2) trackFocusDayInput();
|
|
84
|
+
}, [handleChangeMonth, trackFocusDayInput]);
|
|
94
85
|
const onMonthKeyDown = React.useCallback(e => {
|
|
95
|
-
var _lastSegmentRef$curre, _lastSegmentRef$curre2;
|
|
96
|
-
|
|
97
86
|
const {
|
|
98
87
|
key,
|
|
99
88
|
ctrlKey,
|
|
100
89
|
metaKey
|
|
101
90
|
} = e;
|
|
102
91
|
const monthStringConvertedToInteger = Number.parseInt(month, 10);
|
|
103
|
-
if (
|
|
104
|
-
if (
|
|
92
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.preventDefault();
|
|
93
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.stopPropagation();
|
|
105
94
|
if (key === 'Home') onHomeKeyDown();
|
|
106
95
|
if (key === 'End') onEndKeyDown();
|
|
107
96
|
|
|
@@ -109,26 +98,22 @@ const useDateInputs = () => {
|
|
|
109
98
|
const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
|
|
110
99
|
let newMonth;
|
|
111
100
|
if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
|
|
112
|
-
newMonth = stringHelpers.prependStringWithPlaceHolders(
|
|
101
|
+
newMonth = stringHelpers.prependStringWithPlaceHolders(`${newMonth}`, 2);
|
|
113
102
|
handleChangeMonth(newMonth, e);
|
|
114
103
|
}
|
|
115
104
|
|
|
116
105
|
if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const newMonth = stringHelpers.prependStringWithPlaceHolders("".concat(monthStringConvertedToInteger), 2);
|
|
106
|
+
const newMonth = stringHelpers.prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);
|
|
120
107
|
handleChangeMonth(newMonth, e); // auto-advance functionality:
|
|
121
108
|
|
|
122
|
-
if (newMonth.length === 2)
|
|
109
|
+
if (newMonth.length === 2) trackFocusDayInput();
|
|
123
110
|
} // focus last fragment on fill with now
|
|
124
111
|
|
|
125
112
|
|
|
126
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
127
|
-
}, [month, onHomeKeyDown, onEndKeyDown,
|
|
113
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
114
|
+
}, [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth]);
|
|
128
115
|
const onMonthBlur = React.useCallback(e => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
|
|
116
|
+
const newMonth = e?.target?.value;
|
|
132
117
|
if (newMonth === '0') handleChangeMonth('01', e, {
|
|
133
118
|
isAutomaticFillTrigger: true
|
|
134
119
|
});else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(stringHelpers.prependStringWithPlaceHolders(newMonth, 2), e, {
|
|
@@ -151,29 +136,25 @@ const useDateInputs = () => {
|
|
|
151
136
|
handleChangeComposedDateString(newDateString, finalMetaInfo);
|
|
152
137
|
}, [month, year, getIsOutOfRangeDay, getIsDisabledDay, appOnDayChange, handleChangeComposedDateString]);
|
|
153
138
|
const onDayFocus = React.useCallback(() => {
|
|
154
|
-
|
|
155
|
-
}, [
|
|
139
|
+
trackFocusDayInput();
|
|
140
|
+
}, [trackFocusDayInput]);
|
|
156
141
|
const onDayChange = React.useCallback(e => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
let newDay = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts days 4~9 to 04~09
|
|
142
|
+
let newDay = e?.target?.value; // converts days 4~9 to 04~09
|
|
160
143
|
|
|
161
144
|
if (Number.parseInt(newDay, 10) > 3) newDay = stringHelpers.prependStringWithPlaceHolders(newDay, 2);
|
|
162
145
|
handleChangeDay(newDay, e); // auto-advance functionality:
|
|
163
146
|
|
|
164
|
-
if (newDay.length === 2)
|
|
165
|
-
}, [handleChangeDay,
|
|
147
|
+
if (newDay.length === 2) trackFocusYearInput();
|
|
148
|
+
}, [handleChangeDay, trackFocusYearInput]);
|
|
166
149
|
const onDayKeyDown = React.useCallback(e => {
|
|
167
|
-
var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
|
|
168
|
-
|
|
169
150
|
const {
|
|
170
151
|
key,
|
|
171
152
|
ctrlKey,
|
|
172
153
|
metaKey
|
|
173
154
|
} = e;
|
|
174
155
|
const dayStringConvertedToInteger = Number.parseInt(day, 10);
|
|
175
|
-
if (
|
|
176
|
-
if (
|
|
156
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.preventDefault();
|
|
157
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.stopPropagation();
|
|
177
158
|
if (key === 'Home') onHomeKeyDown();
|
|
178
159
|
if (key === 'End') onEndKeyDown();
|
|
179
160
|
|
|
@@ -181,33 +162,27 @@ const useDateInputs = () => {
|
|
|
181
162
|
const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
|
|
182
163
|
let newDay;
|
|
183
164
|
if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
|
|
184
|
-
newDay = stringHelpers.prependStringWithPlaceHolders(
|
|
165
|
+
newDay = stringHelpers.prependStringWithPlaceHolders(`${newDay}`, 2);
|
|
185
166
|
handleChangeDay(newDay, e);
|
|
186
167
|
}
|
|
187
168
|
|
|
188
169
|
if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const newDay = stringHelpers.prependStringWithPlaceHolders("".concat(dayStringConvertedToInteger), 2);
|
|
170
|
+
const newDay = stringHelpers.prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);
|
|
192
171
|
handleChangeDay(newDay, e); // auto-advance functionality:
|
|
193
172
|
|
|
194
|
-
if (newDay.length === 2)
|
|
173
|
+
if (newDay.length === 2) trackFocusYearInput();
|
|
195
174
|
} // regressive backspace functionality
|
|
196
175
|
|
|
197
176
|
|
|
198
|
-
if (key === 'Backspace' &&
|
|
199
|
-
|
|
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);
|
|
177
|
+
if (key === 'Backspace' && day?.length === 0) {
|
|
178
|
+
trackFocusMonthInput();
|
|
202
179
|
} // focus last fragment on fill with now
|
|
203
180
|
|
|
204
181
|
|
|
205
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
206
|
-
}, [day, onHomeKeyDown, onEndKeyDown,
|
|
182
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
183
|
+
}, [day, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, handleChangeDay, trackFocusYearInput, trackFocusMonthInput]);
|
|
207
184
|
const onDayBlur = React.useCallback(e => {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
|
|
185
|
+
const newDay = e?.target?.value;
|
|
211
186
|
if (newDay === '0') handleChangeDay('01', e, {
|
|
212
187
|
isAutomaticFillTrigger: true
|
|
213
188
|
});else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(stringHelpers.prependStringWithPlaceHolders(newDay, 2), e, {
|
|
@@ -230,79 +205,75 @@ const useDateInputs = () => {
|
|
|
230
205
|
handleChangeComposedDateString(newDateString, finalMetaInfo);
|
|
231
206
|
}, [month, day, getIsOutOfRangeDay, getIsDisabledDay, appOnYearChange, handleChangeComposedDateString]);
|
|
232
207
|
const onYearFocus = React.useCallback(() => {
|
|
233
|
-
|
|
234
|
-
}, [
|
|
208
|
+
trackFocusYearInput();
|
|
209
|
+
}, [trackFocusYearInput]);
|
|
235
210
|
const onYearChange = React.useCallback(e => {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const newYear = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : _e$target5.value;
|
|
211
|
+
const newYear = e?.target?.value;
|
|
239
212
|
handleChangeYear(newYear, e); // auto-advance functionality:
|
|
240
213
|
|
|
241
214
|
if (newYear.length === 4) {
|
|
242
|
-
|
|
243
|
-
|
|
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) {
|
|
245
|
-
var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
|
|
246
|
-
|
|
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...
|
|
215
|
+
if (!hideTime) trackFocusHourInput();else if (withAnyRightController) {
|
|
216
|
+
if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker(); // pending approval from Seda, check which one should be focused first...
|
|
248
217
|
}
|
|
249
218
|
}
|
|
250
|
-
}, [handleChangeYear, hideTime,
|
|
219
|
+
}, [handleChangeYear, hideTime, trackFocusHourInput, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
|
|
251
220
|
const onYearKeyDown = React.useCallback(e => {
|
|
252
|
-
var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
|
|
253
|
-
|
|
254
221
|
const {
|
|
255
222
|
key,
|
|
256
223
|
ctrlKey,
|
|
257
224
|
metaKey
|
|
258
225
|
} = e;
|
|
226
|
+
/* ****** New year value calculator logic ********* */
|
|
227
|
+
|
|
259
228
|
const yearStringConvertedToInteger = Number.parseInt(year, 10);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (key === 'Home') onHomeKeyDown();
|
|
263
|
-
if (key === 'End') onEndKeyDown();
|
|
229
|
+
const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
|
|
230
|
+
let newYear = yearInteger !== 0 ? stringHelpers.fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';
|
|
264
231
|
|
|
265
232
|
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
newYear = stringHelpers.prependStringWithPlaceHolders("".concat(newYear), 4);
|
|
270
|
-
handleChangeYear(newYear, e);
|
|
233
|
+
let newYearInteger;
|
|
234
|
+
if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
|
|
235
|
+
newYear = stringHelpers.prependStringWithPlaceHolders(`${newYearInteger}`, 4);
|
|
271
236
|
}
|
|
272
237
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
238
|
+
const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);
|
|
239
|
+
const metainfo = {
|
|
240
|
+
isAutomaticFillTrigger
|
|
241
|
+
};
|
|
242
|
+
/* ************* new year apply logic ************* */
|
|
243
|
+
// tab/spacebar applies auto-fill
|
|
244
|
+
// arrows up/down applies increment/decrement
|
|
276
245
|
|
|
277
|
-
|
|
278
|
-
|
|
246
|
+
if (key === 'ArrowUp' || key === 'ArrowDown' || isAutomaticFillTrigger) {
|
|
247
|
+
handleChangeYear(newYear, e, metainfo);
|
|
248
|
+
}
|
|
249
|
+
/* ************* focus tracking logic ************* */
|
|
279
250
|
|
|
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
251
|
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
} // regressive backspace functionality
|
|
252
|
+
let trackNextFocus = trackFocusResetter; // if nothing after, we reset internal focus tracker to avoid re-render unexpected focus shift
|
|
287
253
|
|
|
254
|
+
if (!hideTime) trackNextFocus = trackFocusHourInput;else if (withClearBtn) trackNextFocus = trackFocusClearBtn;else if (withAnyPicker) trackNextFocus = trackFocusPicker;
|
|
255
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
|
|
256
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
|
|
257
|
+
if (key === 'Home') onHomeKeyDown();
|
|
258
|
+
if (key === 'End') onEndKeyDown();
|
|
259
|
+
/* ************** auto-advance logic ************** */
|
|
288
260
|
|
|
289
|
-
if (key === '
|
|
290
|
-
|
|
261
|
+
if (key === ' ') {
|
|
262
|
+
// auto-advance functionality:
|
|
263
|
+
trackNextFocus();
|
|
264
|
+
}
|
|
265
|
+
/* ********** regressive backspace logic ********** */
|
|
291
266
|
|
|
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
267
|
|
|
268
|
+
if (key === 'Backspace' && year?.length === 0) {
|
|
269
|
+
trackFocusDayInput();
|
|
270
|
+
} // focus last fragment on fill with now
|
|
295
271
|
|
|
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]);
|
|
298
|
-
const onYearBlur = React.useCallback(e => {
|
|
299
|
-
var _e$target6;
|
|
300
272
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}, [handleChangeYear]);
|
|
273
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
274
|
+
}, [year, trackFocusResetter, hideTime, trackFocusHourInput, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeYear]);
|
|
275
|
+
const onYearBlur = React.useCallback(() => {// this was used before, now that we have a wrapping onBlur resetting the focus tracker, this is unused;
|
|
276
|
+
}, []);
|
|
306
277
|
return React.useMemo(() => ({
|
|
307
278
|
month,
|
|
308
279
|
day,
|
|
@@ -28,7 +28,7 @@ const CalendarDaysList = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
28
28
|
children: [invisibleFirstDay ? /*#__PURE__*/_jsx__default["default"](Day.Day, {
|
|
29
29
|
metaDay: invisibleFirstDay,
|
|
30
30
|
isInvisible: true
|
|
31
|
-
},
|
|
31
|
+
}, `ds-calendar-${invisibleFirstDay.day.toString()}`) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx__default["default"](Styleds.StyledWeekDaysListWrapper, {
|
|
32
32
|
role: "row",
|
|
33
33
|
"aria-rowindex": i + 1,
|
|
34
34
|
cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
|
|
@@ -37,13 +37,13 @@ const CalendarDaysList = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
37
37
|
px: "2px",
|
|
38
38
|
justifyContent: "space-between",
|
|
39
39
|
alignItems: "center"
|
|
40
|
-
},
|
|
40
|
+
}, `ds-calendar-week-${week[0].day.toString()}-${week[6].day.toString()}`, week.map((metaDay, z) => /*#__PURE__*/_jsx__default["default"](Day.Day, {
|
|
41
41
|
metaDay: metaDay,
|
|
42
42
|
colIndex: z + 1
|
|
43
|
-
},
|
|
43
|
+
}, `ds-calendar-${metaDay.day.toString()}`)))), invisibleLastDay ? /*#__PURE__*/_jsx__default["default"](Day.Day, {
|
|
44
44
|
metaDay: invisibleLastDay,
|
|
45
45
|
isInvisible: true
|
|
46
|
-
},
|
|
46
|
+
}, `ds-calendar-${invisibleLastDay.day.toString()}`) : null]
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -23,8 +23,8 @@ const useGetFormattedCurrentDate = () => {
|
|
|
23
23
|
currentMonth,
|
|
24
24
|
currentYear
|
|
25
25
|
} = React.useContext(CalendarContext.CalendarContext);
|
|
26
|
-
const monthString = currentMonth >= 0 && currentMonth <= 11 ?
|
|
27
|
-
return React.useMemo(() =>
|
|
26
|
+
const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${dateHelpers.getMonthNameByMonthNumber(currentMonth)} ` : '';
|
|
27
|
+
return React.useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const CalendarHead = () => {
|
|
@@ -49,14 +49,32 @@ const CalendarHead = () => {
|
|
|
49
49
|
prevYearBtnRef,
|
|
50
50
|
prevMonthBtnRef,
|
|
51
51
|
nextMonthBtnRef,
|
|
52
|
-
nextYearBtnRef
|
|
52
|
+
nextYearBtnRef,
|
|
53
|
+
latestInteractionRegion,
|
|
54
|
+
currFocusDescriber
|
|
53
55
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
56
|
+
const handlePrevYearRef = React.useCallback(ButtonDomNode => {
|
|
57
|
+
prevYearBtnRef.current = ButtonDomNode;
|
|
58
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode?.focus?.();
|
|
59
|
+
}, [currFocusDescriber, latestInteractionRegion, prevYearBtnRef]);
|
|
60
|
+
const handlePrevMonthRef = React.useCallback(ButtonDomNode => {
|
|
61
|
+
prevMonthBtnRef.current = ButtonDomNode;
|
|
62
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode?.focus?.();
|
|
63
|
+
}, [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef]);
|
|
64
|
+
const handleNextMonthRef = React.useCallback(ButtonDomNode => {
|
|
65
|
+
nextMonthBtnRef.current = ButtonDomNode;
|
|
66
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode?.focus?.();
|
|
67
|
+
}, [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef]);
|
|
68
|
+
const handleNextYearRef = React.useCallback(ButtonDomNode => {
|
|
69
|
+
nextYearBtnRef.current = ButtonDomNode;
|
|
70
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode?.focus?.();
|
|
71
|
+
}, [currFocusDescriber, latestInteractionRegion, nextYearBtnRef]);
|
|
54
72
|
return /*#__PURE__*/_jsx__default["default"](Styleds.StyledHeader, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledHeaderButton, {
|
|
55
73
|
"aria-label": "previous year",
|
|
56
74
|
buttonType: "raw",
|
|
57
75
|
size: DSButton.BUTTON_SIZES.M,
|
|
58
76
|
onClick: handlePrevYear,
|
|
59
|
-
innerRef:
|
|
77
|
+
innerRef: handlePrevYearRef,
|
|
60
78
|
onKeyDown: handlePrevYearKeyDown,
|
|
61
79
|
onFocus: onPrevYearFocus,
|
|
62
80
|
tabIndex: isControllerOnly ? -1 : 1,
|
|
@@ -71,7 +89,7 @@ const CalendarHead = () => {
|
|
|
71
89
|
buttonType: "raw",
|
|
72
90
|
size: DSButton.BUTTON_SIZES.M,
|
|
73
91
|
onClick: handlePrevMonth,
|
|
74
|
-
innerRef:
|
|
92
|
+
innerRef: handlePrevMonthRef,
|
|
75
93
|
onKeyDown: handlePrevMonthKeyDown,
|
|
76
94
|
onFocus: onPrevMonthFocus,
|
|
77
95
|
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH // this is a tabstop for when the calendar is open
|
|
@@ -83,7 +101,7 @@ const CalendarHead = () => {
|
|
|
83
101
|
buttonType: "raw",
|
|
84
102
|
size: DSButton.BUTTON_SIZES.M,
|
|
85
103
|
onClick: handleNextMonth,
|
|
86
|
-
innerRef:
|
|
104
|
+
innerRef: handleNextMonthRef,
|
|
87
105
|
onKeyDown: handleNextMonthKeyDown,
|
|
88
106
|
onFocus: onNextMonthFocus,
|
|
89
107
|
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH
|
|
@@ -94,7 +112,7 @@ const CalendarHead = () => {
|
|
|
94
112
|
buttonType: "raw",
|
|
95
113
|
size: DSButton.BUTTON_SIZES.M,
|
|
96
114
|
onClick: handleNextYear,
|
|
97
|
-
innerRef:
|
|
115
|
+
innerRef: handleNextYearRef,
|
|
98
116
|
onKeyDown: handleNextYearKeyDown,
|
|
99
117
|
onFocus: onNextYearFocus,
|
|
100
118
|
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR
|
|
@@ -32,7 +32,7 @@ const CalendarIconTrigger = () => {
|
|
|
32
32
|
ariaCurrentValueForInputs
|
|
33
33
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
34
34
|
return React.useMemo(() => /*#__PURE__*/_jsx__default["default"](Styleds.StyledIconTriggerButton, {
|
|
35
|
-
"aria-label":
|
|
35
|
+
"aria-label": `date picker context menu trigger, ${ariaCurrentValueForInputs}`,
|
|
36
36
|
buttonType: "icon",
|
|
37
37
|
size: DSButton.BUTTON_SIZES.M,
|
|
38
38
|
innerRef: handleSetTriggerRef,
|
|
@@ -58,17 +58,16 @@ const Day = _ref => {
|
|
|
58
58
|
appOnDayChange,
|
|
59
59
|
appOnYearChange,
|
|
60
60
|
latestInteractionRegion,
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
isWithTimeWheelToo,
|
|
62
|
+
trackFocusCalendarMetafocusedDay
|
|
63
63
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
64
64
|
const {
|
|
65
65
|
focusedDay,
|
|
66
66
|
handleDayOnKeyDown,
|
|
67
67
|
handleFocusMetaDayByDay,
|
|
68
|
-
closeCalendar
|
|
69
|
-
tryToFocusCurrentlyDataIsFocusedDay
|
|
68
|
+
closeCalendar
|
|
70
69
|
} = React.useContext(CalendarContext.CalendarContext);
|
|
71
|
-
const isFocusedMetaDay = focusedDay
|
|
70
|
+
const isFocusedMetaDay = focusedDay?.day ? dateHelpers.compareTwoDatesDayEquality(metaDay?.day, focusedDay?.day) : false;
|
|
72
71
|
const isSelected = React.useMemo(() => {
|
|
73
72
|
const selectedDate = dateHelpers.getDayFromDateString(dateStringFromProps);
|
|
74
73
|
return selectedDate ? dateHelpers.isSameDateMoment(day, selectedDate) : false;
|
|
@@ -81,7 +80,6 @@ const Day = _ref => {
|
|
|
81
80
|
const isDayInRange = !isStartRangeDay && !isEndRangeDay && getIsDayInRange(metaDay.dayAsString);
|
|
82
81
|
const handleOnDayClick = React.useCallback(e => {
|
|
83
82
|
handleFocusMetaDayByDay(day);
|
|
84
|
-
tryToFocusCurrentlyDataIsFocusedDay();
|
|
85
83
|
|
|
86
84
|
if (!isDisabled && !isOutOfRange) {
|
|
87
85
|
const newDateString = dateHelpers.getDateStringFromDay(day);
|
|
@@ -95,18 +93,24 @@ const Day = _ref => {
|
|
|
95
93
|
day: dayNumber,
|
|
96
94
|
year
|
|
97
95
|
} = dateHelpers.getDateValuesFromDate(day);
|
|
98
|
-
appOnMonthChange(
|
|
99
|
-
if (dayNumber) appOnDayChange(
|
|
100
|
-
appOnYearChange(
|
|
96
|
+
appOnMonthChange(`${month + 1}`, e, metaInfo);
|
|
97
|
+
if (dayNumber) appOnDayChange(`${dayNumber}`, e, metaInfo);
|
|
98
|
+
appOnYearChange(`${year}`, e, metaInfo);
|
|
101
99
|
handleChangeComposedDateString(newDateString, metaInfo);
|
|
102
|
-
|
|
100
|
+
trackFocusCalendarMetafocusedDay();
|
|
103
101
|
if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();
|
|
104
102
|
}
|
|
105
|
-
}, [isDisabled, isOutOfRange,
|
|
103
|
+
}, [handleFocusMetaDayByDay, day, isDisabled, isOutOfRange, appOnMonthChange, appOnDayChange, appOnYearChange, handleChangeComposedDateString, trackFocusCalendarMetafocusedDay, isWithTimeWheelToo, preventCloseOnSelection, closeCalendar]);
|
|
104
|
+
const handleInnerRef = React.useCallback(ButtonDomNode => {
|
|
105
|
+
window.requestAnimationFrame(() => {
|
|
106
|
+
dayBtnRef.current = ButtonDomNode;
|
|
107
|
+
if (isFocused) ButtonDomNode?.focus?.();
|
|
108
|
+
});
|
|
109
|
+
}, [dayBtnRef, isFocused]);
|
|
106
110
|
const handleOnDayFocus = React.useCallback(() => {
|
|
107
|
-
|
|
108
|
-
}, [
|
|
109
|
-
const dayClassModifiers = React.useMemo(() =>
|
|
111
|
+
trackFocusCalendarMetafocusedDay('calendar-days');
|
|
112
|
+
}, [trackFocusCalendarMetafocusedDay]);
|
|
113
|
+
const dayClassModifiers = React.useMemo(() => `dayWrapper ${isSelected ? 'selectedDay ' : ''}${isDisabled ? 'disabledDay ' : ''}${isOutOfRange ? 'outOfRangeDay ' : ''}${isFocused ? 'focusedDay ' : ''}${isStartRangeDay ? 'startRangeDay ' : ''}${isDayInRange ? 'inRangeDay ' : ''}${isEndRangeDay ? 'endRangeDay ' : ''}${isCurrMonthDay ? '' : 'notCurrentMonth'}`, [isSelected, isDisabled, isOutOfRange, isFocused, isStartRangeDay, isDayInRange, isEndRangeDay, isCurrMonthDay]);
|
|
110
114
|
let dataTestid = ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.DAY;
|
|
111
115
|
if (isSelected) dataTestid = ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_DAY;
|
|
112
116
|
if (isFocused) dataTestid = ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.FOCUSED_DAY;
|
|
@@ -122,7 +126,7 @@ const Day = _ref => {
|
|
|
122
126
|
'aria-colindex': colIndex
|
|
123
127
|
}), {}, {
|
|
124
128
|
children: /*#__PURE__*/_jsx__default["default"](Styleds.StyledDayBtn, {
|
|
125
|
-
"aria-label":
|
|
129
|
+
"aria-label": `${stringHelpers.getAriaDayFromDateString(dayAsString)}, ${constants.weekDays[metaDay.day.getDay()]}`,
|
|
126
130
|
"aria-disabled": isOutOfRange || isDisabled,
|
|
127
131
|
"aria-hidden": !!isInvisible,
|
|
128
132
|
buttonType: "raw",
|
|
@@ -133,11 +137,11 @@ const Day = _ref => {
|
|
|
133
137
|
onKeyDown: e => {
|
|
134
138
|
handleDayOnKeyDown(e, metaDay);
|
|
135
139
|
},
|
|
136
|
-
innerRef:
|
|
140
|
+
innerRef: handleInnerRef,
|
|
137
141
|
tabIndex: isSelected ? 0 : -1,
|
|
138
142
|
"data-isfocused": isFocused,
|
|
139
143
|
"data-testid": dataTestid
|
|
140
|
-
}, void 0,
|
|
144
|
+
}, void 0, `${day.getDate()}`)
|
|
141
145
|
}));
|
|
142
146
|
};
|
|
143
147
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
5
|
var styled = require('styled-components');
|
|
7
6
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
7
|
var dsGrid = require('@elliemae/ds-grid');
|
|
@@ -10,46 +9,76 @@ var DSButton = require('@elliemae/ds-button');
|
|
|
10
9
|
|
|
11
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
11
|
|
|
13
|
-
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
14
12
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
const diagonalLine = dsSystem.css
|
|
14
|
+
/* eslint-disable max-lines */
|
|
15
|
+
const diagonalLine = dsSystem.css`
|
|
16
|
+
&:before {
|
|
17
|
+
position: absolute;
|
|
18
|
+
content: '';
|
|
19
|
+
top: 48%;
|
|
20
|
+
left: -2px;
|
|
21
|
+
height: 1px;
|
|
22
|
+
width: calc(100% + 4px);
|
|
23
|
+
transform: rotate(45deg);
|
|
24
|
+
background-color: ${_ref => {
|
|
18
25
|
let {
|
|
19
26
|
theme
|
|
20
27
|
} = _ref;
|
|
21
28
|
return theme.colors.neutral[500];
|
|
22
|
-
}
|
|
23
|
-
|
|
29
|
+
}};
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const focusBorder = dsSystem.css`
|
|
33
|
+
&:after {
|
|
34
|
+
position: absolute;
|
|
35
|
+
content: '';
|
|
36
|
+
top: -4px;
|
|
37
|
+
left: -4px;
|
|
38
|
+
width: calc(100% + 8px);
|
|
39
|
+
height: calc(100% + 8px);
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
24
43
|
const backgroundDateRange = {
|
|
25
|
-
inRange: dsSystem.css
|
|
44
|
+
inRange: dsSystem.css`
|
|
45
|
+
background-color: ${_ref2 => {
|
|
26
46
|
let {
|
|
27
47
|
theme
|
|
28
48
|
} = _ref2;
|
|
29
49
|
return theme.colors.brand[200];
|
|
30
|
-
}
|
|
50
|
+
}};
|
|
51
|
+
box-shadow: 4px 0 0 0 ${_ref3 => {
|
|
31
52
|
let {
|
|
32
53
|
theme
|
|
33
54
|
} = _ref3;
|
|
34
55
|
return theme.colors.brand[200];
|
|
35
|
-
}
|
|
36
|
-
|
|
56
|
+
}};
|
|
57
|
+
`,
|
|
58
|
+
startRange: dsSystem.css`
|
|
59
|
+
background-color: ${_ref4 => {
|
|
37
60
|
let {
|
|
38
61
|
theme
|
|
39
62
|
} = _ref4;
|
|
40
63
|
return theme.colors.brand[200];
|
|
41
|
-
}
|
|
64
|
+
}};
|
|
65
|
+
border-radius: 50% 0 0 50%;
|
|
66
|
+
box-shadow: 4px 0 0 0 ${_ref5 => {
|
|
42
67
|
let {
|
|
43
68
|
theme
|
|
44
69
|
} = _ref5;
|
|
45
70
|
return theme.colors.brand[200];
|
|
46
|
-
}
|
|
47
|
-
|
|
71
|
+
}};
|
|
72
|
+
`,
|
|
73
|
+
endRange: dsSystem.css`
|
|
74
|
+
background-color: ${_ref6 => {
|
|
48
75
|
let {
|
|
49
76
|
theme
|
|
50
77
|
} = _ref6;
|
|
51
78
|
return theme.colors.brand[200];
|
|
52
|
-
}
|
|
79
|
+
}};
|
|
80
|
+
border-radius: 0 50% 50% 0;
|
|
81
|
+
`
|
|
53
82
|
};
|
|
54
83
|
const StyledIconTriggerButton = /*#__PURE__*/styled__default["default"](DSButton.DSButtonV2).withConfig({
|
|
55
84
|
componentId: "sc-1vlmm1g-0"
|
|
@@ -139,7 +168,7 @@ const StyledWeekDaysListWrapper = /*#__PURE__*/styled__default["default"](dsGrid
|
|
|
139
168
|
isHeader,
|
|
140
169
|
theme
|
|
141
170
|
} = _ref19;
|
|
142
|
-
return isHeader ?
|
|
171
|
+
return isHeader ? `background: ${theme.colors.neutral['050']}` : '';
|
|
143
172
|
}, _ref20 => {
|
|
144
173
|
let {
|
|
145
174
|
isHeader
|