@elliemae/ds-controlled-form 2.4.2-rc.9 → 2.4.2
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 +3 -3
- package/cjs/date-time-picker/config/useControlledDateTimePicker.js +1 -1
- package/cjs/date-time-picker/config/useFocusTracker.js +1 -1
- 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 +1 -1
- 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 +1 -3
- package/cjs/date-time-picker/parts/DateInputs/DDInput.js +3 -7
- package/cjs/date-time-picker/parts/DateInputs/MMInput.js +3 -7
- package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +3 -7
- package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +13 -23
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +6 -14
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +8 -10
- package/cjs/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -15
- package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +1 -2
- package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +0 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +3 -5
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +3 -5
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +5 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +6 -8
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +5 -7
- 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 +2 -5
- 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/usePopperTriggerLogic.js +2 -5
- package/cjs/date-time-picker/parts/Styleds.js +12 -6
- package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +2 -4
- package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +3 -8
- package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +3 -7
- package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +14 -26
- package/cjs/date-time-picker/utils/dateHelpers.js +17 -34
- 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 +3 -3
- package/esm/date-time-picker/config/useControlledDateTimePicker.js +1 -1
- package/esm/date-time-picker/config/useFocusTracker.js +1 -1
- 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 +1 -1
- 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 +1 -3
- package/esm/date-time-picker/parts/DateInputs/DDInput.js +3 -7
- package/esm/date-time-picker/parts/DateInputs/MMInput.js +3 -7
- package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +3 -7
- package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +13 -23
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +6 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +8 -10
- package/esm/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +0 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +0 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +3 -5
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +3 -5
- package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +5 -7
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +6 -8
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +5 -7
- 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 +2 -5
- 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/usePopperTriggerLogic.js +2 -5
- package/esm/date-time-picker/parts/Styleds.js +12 -6
- package/esm/date-time-picker/parts/TimeInputs/HHInput.js +2 -4
- package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +3 -8
- package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +3 -7
- package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +14 -26
- package/esm/date-time-picker/utils/dateHelpers.js +17 -34
- 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 +35 -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/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
|
@@ -81,7 +81,7 @@ const useChangeHandlers = _ref => {
|
|
|
81
81
|
appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos
|
|
82
82
|
|
|
83
83
|
setTimeString(newTimeString);
|
|
84
|
-
const newDateTimeString =
|
|
84
|
+
const newDateTimeString = `${newDateString} ${newTimeString}`;
|
|
85
85
|
|
|
86
86
|
const newMetaInfo = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaInfo), getTimeMetaInfo(newTimeString, metaInfo)), getDateMetaInfo(newDateString, metaInfo)), {}, {
|
|
87
87
|
newDateString,
|
|
@@ -98,7 +98,7 @@ const useChangeHandlers = _ref => {
|
|
|
98
98
|
appOnDateChange(appDateString, metaInfo); // don't do this on useEffect to avoid complete chaos
|
|
99
99
|
|
|
100
100
|
setTempDateString(newDateString);
|
|
101
|
-
const newDateTimeString =
|
|
101
|
+
const newDateTimeString = `${newDateString} ${tempTimeString}`;
|
|
102
102
|
|
|
103
103
|
const newMetaInfo = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaInfo), getTimeMetaInfo(tempTimeString, metaInfo)), getDateMetaInfo(newDateString, metaInfo)), {}, {
|
|
104
104
|
newDateString,
|
|
@@ -114,7 +114,7 @@ const useChangeHandlers = _ref => {
|
|
|
114
114
|
appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos
|
|
115
115
|
|
|
116
116
|
setTimeString(newTimeString);
|
|
117
|
-
const newDateTimeString =
|
|
117
|
+
const newDateTimeString = `${tempDateString} ${newTimeString}`;
|
|
118
118
|
|
|
119
119
|
const newMetaInfo = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaInfo), getTimeMetaInfo(newTimeString, metaInfo)), getDateMetaInfo(tempDateString, metaInfo)), {}, {
|
|
120
120
|
newDateTimeString,
|
|
@@ -59,7 +59,7 @@ const useControlledDateTimePicker = props => {
|
|
|
59
59
|
isDateTimeSelector,
|
|
60
60
|
isWithTimeInputs
|
|
61
61
|
} = flags;
|
|
62
|
-
const ariaCurrentValueForInputs =
|
|
62
|
+
const ariaCurrentValueForInputs = `current values: ${isWithDateInputs ? `${announcedDateValues}` : ''}${isDateTimeSelector ? ', ' : ''}${isWithTimeInputs ? `${announcedTimeValues}` : ''}`;
|
|
63
63
|
const ctx = React.useMemo(() => _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
64
64
|
props: propsWithDefaults,
|
|
65
65
|
ariaCurrentValueForInputs,
|
|
@@ -34,8 +34,8 @@ const useGetDestructuredDateValues = _ref => {
|
|
|
34
34
|
const yearNum = convertToPositiveNumberIfPossible(year);
|
|
35
35
|
const announcedMonth = monthNum !== -1 ? monthNames[monthNum - 1] : 'empty month';
|
|
36
36
|
const announcedDay = dayNum !== -1 ? announcableCardinalDays[dayNum] : 'empty day';
|
|
37
|
-
const announcedYear = yearNum !== -1 ? fillStringWithPlaceHolders(
|
|
38
|
-
const announcedDateValues =
|
|
37
|
+
const announcedYear = yearNum !== -1 ? fillStringWithPlaceHolders(`${yearNum}`, 4, '0') : 'empty year';
|
|
38
|
+
const announcedDateValues = `${announcedMonth}, ${announcedDay}, ${announcedYear}`;
|
|
39
39
|
return useMemo(() => ({
|
|
40
40
|
month,
|
|
41
41
|
day,
|
|
@@ -69,12 +69,12 @@ const useGetDestructuredTimeValues = _ref2 => {
|
|
|
69
69
|
const hoursNum = convertToPositiveNumberIfPossible(hours);
|
|
70
70
|
const minutesNum = convertToPositiveNumberIfPossible(minutes); // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
|
|
71
71
|
|
|
72
|
-
const announcedHours = hoursNum !== -1 ?
|
|
72
|
+
const announcedHours = hoursNum !== -1 ? `${hoursNum}` : 'empty hours'; // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
|
|
73
73
|
|
|
74
|
-
const announcedMinutes = minutesNum !== -1 ?
|
|
74
|
+
const announcedMinutes = minutesNum !== -1 ? `${minutesNum}` : 'empty minutes';
|
|
75
75
|
const announcedMeridiem = // eslint-disable-next-line no-nested-ternary
|
|
76
|
-
meridiem === 'PM' ?
|
|
77
|
-
const announcedTimeValues =
|
|
76
|
+
meridiem === 'PM' ? `post meridiem` : meridiem === 'AM' ? 'ante meridiem' : 'empty meriediem';
|
|
77
|
+
const announcedTimeValues = `${announcedHours}, ${announcedMinutes}, ${announcedMeridiem}`;
|
|
78
78
|
return useMemo(() => ({
|
|
79
79
|
hours,
|
|
80
80
|
minutes,
|
|
@@ -23,7 +23,7 @@ const useGetPropsBasedOnType = propsWithDefaults => {
|
|
|
23
23
|
const appOnMonthChange = (isDateTime || isDate) && propsWithDefaults.onMonthChange ? propsWithDefaults.onMonthChange : noop;
|
|
24
24
|
const appOnDayChange = (isDateTime || isDate) && propsWithDefaults.onDayChange ? propsWithDefaults.onDayChange : noop;
|
|
25
25
|
const appOnYearChange = (isDateTime || isDate) && propsWithDefaults.onYearChange ? propsWithDefaults.onYearChange : noop;
|
|
26
|
-
const emptyPickerStartingMonthDefault =
|
|
26
|
+
const emptyPickerStartingMonthDefault = `${new Date().getMonth() + 1}/__/${new Date().getFullYear()}`;
|
|
27
27
|
const emptyPickerStartingMonth = (isDateTime || isDate) && propsWithDefaults.emptyPickerStartingMonth ? propsWithDefaults.emptyPickerStartingMonth : emptyPickerStartingMonthDefault;
|
|
28
28
|
const onCalendarOpenFocusedDay = (isDateTime || isDate) && propsWithDefaults.onCalendarOpenFocusedDay ? propsWithDefaults.onCalendarOpenFocusedDay : undefined;
|
|
29
29
|
/* -------------------------- -------------- --------------------------*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import { useMemo, useState } from 'react';
|
|
3
2
|
import { getIsDateTime, getIsDate, getIsTime } from '../utils/typeGuards.js';
|
|
4
3
|
import { dateTimeToDate, dateTimeToTime } from '../utils/stringHelpers.js';
|
|
5
4
|
|
|
5
|
+
/* eslint-disable complexity */
|
|
6
6
|
const useRelevantValueFromProps = props => {
|
|
7
7
|
const dateStringFromProps = useMemo(() => {
|
|
8
8
|
if (getIsDateTime(props)) return props.dateTime !== '' ? dateTimeToDate(props.dateTime) : '__/__/____';
|
|
@@ -1,43 +1,74 @@
|
|
|
1
|
+
import 'core-js/modules/es.error.cause.js';
|
|
1
2
|
import { deconstructValuesFromDateString, isValidDateString, dateTimeToDate, isValidTimeString, dateTimeToTime } from '../utils/stringHelpers.js';
|
|
2
3
|
import { convertToPositiveNumberIfPossible } from '../utils/numberHelpers.js';
|
|
3
4
|
import { getIsDateTime, getIsDate, getIsTime } from '../utils/typeGuards.js';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const PREPEND = `ControlledDateTimePicker:
|
|
7
|
+
Invalid configuration detected::
|
|
8
|
+
|
|
9
|
+
`;
|
|
7
10
|
const NOT_A_DEFECT = ''; // '\n\n\t\tThis is not a defect, please check\n\n\t\thttps://qa.dimsum.rd.elliemae.io/?path=/story/components-desktop-components-d-controlledform-date-time-picker--basic\n\n\t\tfor instructions on how to use the component correctly\n\n';
|
|
8
11
|
|
|
9
|
-
const INLINE_RECEIVED_PREPEND =
|
|
12
|
+
const INLINE_RECEIVED_PREPEND = `
|
|
13
|
+
|
|
14
|
+
Received:`;
|
|
10
15
|
|
|
11
16
|
const throwInvalidDateTimeError = invalidValue => {
|
|
12
|
-
throw new Error(
|
|
17
|
+
throw new Error(`${PREPEND}the "dateTime" you are providing is not respecting the format it must respect.${INLINE_RECEIVED_PREPEND}${invalidValue}(${typeof invalidValue})${NOT_A_DEFECT}`);
|
|
13
18
|
};
|
|
14
19
|
|
|
15
20
|
const throwInvalidDaterror = invalidValue => {
|
|
16
|
-
throw new Error(
|
|
21
|
+
throw new Error(`${PREPEND}the "date" you are providing is not respecting the format it must respect.${INLINE_RECEIVED_PREPEND}${invalidValue}(${typeof invalidValue})${NOT_A_DEFECT}`);
|
|
17
22
|
};
|
|
18
23
|
|
|
19
24
|
const throwInvalidTimerror = invalidValue => {
|
|
20
|
-
throw new Error(
|
|
25
|
+
throw new Error(`${PREPEND}the "time" you are providing is not respecting the format it must respect.${INLINE_RECEIVED_PREPEND}${invalidValue}(${typeof invalidValue})${NOT_A_DEFECT}`);
|
|
21
26
|
};
|
|
22
27
|
|
|
23
28
|
const throwUncontrolledDateError = (date, onDateChange) => {
|
|
24
|
-
throw new Error(
|
|
29
|
+
throw new Error(`${PREPEND}you are trying to use a date selector while providing a non-string "date" or providing a non-function to "onDateChange"
|
|
30
|
+
the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
|
|
31
|
+
|
|
32
|
+
Received:
|
|
33
|
+
date: ${date}(${typeof date})
|
|
34
|
+
onDateChange: (${typeof onDateChange})
|
|
35
|
+
${NOT_A_DEFECT}`);
|
|
25
36
|
};
|
|
26
37
|
|
|
27
38
|
const throwUncontrolledTimeError = (time, onTimeChange) => {
|
|
28
|
-
throw new Error(
|
|
39
|
+
throw new Error(`${PREPEND}you are trying to use a time selector while providing a non-string "time" or providing a non-function to "onTimeChange"
|
|
40
|
+
the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
|
|
41
|
+
|
|
42
|
+
Received:
|
|
43
|
+
time: ${time}(${typeof time})
|
|
44
|
+
onTimeChange: (${typeof onTimeChange})
|
|
45
|
+
${NOT_A_DEFECT}`);
|
|
29
46
|
};
|
|
30
47
|
|
|
31
48
|
const throwUncontrolledDateTimeError = (dateTime, onDateTimeChange) => {
|
|
32
|
-
throw new Error(
|
|
49
|
+
throw new Error(`${PREPEND}you are trying to use a date-time selector while providing a non-string "dateTime" or providing a non-function to "onDateTimeChange"
|
|
50
|
+
the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
|
|
51
|
+
|
|
52
|
+
Received:
|
|
53
|
+
dateTime: ${dateTime}(${typeof dateTime})
|
|
54
|
+
onDateTimeChange: (${typeof onDateTimeChange})
|
|
55
|
+
${NOT_A_DEFECT}`);
|
|
33
56
|
};
|
|
34
57
|
|
|
35
58
|
const throwInvalidEmptyPickerStartingMonthError = emptyPickerStartingMonth => {
|
|
36
|
-
throw new Error(
|
|
59
|
+
throw new Error(`${PREPEND}the provided emptyPickerStartingMonth props is invalid. please provide a string with the format mm/__/yyyy, (mm 01~12, yyyy 0001~9999)
|
|
60
|
+
|
|
61
|
+
Received:
|
|
62
|
+
${emptyPickerStartingMonth}(${typeof emptyPickerStartingMonth})
|
|
63
|
+
${NOT_A_DEFECT}`);
|
|
37
64
|
};
|
|
38
65
|
|
|
39
66
|
const throwInvalidOnCalendarOpenFocusedDayError = onCalendarOpenFocusedDay => {
|
|
40
|
-
throw new Error(
|
|
67
|
+
throw new Error(`${PREPEND}the provided onCalendarOpenFocusedDay props is invalid. please provide a string with the format mm/dd/yyyy, (mm 01~12, dd 01~31, yyyy 0001~9999)
|
|
68
|
+
|
|
69
|
+
Received:
|
|
70
|
+
${onCalendarOpenFocusedDay}(${typeof onCalendarOpenFocusedDay})
|
|
71
|
+
${NOT_A_DEFECT}`);
|
|
41
72
|
};
|
|
42
73
|
|
|
43
74
|
const useValidateProps = props => {
|
|
@@ -38,10 +38,8 @@ const ClearButton = () => {
|
|
|
38
38
|
size: BUTTON_SIZES.M,
|
|
39
39
|
"data-testid": ControlledDateTimePickerDatatestid.CLEAR_BUTTON,
|
|
40
40
|
innerRef: DomElem => {
|
|
41
|
-
var _DomElem$focus;
|
|
42
|
-
|
|
43
41
|
clearButtonRef.current = DomElem;
|
|
44
|
-
if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem
|
|
42
|
+
if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem?.focus?.();
|
|
45
43
|
},
|
|
46
44
|
onClick: onClearClick,
|
|
47
45
|
onKeyDown: onClearButtonKeyDown
|
|
@@ -25,9 +25,7 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
25
25
|
isFocused
|
|
26
26
|
} = _ref;
|
|
27
27
|
const validateOnChange = useCallback(e => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (isInvalidDay(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
|
|
28
|
+
if (isInvalidDay(e?.target?.value)) {
|
|
31
29
|
e.preventDefault();
|
|
32
30
|
return;
|
|
33
31
|
}
|
|
@@ -41,13 +39,11 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
41
39
|
onKeyDown: onKeyDown,
|
|
42
40
|
value: value,
|
|
43
41
|
ref: DomElem => {
|
|
44
|
-
var _DomElem$focus;
|
|
45
|
-
|
|
46
42
|
contextRef.current = DomElem;
|
|
47
|
-
if (isFocused) DomElem
|
|
43
|
+
if (isFocused) DomElem?.focus?.();
|
|
48
44
|
},
|
|
49
45
|
placeholder: placeholder,
|
|
50
|
-
"aria-label":
|
|
46
|
+
"aria-label": `day input field, ${ariaCurrentValueForInputs}`,
|
|
51
47
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
|
|
52
48
|
disabled: disabled,
|
|
53
49
|
"aria-disabled": disabled
|
|
@@ -26,9 +26,7 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
26
26
|
isFocused
|
|
27
27
|
} = _ref;
|
|
28
28
|
const validateOnChange = useCallback(e => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (isInvalidMonth(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
|
|
29
|
+
if (isInvalidMonth(e?.target?.value)) {
|
|
32
30
|
e.preventDefault();
|
|
33
31
|
return;
|
|
34
32
|
}
|
|
@@ -43,13 +41,11 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
43
41
|
onKeyDown: onKeyDown,
|
|
44
42
|
value: value,
|
|
45
43
|
ref: DomElem => {
|
|
46
|
-
var _DomElem$focus;
|
|
47
|
-
|
|
48
44
|
contextRef.current = DomElem;
|
|
49
|
-
if (isFocused) DomElem
|
|
45
|
+
if (isFocused) DomElem?.focus?.();
|
|
50
46
|
},
|
|
51
47
|
placeholder: placeholder,
|
|
52
|
-
"aria-label":
|
|
48
|
+
"aria-label": `month input field, ${ariaCurrentValueForInputs}`,
|
|
53
49
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
|
|
54
50
|
disabled: disabled,
|
|
55
51
|
"aria-disabled": disabled
|
|
@@ -25,9 +25,7 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
25
25
|
isFocused
|
|
26
26
|
} = _ref;
|
|
27
27
|
const validateOnChange = useCallback(e => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (isInvalidYear(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
|
|
28
|
+
if (isInvalidYear(e?.target?.value)) {
|
|
31
29
|
e.preventDefault();
|
|
32
30
|
return;
|
|
33
31
|
}
|
|
@@ -41,13 +39,11 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
41
39
|
onKeyDown: onKeyDown,
|
|
42
40
|
value: value,
|
|
43
41
|
ref: DomElem => {
|
|
44
|
-
var _DomElem$focus;
|
|
45
|
-
|
|
46
42
|
contextRef.current = DomElem;
|
|
47
|
-
if (isFocused) DomElem
|
|
43
|
+
if (isFocused) DomElem?.focus?.();
|
|
48
44
|
},
|
|
49
45
|
placeholder: placeholder,
|
|
50
|
-
"aria-label":
|
|
46
|
+
"aria-label": `year input field, ${ariaCurrentValueForInputs}`,
|
|
51
47
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR,
|
|
52
48
|
disabled: disabled,
|
|
53
49
|
"aria-disabled": disabled
|
|
@@ -67,9 +67,7 @@ const useDateInputs = () => {
|
|
|
67
67
|
trackFocusMonthInput();
|
|
68
68
|
}, [trackFocusMonthInput]);
|
|
69
69
|
const onMonthChange = useCallback(e => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
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
|
|
70
|
+
let newMonth = e?.target?.value; // converts months 2~9 to 02~09
|
|
73
71
|
|
|
74
72
|
if (Number.parseInt(newMonth, 10) > 1) newMonth = prependStringWithPlaceHolders(newMonth, 2);
|
|
75
73
|
handleChangeMonth(newMonth, e); // auto-advance functionality:
|
|
@@ -92,12 +90,12 @@ const useDateInputs = () => {
|
|
|
92
90
|
const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
|
|
93
91
|
let newMonth;
|
|
94
92
|
if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
|
|
95
|
-
newMonth = prependStringWithPlaceHolders(
|
|
93
|
+
newMonth = prependStringWithPlaceHolders(`${newMonth}`, 2);
|
|
96
94
|
handleChangeMonth(newMonth, e);
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
|
|
100
|
-
const newMonth = prependStringWithPlaceHolders(
|
|
98
|
+
const newMonth = prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);
|
|
101
99
|
handleChangeMonth(newMonth, e); // auto-advance functionality:
|
|
102
100
|
|
|
103
101
|
if (newMonth.length === 2) trackFocusDayInput();
|
|
@@ -107,9 +105,7 @@ const useDateInputs = () => {
|
|
|
107
105
|
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
108
106
|
}, [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth]);
|
|
109
107
|
const onMonthBlur = useCallback(e => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
|
|
108
|
+
const newMonth = e?.target?.value;
|
|
113
109
|
if (newMonth === '0') handleChangeMonth('01', e, {
|
|
114
110
|
isAutomaticFillTrigger: true
|
|
115
111
|
});else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(prependStringWithPlaceHolders(newMonth, 2), e, {
|
|
@@ -135,9 +131,7 @@ const useDateInputs = () => {
|
|
|
135
131
|
trackFocusDayInput();
|
|
136
132
|
}, [trackFocusDayInput]);
|
|
137
133
|
const onDayChange = useCallback(e => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
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
|
|
134
|
+
let newDay = e?.target?.value; // converts days 4~9 to 04~09
|
|
141
135
|
|
|
142
136
|
if (Number.parseInt(newDay, 10) > 3) newDay = prependStringWithPlaceHolders(newDay, 2);
|
|
143
137
|
handleChangeDay(newDay, e); // auto-advance functionality:
|
|
@@ -160,19 +154,19 @@ const useDateInputs = () => {
|
|
|
160
154
|
const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
|
|
161
155
|
let newDay;
|
|
162
156
|
if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
|
|
163
|
-
newDay = prependStringWithPlaceHolders(
|
|
157
|
+
newDay = prependStringWithPlaceHolders(`${newDay}`, 2);
|
|
164
158
|
handleChangeDay(newDay, e);
|
|
165
159
|
}
|
|
166
160
|
|
|
167
161
|
if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
|
|
168
|
-
const newDay = prependStringWithPlaceHolders(
|
|
162
|
+
const newDay = prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);
|
|
169
163
|
handleChangeDay(newDay, e); // auto-advance functionality:
|
|
170
164
|
|
|
171
165
|
if (newDay.length === 2) trackFocusYearInput();
|
|
172
166
|
} // regressive backspace functionality
|
|
173
167
|
|
|
174
168
|
|
|
175
|
-
if (key === 'Backspace' &&
|
|
169
|
+
if (key === 'Backspace' && day?.length === 0) {
|
|
176
170
|
trackFocusMonthInput();
|
|
177
171
|
} // focus last fragment on fill with now
|
|
178
172
|
|
|
@@ -180,9 +174,7 @@ const useDateInputs = () => {
|
|
|
180
174
|
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
181
175
|
}, [day, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, handleChangeDay, trackFocusYearInput, trackFocusMonthInput]);
|
|
182
176
|
const onDayBlur = useCallback(e => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
|
|
177
|
+
const newDay = e?.target?.value;
|
|
186
178
|
if (newDay === '0') handleChangeDay('01', e, {
|
|
187
179
|
isAutomaticFillTrigger: true
|
|
188
180
|
});else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(prependStringWithPlaceHolders(newDay, 2), e, {
|
|
@@ -208,9 +200,7 @@ const useDateInputs = () => {
|
|
|
208
200
|
trackFocusYearInput();
|
|
209
201
|
}, [trackFocusYearInput]);
|
|
210
202
|
const onYearChange = useCallback(e => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const newYear = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : _e$target5.value;
|
|
203
|
+
const newYear = e?.target?.value;
|
|
214
204
|
handleChangeYear(newYear, e); // auto-advance functionality:
|
|
215
205
|
|
|
216
206
|
if (newYear.length === 4) {
|
|
@@ -229,12 +219,12 @@ const useDateInputs = () => {
|
|
|
229
219
|
|
|
230
220
|
const yearStringConvertedToInteger = Number.parseInt(year, 10);
|
|
231
221
|
const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
|
|
232
|
-
let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders(
|
|
222
|
+
let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';
|
|
233
223
|
|
|
234
224
|
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
235
225
|
let newYearInteger;
|
|
236
226
|
if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
|
|
237
|
-
newYear = prependStringWithPlaceHolders(
|
|
227
|
+
newYear = prependStringWithPlaceHolders(`${newYearInteger}`, 4);
|
|
238
228
|
}
|
|
239
229
|
|
|
240
230
|
const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);
|
|
@@ -267,7 +257,7 @@ const useDateInputs = () => {
|
|
|
267
257
|
/* ********** regressive backspace logic ********** */
|
|
268
258
|
|
|
269
259
|
|
|
270
|
-
if (key === 'Backspace' &&
|
|
260
|
+
if (key === 'Backspace' && year?.length === 0) {
|
|
271
261
|
trackFocusDayInput();
|
|
272
262
|
} // focus last fragment on fill with now
|
|
273
263
|
|
|
@@ -19,7 +19,7 @@ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
|
|
|
19
19
|
children: [invisibleFirstDay ? /*#__PURE__*/_jsx(Day, {
|
|
20
20
|
metaDay: invisibleFirstDay,
|
|
21
21
|
isInvisible: true
|
|
22
|
-
},
|
|
22
|
+
}, `ds-calendar-${invisibleFirstDay.day.toString()}`) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
|
|
23
23
|
role: "row",
|
|
24
24
|
"aria-rowindex": i + 1,
|
|
25
25
|
cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
|
|
@@ -28,13 +28,13 @@ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
|
|
|
28
28
|
px: "2px",
|
|
29
29
|
justifyContent: "space-between",
|
|
30
30
|
alignItems: "center"
|
|
31
|
-
},
|
|
31
|
+
}, `ds-calendar-week-${week[0].day.toString()}-${week[6].day.toString()}`, week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
|
|
32
32
|
metaDay: metaDay,
|
|
33
33
|
colIndex: z + 1
|
|
34
|
-
},
|
|
34
|
+
}, `ds-calendar-${metaDay.day.toString()}`)))), invisibleLastDay ? /*#__PURE__*/_jsx(Day, {
|
|
35
35
|
metaDay: invisibleLastDay,
|
|
36
36
|
isInvisible: true
|
|
37
|
-
},
|
|
37
|
+
}, `ds-calendar-${invisibleLastDay.day.toString()}`) : null]
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -15,8 +15,8 @@ const useGetFormattedCurrentDate = () => {
|
|
|
15
15
|
currentMonth,
|
|
16
16
|
currentYear
|
|
17
17
|
} = useContext(CalendarContext);
|
|
18
|
-
const monthString = currentMonth >= 0 && currentMonth <= 11 ?
|
|
19
|
-
return useMemo(() =>
|
|
18
|
+
const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${getMonthNameByMonthNumber(currentMonth)} ` : '';
|
|
19
|
+
return useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const CalendarHead = () => {
|
|
@@ -46,28 +46,20 @@ const CalendarHead = () => {
|
|
|
46
46
|
currFocusDescriber
|
|
47
47
|
} = useContext(ControlledDateTimePickerContext);
|
|
48
48
|
const handlePrevYearRef = useCallback(ButtonDomNode => {
|
|
49
|
-
var _ButtonDomNode$focus;
|
|
50
|
-
|
|
51
49
|
prevYearBtnRef.current = ButtonDomNode;
|
|
52
|
-
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode
|
|
50
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode?.focus?.();
|
|
53
51
|
}, [currFocusDescriber, latestInteractionRegion, prevYearBtnRef]);
|
|
54
52
|
const handlePrevMonthRef = useCallback(ButtonDomNode => {
|
|
55
|
-
var _ButtonDomNode$focus2;
|
|
56
|
-
|
|
57
53
|
prevMonthBtnRef.current = ButtonDomNode;
|
|
58
|
-
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode
|
|
54
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode?.focus?.();
|
|
59
55
|
}, [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef]);
|
|
60
56
|
const handleNextMonthRef = useCallback(ButtonDomNode => {
|
|
61
|
-
var _ButtonDomNode$focus3;
|
|
62
|
-
|
|
63
57
|
nextMonthBtnRef.current = ButtonDomNode;
|
|
64
|
-
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode
|
|
58
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode?.focus?.();
|
|
65
59
|
}, [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef]);
|
|
66
60
|
const handleNextYearRef = useCallback(ButtonDomNode => {
|
|
67
|
-
var _ButtonDomNode$focus4;
|
|
68
|
-
|
|
69
61
|
nextYearBtnRef.current = ButtonDomNode;
|
|
70
|
-
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode
|
|
62
|
+
if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode?.focus?.();
|
|
71
63
|
}, [currFocusDescriber, latestInteractionRegion, nextYearBtnRef]);
|
|
72
64
|
return /*#__PURE__*/_jsx(StyledHeader, {}, void 0, /*#__PURE__*/_jsx(StyledHeaderButton, {
|
|
73
65
|
"aria-label": "previous year",
|
|
@@ -24,7 +24,7 @@ const CalendarIconTrigger = () => {
|
|
|
24
24
|
ariaCurrentValueForInputs
|
|
25
25
|
} = useContext(ControlledDateTimePickerContext);
|
|
26
26
|
return useMemo(() => /*#__PURE__*/_jsx(StyledIconTriggerButton, {
|
|
27
|
-
"aria-label":
|
|
27
|
+
"aria-label": `date picker context menu trigger, ${ariaCurrentValueForInputs}`,
|
|
28
28
|
buttonType: "icon",
|
|
29
29
|
size: BUTTON_SIZES.M,
|
|
30
30
|
innerRef: handleSetTriggerRef,
|
|
@@ -58,7 +58,7 @@ const Day = _ref => {
|
|
|
58
58
|
handleFocusMetaDayByDay,
|
|
59
59
|
closeCalendar
|
|
60
60
|
} = useContext(CalendarContext);
|
|
61
|
-
const isFocusedMetaDay = focusedDay
|
|
61
|
+
const isFocusedMetaDay = focusedDay?.day ? compareTwoDatesDayEquality(metaDay?.day, focusedDay?.day) : false;
|
|
62
62
|
const isSelected = useMemo(() => {
|
|
63
63
|
const selectedDate = getDayFromDateString(dateStringFromProps);
|
|
64
64
|
return selectedDate ? isSameDateMoment(day, selectedDate) : false;
|
|
@@ -84,9 +84,9 @@ const Day = _ref => {
|
|
|
84
84
|
day: dayNumber,
|
|
85
85
|
year
|
|
86
86
|
} = getDateValuesFromDate(day);
|
|
87
|
-
appOnMonthChange(
|
|
88
|
-
if (dayNumber) appOnDayChange(
|
|
89
|
-
appOnYearChange(
|
|
87
|
+
appOnMonthChange(`${month + 1}`, e, metaInfo);
|
|
88
|
+
if (dayNumber) appOnDayChange(`${dayNumber}`, e, metaInfo);
|
|
89
|
+
appOnYearChange(`${year}`, e, metaInfo);
|
|
90
90
|
handleChangeComposedDateString(newDateString, metaInfo);
|
|
91
91
|
trackFocusCalendarMetafocusedDay();
|
|
92
92
|
if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();
|
|
@@ -94,16 +94,14 @@ const Day = _ref => {
|
|
|
94
94
|
}, [handleFocusMetaDayByDay, day, isDisabled, isOutOfRange, appOnMonthChange, appOnDayChange, appOnYearChange, handleChangeComposedDateString, trackFocusCalendarMetafocusedDay, isWithTimeWheelToo, preventCloseOnSelection, closeCalendar]);
|
|
95
95
|
const handleInnerRef = useCallback(ButtonDomNode => {
|
|
96
96
|
window.requestAnimationFrame(() => {
|
|
97
|
-
var _ButtonDomNode$focus;
|
|
98
|
-
|
|
99
97
|
dayBtnRef.current = ButtonDomNode;
|
|
100
|
-
if (isFocused) ButtonDomNode
|
|
98
|
+
if (isFocused) ButtonDomNode?.focus?.();
|
|
101
99
|
});
|
|
102
100
|
}, [dayBtnRef, isFocused]);
|
|
103
101
|
const handleOnDayFocus = useCallback(() => {
|
|
104
102
|
trackFocusCalendarMetafocusedDay('calendar-days');
|
|
105
103
|
}, [trackFocusCalendarMetafocusedDay]);
|
|
106
|
-
const dayClassModifiers = useMemo(() =>
|
|
104
|
+
const dayClassModifiers = 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]);
|
|
107
105
|
let dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.DAY;
|
|
108
106
|
if (isSelected) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_DAY;
|
|
109
107
|
if (isFocused) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.FOCUSED_DAY;
|
|
@@ -119,7 +117,7 @@ const Day = _ref => {
|
|
|
119
117
|
'aria-colindex': colIndex
|
|
120
118
|
}), {}, {
|
|
121
119
|
children: /*#__PURE__*/_jsx(StyledDayBtn, {
|
|
122
|
-
"aria-label":
|
|
120
|
+
"aria-label": `${getAriaDayFromDateString(dayAsString)}, ${weekDays[metaDay.day.getDay()]}`,
|
|
123
121
|
"aria-disabled": isOutOfRange || isDisabled,
|
|
124
122
|
"aria-hidden": !!isInvisible,
|
|
125
123
|
buttonType: "raw",
|
|
@@ -134,7 +132,7 @@ const Day = _ref => {
|
|
|
134
132
|
tabIndex: isSelected ? 0 : -1,
|
|
135
133
|
"data-isfocused": isFocused,
|
|
136
134
|
"data-testid": dataTestid
|
|
137
|
-
}, void 0,
|
|
135
|
+
}, void 0, `${day.getDate()}`)
|
|
138
136
|
}));
|
|
139
137
|
};
|
|
140
138
|
|