@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
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ControlledDateTimePickerCTX = require('../../ControlledDateTimePickerCTX.js');
|
|
7
|
-
var constants = require('../../utils/constants.js');
|
|
8
7
|
var stringHelpers = require('../../utils/stringHelpers.js');
|
|
9
8
|
|
|
10
9
|
/* eslint-disable complexity */
|
|
@@ -13,66 +12,53 @@ const useTimeInputs = () => {
|
|
|
13
12
|
props: {
|
|
14
13
|
disabled
|
|
15
14
|
},
|
|
16
|
-
lastSegmentRef,
|
|
17
15
|
hours,
|
|
18
16
|
minutes,
|
|
19
17
|
meridiem,
|
|
20
|
-
hideDate,
|
|
21
18
|
withAnyRightController,
|
|
22
19
|
withAnyPicker,
|
|
23
20
|
withClearBtn,
|
|
24
21
|
isWithDateInputs,
|
|
25
|
-
hourInputRef,
|
|
26
|
-
minutesInputRef,
|
|
27
|
-
meridiemInputRef,
|
|
28
|
-
yearInputRef,
|
|
29
|
-
clearButtonRef,
|
|
30
|
-
pickerButtonRef,
|
|
31
|
-
monthInputRef,
|
|
32
22
|
autoFocusHourInput,
|
|
33
23
|
handleChangeHours,
|
|
34
24
|
handleChangeMinutes,
|
|
35
25
|
handleChangeMeridiem,
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
minutesInterval,
|
|
27
|
+
trackFocusFirstSegment,
|
|
28
|
+
trackFocusLastSegment,
|
|
29
|
+
trackFocusHourInput,
|
|
30
|
+
trackFocusMinuteInput,
|
|
31
|
+
trackFocusMeridiemInput,
|
|
32
|
+
trackFocusClearBtn,
|
|
33
|
+
trackFocusPicker,
|
|
34
|
+
trackFocusYearInput
|
|
38
35
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
39
|
-
const setLatestInteractionRegionTimeInputs = React.useCallback(() => {
|
|
40
|
-
setLatestInteractionRegion('time-inputs');
|
|
41
|
-
}, [setLatestInteractionRegion]);
|
|
42
36
|
const onHomeKeyDown = React.useCallback(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (!hideDate) monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren = monthInputRef.current) === null || _monthInputRef$curren === void 0 ? void 0 : (_monthInputRef$curren2 = _monthInputRef$curren.focus) === null || _monthInputRef$curren2 === void 0 ? void 0 : _monthInputRef$curren2.call(_monthInputRef$curren);else 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);
|
|
46
|
-
}, [hideDate, monthInputRef, hourInputRef]);
|
|
37
|
+
trackFocusFirstSegment();
|
|
38
|
+
}, [trackFocusFirstSegment]);
|
|
47
39
|
const onEndKeyDown = React.useCallback(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
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 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);
|
|
51
|
-
}, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, meridiemInputRef]);
|
|
40
|
+
trackFocusLastSegment();
|
|
41
|
+
}, [trackFocusLastSegment]);
|
|
52
42
|
const onHoursFocus = React.useCallback(() => {
|
|
53
|
-
|
|
54
|
-
}, [
|
|
43
|
+
trackFocusHourInput();
|
|
44
|
+
}, [trackFocusHourInput]);
|
|
55
45
|
const onHoursChange = React.useCallback(e => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
let newHours = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts hours 2~9 to 07~09
|
|
46
|
+
let newHours = e?.target?.value; // converts hours 2~9 to 07~09
|
|
59
47
|
|
|
60
48
|
if (Number.parseInt(newHours, 10) > 1) newHours = stringHelpers.prependStringWithPlaceHolders(newHours, 2);
|
|
61
49
|
handleChangeHours(newHours, e); // auto-advance functionality:
|
|
62
50
|
|
|
63
|
-
if (newHours.length === 2)
|
|
64
|
-
}, [
|
|
51
|
+
if (newHours.length === 2) trackFocusMinuteInput();
|
|
52
|
+
}, [handleChangeHours, trackFocusMinuteInput]);
|
|
65
53
|
const onHoursKeyDown = React.useCallback(e => {
|
|
66
|
-
var _lastSegmentRef$curre, _lastSegmentRef$curre2;
|
|
67
|
-
|
|
68
54
|
const {
|
|
69
55
|
key,
|
|
70
56
|
ctrlKey,
|
|
71
57
|
metaKey
|
|
72
58
|
} = e;
|
|
73
59
|
const hoursStringConvertedToInteger = Number.parseInt(hours, 10);
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
60
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.preventDefault();
|
|
61
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.stopPropagation();
|
|
76
62
|
if (key === 'Home') onHomeKeyDown();
|
|
77
63
|
if (key === 'End') onEndKeyDown();
|
|
78
64
|
|
|
@@ -80,33 +66,27 @@ const useTimeInputs = () => {
|
|
|
80
66
|
const hoursInteger = Number.isNaN(hoursStringConvertedToInteger) ? 0 : hoursStringConvertedToInteger;
|
|
81
67
|
let newHours;
|
|
82
68
|
if (key === 'ArrowUp') newHours = hoursInteger + 1 <= 12 ? hoursInteger + 1 : hoursInteger;else newHours = hoursInteger - 1 > 1 ? hoursInteger - 1 : 1;
|
|
83
|
-
newHours = stringHelpers.prependStringWithPlaceHolders(
|
|
69
|
+
newHours = stringHelpers.prependStringWithPlaceHolders(`${newHours}`, 2);
|
|
84
70
|
handleChangeHours(newHours, e);
|
|
85
71
|
}
|
|
86
72
|
|
|
87
73
|
if (!Number.isNaN(hoursStringConvertedToInteger) && key === ':') {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const newHours = stringHelpers.prependStringWithPlaceHolders("".concat(hoursStringConvertedToInteger), 2);
|
|
74
|
+
const newHours = stringHelpers.prependStringWithPlaceHolders(`${hoursStringConvertedToInteger}`, 2);
|
|
91
75
|
handleChangeHours(newHours, e); // auto-advance functionality:
|
|
92
76
|
|
|
93
|
-
if (newHours.length === 2)
|
|
77
|
+
if (newHours.length === 2) trackFocusMinuteInput();
|
|
94
78
|
} // regressive backspace functionality
|
|
95
79
|
|
|
96
80
|
|
|
97
81
|
if (key === 'Backspace' && hours.length === 0 && isWithDateInputs) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
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);
|
|
82
|
+
trackFocusYearInput();
|
|
101
83
|
} // focus last fragment on fill with now
|
|
102
84
|
|
|
103
85
|
|
|
104
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
105
|
-
}, [hours,
|
|
86
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
87
|
+
}, [hours, isWithDateInputs, trackFocusYearInput, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusMinuteInput, handleChangeHours]);
|
|
106
88
|
const onHoursBlur = React.useCallback(e => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const newHours = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
|
|
89
|
+
const newHours = e?.target?.value;
|
|
110
90
|
if (newHours === '0') handleChangeHours('01', e, {
|
|
111
91
|
isAutomaticFillTrigger: true
|
|
112
92
|
});else if (newHours.length > 0 && newHours.length < 2) handleChangeHours(stringHelpers.prependStringWithPlaceHolders(newHours, 2), e, {
|
|
@@ -114,30 +94,25 @@ const useTimeInputs = () => {
|
|
|
114
94
|
});
|
|
115
95
|
}, [handleChangeHours]);
|
|
116
96
|
const onMinutesFocus = React.useCallback(() => {
|
|
117
|
-
|
|
118
|
-
}, [
|
|
97
|
+
trackFocusMinuteInput();
|
|
98
|
+
}, [trackFocusMinuteInput]);
|
|
119
99
|
const onMinutesChange = React.useCallback(e => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
let newMinutes = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts minutes 7~9 to 07~09
|
|
100
|
+
let newMinutes = e?.target?.value; // converts minutes 7~9 to 07~09
|
|
123
101
|
|
|
124
102
|
if (Number.parseInt(newMinutes, 10) > 6) newMinutes = stringHelpers.prependStringWithPlaceHolders(newMinutes, 2);
|
|
125
103
|
handleChangeMinutes(newMinutes, e); // auto-advance functionality:
|
|
126
|
-
// if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
|
|
127
104
|
|
|
128
|
-
if (newMinutes.length === 2)
|
|
129
|
-
}, [
|
|
105
|
+
if (newMinutes.length === 2) trackFocusMeridiemInput();
|
|
106
|
+
}, [handleChangeMinutes, trackFocusMeridiemInput]);
|
|
130
107
|
const onMinutesKeyDown = React.useCallback(e => {
|
|
131
|
-
var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
|
|
132
|
-
|
|
133
108
|
const {
|
|
134
109
|
key,
|
|
135
110
|
ctrlKey,
|
|
136
111
|
metaKey
|
|
137
112
|
} = e;
|
|
138
113
|
const minutesStringConvertedToInteger = Number.parseInt(minutes, 10);
|
|
139
|
-
if (
|
|
140
|
-
if (
|
|
114
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
|
|
115
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
|
|
141
116
|
if (key === 'Home') onHomeKeyDown();
|
|
142
117
|
if (key === 'End') onEndKeyDown();
|
|
143
118
|
|
|
@@ -145,86 +120,69 @@ const useTimeInputs = () => {
|
|
|
145
120
|
const minutesInteger = Number.isNaN(minutesStringConvertedToInteger) ? 0 : minutesStringConvertedToInteger;
|
|
146
121
|
let newMinutes;
|
|
147
122
|
if (key === 'ArrowUp') newMinutes = minutesInteger + minutesInterval <= 59 ? minutesInteger + minutesInterval : minutesInteger;else newMinutes = minutesInteger - minutesInterval > 0 ? minutesInteger - minutesInterval : 0;
|
|
148
|
-
newMinutes = stringHelpers.prependStringWithPlaceHolders(
|
|
123
|
+
newMinutes = stringHelpers.prependStringWithPlaceHolders(`${newMinutes}`, 2);
|
|
149
124
|
handleChangeMinutes(newMinutes, e);
|
|
150
125
|
}
|
|
151
126
|
|
|
152
127
|
if (!Number.isNaN(minutesStringConvertedToInteger) && key === ' ') {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const newMinutes = stringHelpers.prependStringWithPlaceHolders("".concat(minutesStringConvertedToInteger), 2);
|
|
128
|
+
const newMinutes = stringHelpers.prependStringWithPlaceHolders(`${minutesStringConvertedToInteger}`, 2);
|
|
156
129
|
handleChangeMinutes(newMinutes, e); // auto-advance functionality:
|
|
157
|
-
// if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
|
|
158
130
|
|
|
159
|
-
if (newMinutes.length === 2)
|
|
131
|
+
if (newMinutes.length === 2) trackFocusMeridiemInput();
|
|
160
132
|
} // regressive backspace functionality
|
|
161
133
|
|
|
162
134
|
|
|
163
|
-
if (key === 'Backspace' &&
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
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);
|
|
135
|
+
if (key === 'Backspace' && minutes?.length === 0) {
|
|
136
|
+
trackFocusHourInput();
|
|
167
137
|
} // focus last fragment on fill with now
|
|
168
138
|
|
|
169
139
|
|
|
170
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
171
|
-
}, [minutes, onHomeKeyDown, onEndKeyDown,
|
|
140
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
141
|
+
}, [minutes, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, minutesInterval, handleChangeMinutes, trackFocusMeridiemInput, trackFocusHourInput]);
|
|
172
142
|
const onMinutesBlur = React.useCallback(e => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const newMinutes = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
|
|
143
|
+
const newMinutes = e?.target?.value;
|
|
176
144
|
if (newMinutes.length > 0 && newMinutes.length < 2) handleChangeMinutes(stringHelpers.prependStringWithPlaceHolders(newMinutes, 2), e, {
|
|
177
145
|
isAutomaticFillTrigger: true
|
|
178
146
|
});
|
|
179
147
|
}, [handleChangeMinutes]);
|
|
180
148
|
const onMeridiemFocus = React.useCallback(() => {
|
|
181
|
-
|
|
182
|
-
}, [
|
|
149
|
+
trackFocusMeridiemInput();
|
|
150
|
+
}, [trackFocusMeridiemInput]);
|
|
183
151
|
const onMeridiemChange = React.useCallback(e => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
let newMeridiem = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : (_e$target5$value = _e$target5.value) === null || _e$target5$value === void 0 ? void 0 : (_e$target5$value$toUp = _e$target5$value.toUpperCase) === null || _e$target5$value$toUp === void 0 ? void 0 : _e$target5$value$toUp.call(_e$target5$value); // if new value is length 1,
|
|
152
|
+
let newMeridiem = e?.target?.value?.toUpperCase?.(); // if new value is length 1,
|
|
187
153
|
// if previous value was empty, auto-complete
|
|
188
154
|
// if previous value was not empty, set to empty (regressive backspace)
|
|
189
155
|
|
|
190
|
-
if (newMeridiem.length === 1) if (meridiem === '') newMeridiem =
|
|
156
|
+
if (newMeridiem.length === 1) if (meridiem === '') newMeridiem = `${newMeridiem}M`;else newMeridiem = '';
|
|
191
157
|
handleChangeMeridiem(newMeridiem, e); // auto-advance functionality:
|
|
192
158
|
|
|
193
159
|
if (newMeridiem.length === 2 && withAnyRightController) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
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);
|
|
160
|
+
if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker();
|
|
197
161
|
}
|
|
198
|
-
}, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn,
|
|
162
|
+
}, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
|
|
199
163
|
const onMeridiemKeyDown = React.useCallback(e => {
|
|
200
|
-
var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
|
|
201
|
-
|
|
202
164
|
const {
|
|
203
165
|
key,
|
|
204
166
|
ctrlKey,
|
|
205
167
|
metaKey
|
|
206
168
|
} = e;
|
|
207
|
-
if (
|
|
208
|
-
if (
|
|
169
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.preventDefault();
|
|
170
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.stopPropagation();
|
|
209
171
|
if (key === 'Home') onHomeKeyDown();
|
|
210
172
|
if (key === 'End') onEndKeyDown();
|
|
211
173
|
if (key === 'ArrowUp' && meridiem !== 'AM') handleChangeMeridiem('AM', e);
|
|
212
174
|
if (key === 'ArrowDown' && meridiem !== 'PM') handleChangeMeridiem('PM', e); // regressive backspace functionality
|
|
213
175
|
|
|
214
176
|
if (key === 'Backspace') {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr5 = minutesInputRef.current) === null || _minutesInputRef$curr5 === void 0 ? void 0 : (_minutesInputRef$curr6 = _minutesInputRef$curr5.focus) === null || _minutesInputRef$curr6 === void 0 ? void 0 : _minutesInputRef$curr6.call(_minutesInputRef$curr5);
|
|
177
|
+
if (meridiem?.length === 2) handleChangeMeridiem('', e);else trackFocusMinuteInput();
|
|
218
178
|
} // focus last fragment on fill with now
|
|
219
179
|
|
|
220
180
|
|
|
221
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
222
|
-
}, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem,
|
|
181
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
182
|
+
}, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, trackFocusLastSegment, trackFocusMinuteInput]);
|
|
223
183
|
const onMeridiemBlur = React.useCallback(e => {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const newMeridiem = e === null || e === void 0 ? void 0 : (_e$target6 = e.target) === null || _e$target6 === void 0 ? void 0 : (_e$target6$value = _e$target6.value) === null || _e$target6$value === void 0 ? void 0 : (_e$target6$value$toUp = _e$target6$value.toUpperCase) === null || _e$target6$value$toUp === void 0 ? void 0 : _e$target6$value$toUp.call(_e$target6$value);
|
|
227
|
-
if (newMeridiem.length === 1) handleChangeMeridiem("".concat(newMeridiem, "M"), e, {
|
|
184
|
+
const newMeridiem = e?.target?.value?.toUpperCase?.();
|
|
185
|
+
if (newMeridiem.length === 1) handleChangeMeridiem(`${newMeridiem}M`, e, {
|
|
228
186
|
isAutomaticFillTrigger: true
|
|
229
187
|
});
|
|
230
188
|
}, [handleChangeMeridiem]);
|
|
@@ -37,23 +37,11 @@ const announcableCardinalDays = {
|
|
|
37
37
|
30: 'thirtieth',
|
|
38
38
|
31: 'thirty first'
|
|
39
39
|
};
|
|
40
|
-
const homeEndAllArrowKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
|
|
41
|
-
const homeEndKeys = ['Home', 'End'];
|
|
42
|
-
const homeEndArrowUpDownDashSlashesKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'];
|
|
43
|
-
const homeEndArrowUpDownSpaceKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ' '];
|
|
44
|
-
const homeEndArrowUpDownSemiKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ':'];
|
|
45
|
-
const homeEndArrowUpDownKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
|
|
46
40
|
const defaultMetaInfo = {
|
|
47
41
|
isAutomaticFillTrigger: false
|
|
48
42
|
};
|
|
49
43
|
|
|
50
44
|
exports.announcableCardinalDays = announcableCardinalDays;
|
|
51
45
|
exports.defaultMetaInfo = defaultMetaInfo;
|
|
52
|
-
exports.homeEndAllArrowKeys = homeEndAllArrowKeys;
|
|
53
|
-
exports.homeEndArrowUpDownDashSlashesKeys = homeEndArrowUpDownDashSlashesKeys;
|
|
54
|
-
exports.homeEndArrowUpDownKeys = homeEndArrowUpDownKeys;
|
|
55
|
-
exports.homeEndArrowUpDownSemiKeys = homeEndArrowUpDownSemiKeys;
|
|
56
|
-
exports.homeEndArrowUpDownSpaceKeys = homeEndArrowUpDownSpaceKeys;
|
|
57
|
-
exports.homeEndKeys = homeEndKeys;
|
|
58
46
|
exports.monthNames = monthNames;
|
|
59
47
|
exports.weekDays = weekDays;
|
|
@@ -4,43 +4,34 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
6
|
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
7
|
var React = require('react');
|
|
9
8
|
var constants = require('./constants.js');
|
|
10
9
|
var stringHelpers = require('./stringHelpers.js');
|
|
11
10
|
var numberHelpers = require('./numberHelpers.js');
|
|
12
11
|
|
|
13
|
-
const getDateValuesFromDate = day => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
day: day === null || day === void 0 ? void 0 : (_day$getDate = day.getDate) === null || _day$getDate === void 0 ? void 0 : _day$getDate.call(day),
|
|
19
|
-
year: day === null || day === void 0 ? void 0 : (_day$getFullYear = day.getFullYear) === null || _day$getFullYear === void 0 ? void 0 : _day$getFullYear.call(day)
|
|
20
|
-
};
|
|
21
|
-
};
|
|
12
|
+
const getDateValuesFromDate = day => ({
|
|
13
|
+
month: day?.getMonth?.(),
|
|
14
|
+
day: day?.getDate?.(),
|
|
15
|
+
year: day?.getFullYear?.()
|
|
16
|
+
});
|
|
22
17
|
const getDateStringFromDay = day => {
|
|
23
|
-
const monthFromDay = stringHelpers.prependStringWithPlaceHolders(
|
|
18
|
+
const monthFromDay = stringHelpers.prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12
|
|
24
19
|
|
|
25
|
-
const dayFromDay = stringHelpers.prependStringWithPlaceHolders(
|
|
26
|
-
const yearFromDay = stringHelpers.prependStringWithPlaceHolders(
|
|
27
|
-
return
|
|
20
|
+
const dayFromDay = stringHelpers.prependStringWithPlaceHolders(`${day.getDate()}`, 2);
|
|
21
|
+
const yearFromDay = stringHelpers.prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);
|
|
22
|
+
return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;
|
|
28
23
|
};
|
|
29
24
|
const getTimeStringFromDay = day => {
|
|
30
25
|
const hoursNum = day.getHours();
|
|
31
26
|
const meridiem = hoursNum > 12 ? 'PM' : 'AM';
|
|
32
27
|
const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;
|
|
33
28
|
const minutesNum = day.getMinutes();
|
|
34
|
-
const hoursFromDay = stringHelpers.prependStringWithPlaceHolders(
|
|
35
|
-
const minutesFromDay = stringHelpers.prependStringWithPlaceHolders(
|
|
36
|
-
return
|
|
29
|
+
const hoursFromDay = stringHelpers.prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);
|
|
30
|
+
const minutesFromDay = stringHelpers.prependStringWithPlaceHolders(`${minutesNum}`, 2);
|
|
31
|
+
return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;
|
|
37
32
|
};
|
|
38
33
|
const getMonthNameByMonthNumber = monthNumber => constants.monthNames[monthNumber];
|
|
39
|
-
const isSameDateMoment = (dateA, dateB) =>
|
|
40
|
-
var _dateA$getTime, _dateB$getTime;
|
|
41
|
-
|
|
42
|
-
return (dateA === null || dateA === void 0 ? void 0 : (_dateA$getTime = dateA.getTime) === null || _dateA$getTime === void 0 ? void 0 : _dateA$getTime.call(dateA)) === (dateB === null || dateB === void 0 ? void 0 : (_dateB$getTime = dateB.getTime) === null || _dateB$getTime === void 0 ? void 0 : _dateB$getTime.call(dateB));
|
|
43
|
-
};
|
|
34
|
+
const isSameDateMoment = (dateA, dateB) => dateA?.getTime?.() === dateB?.getTime?.();
|
|
44
35
|
const compareTwoDatesDayEquality = (dayA, dayB) => {
|
|
45
36
|
const {
|
|
46
37
|
day: currD,
|
|
@@ -55,11 +46,7 @@ const compareTwoDatesDayEquality = (dayA, dayB) => {
|
|
|
55
46
|
return currD === focusD && currM === focusM && currY === focusY;
|
|
56
47
|
};
|
|
57
48
|
const getLastDayOfMonth = (month, year) => new Date(year, month + 1, 0);
|
|
58
|
-
const isValidDayForTheMonth = (month, year, day) =>
|
|
59
|
-
var _Date, _Date$getMonth;
|
|
60
|
-
|
|
61
|
-
return ((_Date = new Date(year, month, day)) === null || _Date === void 0 ? void 0 : (_Date$getMonth = _Date.getMonth) === null || _Date$getMonth === void 0 ? void 0 : _Date$getMonth.call(_Date)) === month;
|
|
62
|
-
};
|
|
49
|
+
const isValidDayForTheMonth = (month, year, day) => new Date(year, month, day)?.getMonth?.() === month;
|
|
63
50
|
const getDayFromDateString = dateString => {
|
|
64
51
|
const {
|
|
65
52
|
month,
|
|
@@ -73,8 +60,6 @@ const getDayFromDateString = dateString => {
|
|
|
73
60
|
return null;
|
|
74
61
|
};
|
|
75
62
|
const isValidDayForTheMonthDateString = dateString => {
|
|
76
|
-
var _getDayFromDateString, _getDayFromDateString2;
|
|
77
|
-
|
|
78
63
|
if (stringHelpers.isIncompleteString(dateString)) return true;
|
|
79
64
|
const {
|
|
80
65
|
month
|
|
@@ -82,7 +67,7 @@ const isValidDayForTheMonthDateString = dateString => {
|
|
|
82
67
|
const monthInt = numberHelpers.convertToPositiveNumberIfPossible(month);
|
|
83
68
|
if (monthInt === -1) return false;
|
|
84
69
|
const monthDateMonth = monthInt - 1;
|
|
85
|
-
return
|
|
70
|
+
return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;
|
|
86
71
|
};
|
|
87
72
|
const getValidationDateStringMetaInfo = function (dateString) {
|
|
88
73
|
let getIsOutOfRangeDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : day => false;
|
|
@@ -209,8 +194,6 @@ const getFirstXDaysFromNextMonth = (month, year, howMany) => {
|
|
|
209
194
|
return days;
|
|
210
195
|
};
|
|
211
196
|
const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
212
|
-
var _currentMonthDays$, _currentMonthDays$$da, _currentMonthDays, _currentMonthDays$day;
|
|
213
|
-
|
|
214
197
|
const currentMonthDays = getDaysInMonth(month, year).map(day => ({
|
|
215
198
|
day,
|
|
216
199
|
dayAsString: getDateStringFromDay(day),
|
|
@@ -220,7 +203,7 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
|
220
203
|
isHidden: false,
|
|
221
204
|
dayBtnRef: /*#__PURE__*/React.createRef()
|
|
222
205
|
}));
|
|
223
|
-
const firstDayOfTheMonthWeekDay = currentMonthDays
|
|
206
|
+
const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();
|
|
224
207
|
const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(day => ({
|
|
225
208
|
day,
|
|
226
209
|
dayAsString: getDateStringFromDay(day),
|
|
@@ -230,7 +213,7 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
|
230
213
|
isHidden: false,
|
|
231
214
|
dayBtnRef: /*#__PURE__*/React.createRef()
|
|
232
215
|
}));
|
|
233
|
-
const lastDayOfTheMonthWeekDay = currentMonthDays
|
|
216
|
+
const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();
|
|
234
217
|
const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map(day => ({
|
|
235
218
|
day,
|
|
236
219
|
dayAsString: getDateStringFromDay(day),
|
|
@@ -33,50 +33,52 @@ const useGetStartingFocusedDay = () => {
|
|
|
33
33
|
onCalendarOpenFocusedDay
|
|
34
34
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
35
35
|
const dayFromInputValues = useGetDayFromDateString.useGetDayFromDateString();
|
|
36
|
+
const {
|
|
37
|
+
month: inputValuesSplitMonth,
|
|
38
|
+
day: inputValuesSplitDay,
|
|
39
|
+
year: inputValuesDaySplitYear
|
|
40
|
+
} = dayFromInputValues ? dateHelpers.getDateValuesFromDate(dayFromInputValues) : {
|
|
41
|
+
month: null,
|
|
42
|
+
day: null,
|
|
43
|
+
year: null
|
|
44
|
+
};
|
|
45
|
+
const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && dateHelpers.isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
|
|
46
|
+
const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
|
|
47
|
+
const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty;
|
|
36
48
|
return React.useMemo(() => {
|
|
37
|
-
const startingDay = _objectSpread({}, empty);
|
|
49
|
+
const startingDay = _objectSpread({}, empty); // if input was filled start focus is the filled value (if it's valid day for the month)
|
|
38
50
|
|
|
39
|
-
if (dayFromInputValues) {
|
|
40
|
-
const {
|
|
41
|
-
month: inputValuesSplitMonth,
|
|
42
|
-
day: inputValuesSplitDay,
|
|
43
|
-
year: inputValuesDaySplitYear
|
|
44
|
-
} = dateHelpers.getDateValuesFromDate(dayFromInputValues);
|
|
45
|
-
const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && dateHelpers.isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
|
|
46
|
-
const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
|
|
47
|
-
const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty; // if input was filled start focus is the filled value (if it's valid day for the month)
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
if (isInputFilledAndValid) {
|
|
53
|
+
startingDay.startFocusedMonth = inputValuesSplitMonth;
|
|
54
|
+
startingDay.startFocusedDay = inputValuesSplitDay;
|
|
55
|
+
startingDay.startFocusedYear = inputValuesDaySplitYear;
|
|
56
|
+
startingDay.startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
|
|
57
|
+
} else if (isOnCalendarOpenFocusedDayEmpty) {
|
|
58
|
+
// if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
|
|
59
|
+
return empty;
|
|
60
|
+
} else if (shouldFillWithOnCalendarOpenFocusedDay) {
|
|
61
|
+
const {
|
|
62
|
+
month: focusedDaySplitMonth,
|
|
63
|
+
day: focusedDaySplitDay,
|
|
64
|
+
year: focusedDaySplitYear
|
|
65
|
+
} = stringHelpers.deconstructValuesFromDateString(onCalendarOpenFocusedDay);
|
|
66
|
+
const monthAsInt = numberHelpers.convertToPositiveNumberIfPossible(focusedDaySplitMonth);
|
|
67
|
+
const dayAsInt = numberHelpers.convertToPositiveNumberIfPossible(focusedDaySplitDay);
|
|
68
|
+
const yearAsInt = numberHelpers.convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
|
|
69
|
+
// because startFocusedMonth/Day/Year/Date will be === null
|
|
70
|
+
// which is the expected result
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
72
|
+
if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && dateHelpers.isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
|
|
73
|
+
startingDay.startFocusedMonth = monthAsInt;
|
|
74
|
+
startingDay.startFocusedDay = dayAsInt;
|
|
75
|
+
startingDay.startFocusedYear = yearAsInt;
|
|
76
|
+
startingDay.startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
return startingDay;
|
|
79
|
-
}, [dayFromInputValues, onCalendarOpenFocusedDay]);
|
|
81
|
+
}, [dayFromInputValues, inputValuesDaySplitYear, inputValuesSplitDay, inputValuesSplitMonth, isInputFilledAndValid, isOnCalendarOpenFocusedDayEmpty, onCalendarOpenFocusedDay, shouldFillWithOnCalendarOpenFocusedDay]);
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
exports.useGetStartingFocusedDay = useGetStartingFocusedDay;
|
|
@@ -7,10 +7,8 @@ var React = require('react');
|
|
|
7
7
|
const useOnClickOutside = (ref, handler) => {
|
|
8
8
|
React.useEffect(() => {
|
|
9
9
|
const listener = event => {
|
|
10
|
-
var _ref$contains;
|
|
11
|
-
|
|
12
10
|
// Do nothing if clicking ref's element or descendent elements
|
|
13
|
-
if (event.target instanceof Element) if (!ref || ref
|
|
11
|
+
if (event.target instanceof Element) if (!ref || ref?.contains?.(event.target)) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
handler(event);
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
6
|
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
-
require('core-js/modules/es.string.replace.js');
|
|
9
7
|
var constants = require('./constants.js');
|
|
10
8
|
var numberHelpers = require('./numberHelpers.js');
|
|
11
9
|
|
|
@@ -31,13 +29,9 @@ const getFormattedDateString = _ref => {
|
|
|
31
29
|
const finalMonth = fillStringWithPlaceHolders(month, 2);
|
|
32
30
|
const finalDay = fillStringWithPlaceHolders(day, 2);
|
|
33
31
|
const finalYear = fillStringWithPlaceHolders(year, 4);
|
|
34
|
-
return
|
|
35
|
-
};
|
|
36
|
-
const dateTimeToDate = dateTime => {
|
|
37
|
-
var _dateTime$split, _dateTime$split$call;
|
|
38
|
-
|
|
39
|
-
return dateTime === null || dateTime === void 0 ? void 0 : (_dateTime$split = dateTime.split) === null || _dateTime$split === void 0 ? void 0 : (_dateTime$split$call = _dateTime$split.call(dateTime, ' ')) === null || _dateTime$split$call === void 0 ? void 0 : _dateTime$split$call[0];
|
|
32
|
+
return `${finalMonth}/${finalDay}/${finalYear}`;
|
|
40
33
|
};
|
|
34
|
+
const dateTimeToDate = dateTime => dateTime?.split?.(' ')?.[0];
|
|
41
35
|
const deconstructValuesFromDateString = dateString => {
|
|
42
36
|
const [dirtyMonth = '', dirtyDay = '', dirtyYear = ''] = dateString.split('/');
|
|
43
37
|
const replaceAllRegexp = /_/g;
|
|
@@ -83,13 +77,13 @@ const getFormattedTimeString = _ref2 => {
|
|
|
83
77
|
|
|
84
78
|
const finalMeridiem = fillStringWithPlaceHolders(meridiem, 2); // return `${finalHour}:${finalMinutes}:${finalSeconds} ${finalMeridiem}`;// <-- seconds format
|
|
85
79
|
|
|
86
|
-
return
|
|
80
|
+
return `${finalHour}:${finalMinutes} ${finalMeridiem}`;
|
|
87
81
|
};
|
|
88
82
|
const dateTimeToTime = dateTime => {
|
|
89
83
|
const [// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
90
84
|
date, // timeNumbers = '__:__:__', // <-- seconds format
|
|
91
85
|
timeNumbers = '__:__', timeMeridiem = '__'] = dateTime.split(' ');
|
|
92
|
-
return
|
|
86
|
+
return `${timeNumbers} ${timeMeridiem}`;
|
|
93
87
|
};
|
|
94
88
|
const deconstructTimeValues = timeString => {
|
|
95
89
|
const [dirtyTimes = '', dirtyMeridiem] = timeString.split(' '); // <--['__:__','__']
|
|
@@ -135,7 +129,7 @@ const getAriaDayFromDateString = dateString => {
|
|
|
135
129
|
const dayNum = numberHelpers.convertToPositiveNumberIfPossible(dayString);
|
|
136
130
|
const yearNum = numberHelpers.convertToPositiveNumberIfPossible(yearString);
|
|
137
131
|
if (monthNum === -1 || dayNum === -1 || yearNum === -1) return '';
|
|
138
|
-
return
|
|
132
|
+
return `${constants.monthNames[monthNum - 1]} ${constants.announcableCardinalDays[dayNum]} ${yearNum}`;
|
|
139
133
|
};
|
|
140
134
|
|
|
141
135
|
exports.dateTimeToDate = dateTimeToDate;
|
|
@@ -13,7 +13,7 @@ var React = require('react');
|
|
|
13
13
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
14
14
|
var styled = require('./styled.js');
|
|
15
15
|
var reactDescPropTypes = require('./react-desc-prop-types.js');
|
|
16
|
-
var
|
|
16
|
+
var dataTestIds = require('./exported-related/data-test-ids.js');
|
|
17
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -33,6 +33,7 @@ const DSInputGroup = props => {
|
|
|
33
33
|
rightAddon
|
|
34
34
|
} = props;
|
|
35
35
|
const globals = dsPropsHelpers.useGetGlobalAttributes(props);
|
|
36
|
+
const xstyledProps = dsPropsHelpers.useGetXstyledProps(props);
|
|
36
37
|
const cols = React.useMemo(() => {
|
|
37
38
|
if (leftAddon && rightAddon) {
|
|
38
39
|
return ['max-content', 'auto', 'max-content'];
|
|
@@ -48,16 +49,16 @@ const DSInputGroup = props => {
|
|
|
48
49
|
|
|
49
50
|
return ['auto'];
|
|
50
51
|
}, [leftAddon, rightAddon]);
|
|
51
|
-
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledContainer, _objectSpread(_objectSpread({
|
|
52
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledContainer, _objectSpread(_objectSpread(_objectSpread({
|
|
52
53
|
cols: cols,
|
|
53
|
-
"data-testid":
|
|
54
|
-
}, globals), {}, {
|
|
54
|
+
"data-testid": dataTestIds.InputGroupDataTestIds.CONTAINER
|
|
55
|
+
}, globals), xstyledProps), {}, {
|
|
55
56
|
children: [leftAddon && /*#__PURE__*/_jsx__default["default"](styled.StyledLeftAddon, {
|
|
56
|
-
"data-testid":
|
|
57
|
+
"data-testid": dataTestIds.InputGroupDataTestIds.LEFTADDON
|
|
57
58
|
}, void 0, leftAddon), /*#__PURE__*/_jsx__default["default"](styled.StyledInput, {
|
|
58
|
-
"data-testid":
|
|
59
|
+
"data-testid": dataTestIds.InputGroupDataTestIds.INPUTCONTAINER
|
|
59
60
|
}, void 0, children), rightAddon && /*#__PURE__*/_jsx__default["default"](styled.StyledRightAddon, {
|
|
60
|
-
"data-testid":
|
|
61
|
+
"data-testid": dataTestIds.InputGroupDataTestIds.RIGHTADDON
|
|
61
62
|
}, void 0, rightAddon)]
|
|
62
63
|
}));
|
|
63
64
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const InputGroupDataTestIds = {
|
|
6
|
+
CONTAINER: 'ds-input-group-container',
|
|
7
|
+
LEFTADDON: 'ds-input-group-left-addon',
|
|
8
|
+
RIGHTADDON: 'ds-input-group-right-addon',
|
|
9
|
+
INPUTCONTAINER: 'ds-input-group-input-container'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.InputGroupDataTestIds = InputGroupDataTestIds;
|