@elliemae/ds-controlled-form 2.4.2-rc.12 → 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 +9 -6
- package/cjs/autocomplete/parts/container/Container.js +1 -1
- package/cjs/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
- package/cjs/autocomplete/parts/menu-list/MenuList.js +3 -5
- package/cjs/autocomplete/parts/menu-list/styled.js +2 -2
- package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
- package/cjs/checkbox/config/useValidateProps.js +6 -3
- package/cjs/checkbox/styles.js +72 -28
- package/cjs/checkbox/utils/styleHelpers.js +20 -2
- package/cjs/combobox/config/useComboBox.js +1 -2
- package/cjs/combobox/config/useCorrectOptions.js +1 -2
- package/cjs/combobox/parts/A11yFocusedOption.js +4 -4
- package/cjs/combobox/parts/A11ySelectedValues.js +2 -2
- package/cjs/combobox/parts/DropdownIndicator.js +13 -5
- package/cjs/combobox/parts/container/Container.js +1 -1
- package/cjs/combobox/parts/container/styled.js +11 -10
- package/cjs/combobox/parts/controls/Controls.js +3 -9
- package/cjs/combobox/parts/controls/styled.js +54 -22
- package/cjs/combobox/parts/controls/useOnPillsNavigation.js +4 -12
- package/cjs/combobox/parts/controls-input/styled.js +41 -11
- package/cjs/combobox/parts/controls-input/useControlsInput.js +1 -5
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +4 -6
- package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +1 -1
- 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 +4 -11
- package/cjs/combobox/parts/menu-list/MenuList.js +2 -2
- package/cjs/combobox/parts/menu-list/styled.js +37 -21
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +3 -3
- 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/sharedTypes.js +2 -2
- package/cjs/combobox/utils/listHelper.js +4 -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 +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/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/styled.js +79 -13
- 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 +9 -5
- package/esm/autocomplete/parts/container/Container.js +1 -1
- package/esm/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
- package/esm/autocomplete/parts/menu-list/MenuList.js +3 -5
- package/esm/autocomplete/parts/menu-list/styled.js +2 -2
- package/esm/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
- package/esm/checkbox/config/useValidateProps.js +6 -3
- package/esm/checkbox/styles.js +72 -24
- package/esm/checkbox/utils/styleHelpers.js +20 -2
- package/esm/combobox/config/useComboBox.js +0 -1
- package/esm/combobox/config/useCorrectOptions.js +1 -2
- package/esm/combobox/parts/A11yFocusedOption.js +4 -4
- package/esm/combobox/parts/A11ySelectedValues.js +2 -2
- package/esm/combobox/parts/DropdownIndicator.js +13 -4
- package/esm/combobox/parts/container/Container.js +1 -1
- package/esm/combobox/parts/container/styled.js +11 -6
- package/esm/combobox/parts/controls/Controls.js +3 -9
- package/esm/combobox/parts/controls/styled.js +54 -18
- package/esm/combobox/parts/controls/useOnPillsNavigation.js +4 -12
- package/esm/combobox/parts/controls-input/styled.js +41 -7
- package/esm/combobox/parts/controls-input/useControlsInput.js +1 -5
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +4 -6
- package/esm/combobox/parts/controls-input/useMaskedOnChange.js +1 -1
- 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 +4 -11
- package/esm/combobox/parts/menu-list/MenuList.js +2 -2
- package/esm/combobox/parts/menu-list/styled.js +37 -17
- package/esm/combobox/parts/menu-list/useItemRenderer.js +3 -3
- 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/sharedTypes.js +2 -2
- package/esm/combobox/utils/listHelper.js +4 -9
- 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 +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/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/styled.js +79 -9
- 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 +15 -15
- package/types/text-input/config/useInputText.d.ts +3 -3
|
@@ -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
|
|
|
@@ -1,46 +1,76 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
import { css } from '@elliemae/ds-system';
|
|
4
3
|
import { Grid } from '@elliemae/ds-grid';
|
|
5
4
|
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
const diagonalLine = css
|
|
6
|
+
/* eslint-disable max-lines */
|
|
7
|
+
const diagonalLine = css`
|
|
8
|
+
&:before {
|
|
9
|
+
position: absolute;
|
|
10
|
+
content: '';
|
|
11
|
+
top: 48%;
|
|
12
|
+
left: -2px;
|
|
13
|
+
height: 1px;
|
|
14
|
+
width: calc(100% + 4px);
|
|
15
|
+
transform: rotate(45deg);
|
|
16
|
+
background-color: ${_ref => {
|
|
9
17
|
let {
|
|
10
18
|
theme
|
|
11
19
|
} = _ref;
|
|
12
20
|
return theme.colors.neutral[500];
|
|
13
|
-
}
|
|
14
|
-
|
|
21
|
+
}};
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const focusBorder = css`
|
|
25
|
+
&:after {
|
|
26
|
+
position: absolute;
|
|
27
|
+
content: '';
|
|
28
|
+
top: -4px;
|
|
29
|
+
left: -4px;
|
|
30
|
+
width: calc(100% + 8px);
|
|
31
|
+
height: calc(100% + 8px);
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
15
35
|
const backgroundDateRange = {
|
|
16
|
-
inRange: css
|
|
36
|
+
inRange: css`
|
|
37
|
+
background-color: ${_ref2 => {
|
|
17
38
|
let {
|
|
18
39
|
theme
|
|
19
40
|
} = _ref2;
|
|
20
41
|
return theme.colors.brand[200];
|
|
21
|
-
}
|
|
42
|
+
}};
|
|
43
|
+
box-shadow: 4px 0 0 0 ${_ref3 => {
|
|
22
44
|
let {
|
|
23
45
|
theme
|
|
24
46
|
} = _ref3;
|
|
25
47
|
return theme.colors.brand[200];
|
|
26
|
-
}
|
|
27
|
-
|
|
48
|
+
}};
|
|
49
|
+
`,
|
|
50
|
+
startRange: css`
|
|
51
|
+
background-color: ${_ref4 => {
|
|
28
52
|
let {
|
|
29
53
|
theme
|
|
30
54
|
} = _ref4;
|
|
31
55
|
return theme.colors.brand[200];
|
|
32
|
-
}
|
|
56
|
+
}};
|
|
57
|
+
border-radius: 50% 0 0 50%;
|
|
58
|
+
box-shadow: 4px 0 0 0 ${_ref5 => {
|
|
33
59
|
let {
|
|
34
60
|
theme
|
|
35
61
|
} = _ref5;
|
|
36
62
|
return theme.colors.brand[200];
|
|
37
|
-
}
|
|
38
|
-
|
|
63
|
+
}};
|
|
64
|
+
`,
|
|
65
|
+
endRange: css`
|
|
66
|
+
background-color: ${_ref6 => {
|
|
39
67
|
let {
|
|
40
68
|
theme
|
|
41
69
|
} = _ref6;
|
|
42
70
|
return theme.colors.brand[200];
|
|
43
|
-
}
|
|
71
|
+
}};
|
|
72
|
+
border-radius: 0 50% 50% 0;
|
|
73
|
+
`
|
|
44
74
|
};
|
|
45
75
|
const StyledIconTriggerButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
46
76
|
componentId: "sc-1vlmm1g-0"
|
|
@@ -130,7 +160,7 @@ const StyledWeekDaysListWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
130
160
|
isHeader,
|
|
131
161
|
theme
|
|
132
162
|
} = _ref19;
|
|
133
|
-
return isHeader ?
|
|
163
|
+
return isHeader ? `background: ${theme.colors.neutral['050']}` : '';
|
|
134
164
|
}, _ref20 => {
|
|
135
165
|
let {
|
|
136
166
|
isHeader
|
|
@@ -4,7 +4,6 @@ import 'core-js/modules/esnext.iterator.filter.js';
|
|
|
4
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
7
|
import { useContext, useState, useCallback, useMemo } from 'react';
|
|
9
8
|
import { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';
|
|
10
9
|
import { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import { useState, useEffect, useMemo, createRef, useCallback } from 'react';
|
|
3
2
|
import { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';
|
|
4
3
|
import { getFiveBySevenCurrentMonthDaysMatrix, sumValuesToDate, getDateStringFromDay, sumFromDateValues } from '../../../utils/dateHelpers.js';
|
|
5
4
|
|
|
5
|
+
/* eslint-disable complexity */
|
|
6
|
+
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
8
|
function sliceIntoChunks(arr, chunkSize) {
|
|
8
9
|
const res = [];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import { useContext, useState, useCallback, useMemo } from 'react';
|
|
3
2
|
import { usePopper } from 'react-popper';
|
|
4
3
|
import { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';
|
|
5
4
|
import { useOnClickOutside } from '../../../utils/hooks/useOnClickOutside.js';
|
|
6
5
|
|
|
6
|
+
/* eslint-disable complexity */
|
|
7
7
|
const usePopperTriggerLogic = _ref => {
|
|
8
8
|
let {
|
|
9
9
|
focusLogic,
|
|
@@ -59,7 +59,7 @@ const usePopperTriggerLogic = _ref => {
|
|
|
59
59
|
const handleSetTriggerRef = useCallback(newRef => {
|
|
60
60
|
pickerButtonRef.current = newRef;
|
|
61
61
|
setReferenceElement(newRef);
|
|
62
|
-
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef
|
|
62
|
+
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef?.focus();
|
|
63
63
|
}, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
|
|
64
64
|
const handleMenuWrapperKeyDown = useCallback(e => {
|
|
65
65
|
const {
|
|
@@ -72,9 +72,7 @@ const usePopperTriggerLogic = _ref => {
|
|
|
72
72
|
}
|
|
73
73
|
}, [closeCalendar, trackFocusPicker]);
|
|
74
74
|
useOnClickOutside(popperElement, e => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr = pickerButtonRef.current) !== null && _pickerButtonRef$curr !== void 0 && (_pickerButtonRef$curr2 = _pickerButtonRef$curr.contains) !== null && _pickerButtonRef$curr2 !== void 0 && _pickerButtonRef$curr2.call(_pickerButtonRef$curr, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
|
|
75
|
+
if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
|
|
78
76
|
});
|
|
79
77
|
return useMemo(() => ({
|
|
80
78
|
closeCalendar,
|
package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js
CHANGED
|
@@ -19,7 +19,7 @@ const CalendarWithTimeWheelIconTrigger = () => {
|
|
|
19
19
|
disabled
|
|
20
20
|
} = useContext(CalendarWithTimeWheelContext);
|
|
21
21
|
return useMemo(() => /*#__PURE__*/_jsx(StyledIconTriggerButton, {
|
|
22
|
-
"aria-label":
|
|
22
|
+
"aria-label": `date time picker context menu trigger, ${ariaCurrentValueForInputs}`,
|
|
23
23
|
buttonType: "icon",
|
|
24
24
|
type: "button",
|
|
25
25
|
size: BUTTON_SIZES.M,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import { useContext, useState, useCallback, useMemo } from 'react';
|
|
3
2
|
import { usePopper } from 'react-popper';
|
|
4
3
|
import { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../../../ControlledDateTimePickerTypes.js';
|
|
@@ -7,6 +6,7 @@ import { useOnClickOutside } from '../../../utils/hooks/useOnClickOutside.js';
|
|
|
7
6
|
import { CalendarContext } from '../Calendar/CalendarContext.js';
|
|
8
7
|
import { TimeWheelContext } from '../TimeWheel/TimeWheelContext.js';
|
|
9
8
|
|
|
9
|
+
/* eslint-disable max-statements */
|
|
10
10
|
const useConfigCalendarWithTimeWheelCTX = () => {
|
|
11
11
|
const {
|
|
12
12
|
pickerButtonRef,
|
|
@@ -75,14 +75,12 @@ const useConfigCalendarWithTimeWheelCTX = () => {
|
|
|
75
75
|
if (!showCalendarWithTimeWheel) openCalendar();else closeCalendar();
|
|
76
76
|
}, [closeCalendar, openCalendar, showCalendarWithTimeWheel]);
|
|
77
77
|
useOnClickOutside(popperElement, e => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr = pickerButtonRef.current) !== null && _pickerButtonRef$curr !== void 0 && (_pickerButtonRef$curr2 = _pickerButtonRef$curr.contains) !== null && _pickerButtonRef$curr2 !== void 0 && _pickerButtonRef$curr2.call(_pickerButtonRef$curr, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
|
|
78
|
+
if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
|
|
81
79
|
});
|
|
82
80
|
const handleSetTriggerRef = useCallback(newRef => {
|
|
83
81
|
pickerButtonRef.current = newRef;
|
|
84
82
|
setReferenceElement(newRef);
|
|
85
|
-
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'datetime-picker-icon') newRef
|
|
83
|
+
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'datetime-picker-icon') newRef?.focus();
|
|
86
84
|
}, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
|
|
87
85
|
const handleMenuWrapperKeyDown = useCallback(e => {
|
|
88
86
|
const {
|
|
@@ -44,10 +44,8 @@ const HoursList = () => {
|
|
|
44
44
|
} = useContext(ControlledDateTimePickerContext);
|
|
45
45
|
const handleCurrYearRef = useCallback(ButtonDomNode => {
|
|
46
46
|
setTimeout(() => {
|
|
47
|
-
var _ButtonDomNode$focus;
|
|
48
|
-
|
|
49
47
|
currHourBtnRef.current = ButtonDomNode;
|
|
50
|
-
if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour') ButtonDomNode
|
|
48
|
+
if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour') ButtonDomNode?.focus?.();
|
|
51
49
|
});
|
|
52
50
|
}, [currFocusDescriber, latestInteractionRegion, currHourBtnRef]);
|
|
53
51
|
return /*#__PURE__*/_jsx(StyledWheelList, {}, void 0, /*#__PURE__*/_jsx(StyledWheelListItem, {}, void 0, /*#__PURE__*/_jsx(StyledWheelChangeTimeBtn, {
|
|
@@ -59,9 +57,9 @@ const HoursList = () => {
|
|
|
59
57
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_HOUR,
|
|
60
58
|
tabIndex: -1
|
|
61
59
|
}, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleHours.map(hourString => {
|
|
62
|
-
const key =
|
|
60
|
+
const key = `timewheel-hour-${hourString || ''}`;
|
|
63
61
|
if (!hourString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
|
|
64
|
-
const currHourTimeString =
|
|
62
|
+
const currHourTimeString = `${hourString}:${currMinuteNum} ${currMeridiem}`;
|
|
65
63
|
const isEmptyCurrValueCurrentListItem = !hours && convertToPositiveNumberIfPossible(hourString) === currHourNum;
|
|
66
64
|
const isCurrentListItem = isEmptyCurrValueCurrentListItem || hours === hourString;
|
|
67
65
|
const isDisabled = getIsDisabledTime(currHourTimeString);
|
|
@@ -80,7 +78,7 @@ const HoursList = () => {
|
|
|
80
78
|
autoFocus: autoFocusHourTimeWheel && isCurrentListItem,
|
|
81
79
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL[isCurrentListItem ? 'CURRENT_HOUR' : 'HOUR'],
|
|
82
80
|
selected: hours.length === 2 && convertToPositiveNumberIfPossible(hourString) === currHourNum,
|
|
83
|
-
"aria-label":
|
|
81
|
+
"aria-label": `${hourString} hours`,
|
|
84
82
|
"aria-disabled": isDisabled,
|
|
85
83
|
buttonType: "raw",
|
|
86
84
|
size: "m",
|
|
@@ -90,7 +88,7 @@ const HoursList = () => {
|
|
|
90
88
|
"aria-valuemax": 12,
|
|
91
89
|
"aria-valuemin": 1,
|
|
92
90
|
"aria-valuenow": currHourNum,
|
|
93
|
-
"aria-valuetext":
|
|
91
|
+
"aria-valuetext": `${hourString} hours`
|
|
94
92
|
}, btnProps), {}, {
|
|
95
93
|
children: hourString
|
|
96
94
|
})));
|