@elliemae/ds-controlled-form 2.4.1 → 2.4.2-rc.3
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 +1 -3
- package/cjs/checkbox/ControlledCheckbox.js +49 -33
- package/cjs/checkbox/exported-related/data-test-ids.js +10 -0
- package/cjs/checkbox/exported-related/index.js +12 -0
- package/cjs/checkbox/exported-related/theming.js +13 -0
- package/cjs/checkbox/react-desc-prop-types.js +0 -1
- package/cjs/checkbox/styles.js +26 -15
- package/cjs/combobox/ComboBoxCTX.js +1 -1
- package/cjs/combobox/ComboboxDataTestids.js +1 -1
- package/cjs/combobox/config/useComboBox.js +6 -4
- package/cjs/combobox/index.js +5 -0
- package/cjs/combobox/parts/DropdownIndicator.js +2 -2
- package/cjs/combobox/parts/container/Container.js +5 -5
- package/cjs/combobox/parts/container/styled.js +13 -7
- package/cjs/combobox/parts/controls/Controls.js +14 -4
- package/cjs/combobox/parts/controls/styled.js +22 -13
- package/cjs/combobox/parts/controls-input/ControlsInput.js +1 -1
- package/cjs/combobox/parts/controls-input/styled.js +7 -3
- package/cjs/combobox/parts/controls-input/useControlsInput.js +3 -4
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
- package/cjs/combobox/parts/header-list/HeaderList.js +4 -3
- package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
- package/cjs/combobox/parts/menu-list/MenuList.js +5 -2
- package/cjs/combobox/parts/menu-list/styled.js +12 -7
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +5 -4
- package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
- package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
- package/cjs/combobox/theming.js +13 -0
- package/cjs/combobox/utils/listHelper.js +2 -1
- package/cjs/date-time-picker/config/useChangeHandlers.js +8 -12
- package/cjs/date-time-picker/config/useControlledDateTimePicker.js +13 -9
- package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
- package/cjs/date-time-picker/config/useGetReferences.js +40 -19
- package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
- package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +12 -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 -2
- package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
- package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -2
- package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
- package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +76 -95
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +31 -5
- package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
- package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
- package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -38
- package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
- package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +13 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +14 -8
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +13 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
- package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
- package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
- package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
- package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
- package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
- package/cjs/date-time-picker/utils/constants.js +0 -12
- package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
- package/cjs/index.js +16 -7
- package/cjs/input-group/InputGroup.js +69 -0
- package/cjs/input-group/InputGroupDataTestIds.js +12 -0
- package/cjs/input-group/index.js +12 -0
- package/cjs/input-group/react-desc-prop-types.js +14 -0
- package/cjs/input-group/styled.js +46 -0
- package/cjs/mask-hook/hooks/index.js +0 -1
- package/cjs/mask-hook/hooks/usePhoneMask.js +2 -2
- package/cjs/mask-hook/hooks/useRegExpMask.js +0 -1
- package/cjs/mask-hook/index.js +0 -1
- package/cjs/text-input/styled/borders.js +1 -1
- package/esm/autocomplete/config/useAutocomplete.js +3 -5
- package/esm/checkbox/ControlledCheckbox.js +52 -36
- package/esm/checkbox/exported-related/data-test-ids.js +6 -0
- package/esm/checkbox/exported-related/index.js +2 -0
- package/esm/checkbox/exported-related/theming.js +8 -0
- package/esm/checkbox/react-desc-prop-types.js +0 -1
- package/esm/checkbox/styles.js +25 -15
- package/esm/combobox/ComboBoxCTX.js +1 -1
- package/esm/combobox/ComboboxDataTestids.js +1 -1
- package/esm/combobox/config/useComboBox.js +8 -6
- package/esm/combobox/index.js +2 -0
- package/esm/combobox/parts/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/container/Container.js +7 -7
- package/esm/combobox/parts/container/styled.js +13 -6
- package/esm/combobox/parts/controls/Controls.js +14 -4
- package/esm/combobox/parts/controls/styled.js +22 -13
- package/esm/combobox/parts/controls-input/ControlsInput.js +1 -1
- package/esm/combobox/parts/controls-input/styled.js +7 -3
- package/esm/combobox/parts/controls-input/useControlsInput.js +3 -4
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
- package/esm/combobox/parts/header-list/HeaderList.js +4 -3
- package/esm/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
- package/esm/combobox/parts/menu-list/MenuList.js +5 -2
- package/esm/combobox/parts/menu-list/styled.js +12 -7
- package/esm/combobox/parts/menu-list/useItemRenderer.js +5 -4
- package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
- package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
- package/esm/combobox/theming.js +8 -0
- package/esm/combobox/utils/listHelper.js +2 -1
- package/esm/date-range-picker/config/useRangePickerLogic.js +2 -2
- package/esm/date-time-picker/config/useChangeHandlers.js +8 -12
- package/esm/date-time-picker/config/useControlledDateTimePicker.js +13 -9
- package/esm/date-time-picker/config/useFocusTracker.js +132 -0
- package/esm/date-time-picker/config/useGetReferences.js +41 -20
- package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
- package/esm/date-time-picker/parts/ClearButton/ClearButton.js +12 -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 -2
- package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
- package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -2
- package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
- package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +77 -96
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +32 -6
- package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
- package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +14 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -39
- package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
- package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
- package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +14 -8
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +15 -9
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +14 -8
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
- package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
- package/esm/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
- package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
- package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
- package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
- package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
- package/esm/date-time-picker/utils/constants.js +1 -7
- package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
- package/esm/index.js +5 -1
- package/esm/input-group/InputGroup.js +59 -0
- package/esm/input-group/InputGroupDataTestIds.js +8 -0
- package/esm/input-group/index.js +2 -0
- package/esm/input-group/react-desc-prop-types.js +10 -0
- package/esm/input-group/styled.js +35 -0
- package/esm/mask-hook/hooks/index.js +1 -1
- package/esm/mask-hook/hooks/usePhoneMask.js +2 -2
- package/esm/mask-hook/hooks/useRegExpMask.js +1 -1
- package/esm/mask-hook/index.js +1 -1
- package/esm/text-input/styled/borders.js +1 -1
- package/esm/toggle/ControlledToggle.js +3 -3
- package/package.json +55 -19
- package/types/checkbox/exported-related/data-test-ids.d.ts +4 -0
- package/types/checkbox/exported-related/index.d.ts +2 -0
- package/types/checkbox/exported-related/theming.d.ts +6 -0
- package/types/checkbox/react-desc-prop-types.d.ts +3 -3
- package/types/checkbox/styles.d.ts +5 -5
- package/types/combobox/ComboboxDataTestids.d.ts +1 -1
- package/types/combobox/index.d.ts +2 -0
- package/types/combobox/parts/container/styled.d.ts +1 -2
- package/types/combobox/theming.d.ts +6 -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/index.d.ts +1 -0
- package/types/input-group/InputGroup.d.ts +5 -0
- package/types/input-group/InputGroupDataTestIds.d.ts +6 -0
- package/types/input-group/index.d.ts +2 -0
- package/types/input-group/react-desc-prop-types.d.ts +19 -0
- package/types/input-group/styled.d.ts +7 -0
- package/types/input-group/tests/DSInputGroup.test.d.ts +1 -0
- package/types/mask-hook/hooks/useRegExpMask.d.ts +0 -1
- package/types/text-input/config/useInputText.d.ts +5 -5
- package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -51
- package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -47
- package/types/combobox/parts/menu-list/useMenuListSetFocusOption.d.ts +0 -1
|
@@ -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,55 @@ 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
|
-
var _e$target
|
|
46
|
+
var _e$target;
|
|
57
47
|
|
|
58
48
|
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
|
|
59
49
|
|
|
60
50
|
if (Number.parseInt(newHours, 10) > 1) newHours = stringHelpers.prependStringWithPlaceHolders(newHours, 2);
|
|
61
51
|
handleChangeHours(newHours, e); // auto-advance functionality:
|
|
62
52
|
|
|
63
|
-
if (newHours.length === 2)
|
|
64
|
-
}, [
|
|
53
|
+
if (newHours.length === 2) trackFocusMinuteInput();
|
|
54
|
+
}, [handleChangeHours, trackFocusMinuteInput]);
|
|
65
55
|
const onHoursKeyDown = React.useCallback(e => {
|
|
66
|
-
var _lastSegmentRef$curre, _lastSegmentRef$curre2;
|
|
67
|
-
|
|
68
56
|
const {
|
|
69
57
|
key,
|
|
70
58
|
ctrlKey,
|
|
71
59
|
metaKey
|
|
72
60
|
} = e;
|
|
73
61
|
const hoursStringConvertedToInteger = Number.parseInt(hours, 10);
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
62
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.preventDefault();
|
|
63
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.stopPropagation();
|
|
76
64
|
if (key === 'Home') onHomeKeyDown();
|
|
77
65
|
if (key === 'End') onEndKeyDown();
|
|
78
66
|
|
|
@@ -85,24 +73,20 @@ const useTimeInputs = () => {
|
|
|
85
73
|
}
|
|
86
74
|
|
|
87
75
|
if (!Number.isNaN(hoursStringConvertedToInteger) && key === ':') {
|
|
88
|
-
var _minutesInputRef$curr3, _minutesInputRef$curr4;
|
|
89
|
-
|
|
90
76
|
const newHours = stringHelpers.prependStringWithPlaceHolders("".concat(hoursStringConvertedToInteger), 2);
|
|
91
77
|
handleChangeHours(newHours, e); // auto-advance functionality:
|
|
92
78
|
|
|
93
|
-
if (newHours.length === 2)
|
|
79
|
+
if (newHours.length === 2) trackFocusMinuteInput();
|
|
94
80
|
} // regressive backspace functionality
|
|
95
81
|
|
|
96
82
|
|
|
97
83
|
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);
|
|
84
|
+
trackFocusYearInput();
|
|
101
85
|
} // focus last fragment on fill with now
|
|
102
86
|
|
|
103
87
|
|
|
104
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
105
|
-
}, [hours,
|
|
88
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
89
|
+
}, [hours, isWithDateInputs, trackFocusYearInput, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusMinuteInput, handleChangeHours]);
|
|
106
90
|
const onHoursBlur = React.useCallback(e => {
|
|
107
91
|
var _e$target2;
|
|
108
92
|
|
|
@@ -114,30 +98,27 @@ const useTimeInputs = () => {
|
|
|
114
98
|
});
|
|
115
99
|
}, [handleChangeHours]);
|
|
116
100
|
const onMinutesFocus = React.useCallback(() => {
|
|
117
|
-
|
|
118
|
-
}, [
|
|
101
|
+
trackFocusMinuteInput();
|
|
102
|
+
}, [trackFocusMinuteInput]);
|
|
119
103
|
const onMinutesChange = React.useCallback(e => {
|
|
120
|
-
var _e$target3
|
|
104
|
+
var _e$target3;
|
|
121
105
|
|
|
122
106
|
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
|
|
123
107
|
|
|
124
108
|
if (Number.parseInt(newMinutes, 10) > 6) newMinutes = stringHelpers.prependStringWithPlaceHolders(newMinutes, 2);
|
|
125
109
|
handleChangeMinutes(newMinutes, e); // auto-advance functionality:
|
|
126
|
-
// if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
|
|
127
110
|
|
|
128
|
-
if (newMinutes.length === 2)
|
|
129
|
-
}, [
|
|
111
|
+
if (newMinutes.length === 2) trackFocusMeridiemInput();
|
|
112
|
+
}, [handleChangeMinutes, trackFocusMeridiemInput]);
|
|
130
113
|
const onMinutesKeyDown = React.useCallback(e => {
|
|
131
|
-
var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
|
|
132
|
-
|
|
133
114
|
const {
|
|
134
115
|
key,
|
|
135
116
|
ctrlKey,
|
|
136
117
|
metaKey
|
|
137
118
|
} = e;
|
|
138
119
|
const minutesStringConvertedToInteger = Number.parseInt(minutes, 10);
|
|
139
|
-
if (
|
|
140
|
-
if (
|
|
120
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
|
|
121
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
|
|
141
122
|
if (key === 'Home') onHomeKeyDown();
|
|
142
123
|
if (key === 'End') onEndKeyDown();
|
|
143
124
|
|
|
@@ -150,25 +131,20 @@ const useTimeInputs = () => {
|
|
|
150
131
|
}
|
|
151
132
|
|
|
152
133
|
if (!Number.isNaN(minutesStringConvertedToInteger) && key === ' ') {
|
|
153
|
-
var _meridiemInputRef$cur5, _meridiemInputRef$cur6;
|
|
154
|
-
|
|
155
134
|
const newMinutes = stringHelpers.prependStringWithPlaceHolders("".concat(minutesStringConvertedToInteger), 2);
|
|
156
135
|
handleChangeMinutes(newMinutes, e); // auto-advance functionality:
|
|
157
|
-
// if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
|
|
158
136
|
|
|
159
|
-
if (newMinutes.length === 2)
|
|
137
|
+
if (newMinutes.length === 2) trackFocusMeridiemInput();
|
|
160
138
|
} // regressive backspace functionality
|
|
161
139
|
|
|
162
140
|
|
|
163
141
|
if (key === 'Backspace' && (minutes === null || minutes === void 0 ? void 0 : minutes.length) === 0) {
|
|
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);
|
|
142
|
+
trackFocusHourInput();
|
|
167
143
|
} // focus last fragment on fill with now
|
|
168
144
|
|
|
169
145
|
|
|
170
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
171
|
-
}, [minutes, onHomeKeyDown, onEndKeyDown,
|
|
146
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
147
|
+
}, [minutes, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, minutesInterval, handleChangeMinutes, trackFocusMeridiemInput, trackFocusHourInput]);
|
|
172
148
|
const onMinutesBlur = React.useCallback(e => {
|
|
173
149
|
var _e$target4;
|
|
174
150
|
|
|
@@ -178,8 +154,8 @@ const useTimeInputs = () => {
|
|
|
178
154
|
});
|
|
179
155
|
}, [handleChangeMinutes]);
|
|
180
156
|
const onMeridiemFocus = React.useCallback(() => {
|
|
181
|
-
|
|
182
|
-
}, [
|
|
157
|
+
trackFocusMeridiemInput();
|
|
158
|
+
}, [trackFocusMeridiemInput]);
|
|
183
159
|
const onMeridiemChange = React.useCallback(e => {
|
|
184
160
|
var _e$target5, _e$target5$value, _e$target5$value$toUp;
|
|
185
161
|
|
|
@@ -191,35 +167,29 @@ const useTimeInputs = () => {
|
|
|
191
167
|
handleChangeMeridiem(newMeridiem, e); // auto-advance functionality:
|
|
192
168
|
|
|
193
169
|
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);
|
|
170
|
+
if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker();
|
|
197
171
|
}
|
|
198
|
-
}, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn,
|
|
172
|
+
}, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
|
|
199
173
|
const onMeridiemKeyDown = React.useCallback(e => {
|
|
200
|
-
var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
|
|
201
|
-
|
|
202
174
|
const {
|
|
203
175
|
key,
|
|
204
176
|
ctrlKey,
|
|
205
177
|
metaKey
|
|
206
178
|
} = e;
|
|
207
|
-
if (
|
|
208
|
-
if (
|
|
179
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.preventDefault();
|
|
180
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.stopPropagation();
|
|
209
181
|
if (key === 'Home') onHomeKeyDown();
|
|
210
182
|
if (key === 'End') onEndKeyDown();
|
|
211
183
|
if (key === 'ArrowUp' && meridiem !== 'AM') handleChangeMeridiem('AM', e);
|
|
212
184
|
if (key === 'ArrowDown' && meridiem !== 'PM') handleChangeMeridiem('PM', e); // regressive backspace functionality
|
|
213
185
|
|
|
214
186
|
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);
|
|
187
|
+
if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else trackFocusMinuteInput();
|
|
218
188
|
} // focus last fragment on fill with now
|
|
219
189
|
|
|
220
190
|
|
|
221
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
222
|
-
}, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem,
|
|
191
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
192
|
+
}, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, trackFocusLastSegment, trackFocusMinuteInput]);
|
|
223
193
|
const onMeridiemBlur = React.useCallback(e => {
|
|
224
194
|
var _e$target6, _e$target6$value, _e$target6$value$toUp;
|
|
225
195
|
|
|
@@ -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;
|
|
@@ -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;
|
package/cjs/index.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var Autocomplete = require('./autocomplete/Autocomplete.js');
|
|
6
|
+
var InputGroup = require('./input-group/InputGroup.js');
|
|
7
|
+
var InputGroupDataTestIds = require('./input-group/InputGroupDataTestIds.js');
|
|
6
8
|
var ControlledCheckbox = require('./checkbox/ControlledCheckbox.js');
|
|
7
9
|
var ComboBox = require('./combobox/ComboBox.js');
|
|
10
|
+
var theming = require('./combobox/theming.js');
|
|
11
|
+
var ComboboxDataTestids = require('./combobox/ComboboxDataTestids.js');
|
|
8
12
|
var ControlledDateRangePicker = require('./date-range-picker/ControlledDateRangePicker.js');
|
|
9
13
|
var ControlledDateRangePickerDatatestid = require('./date-range-picker/ControlledDateRangePickerDatatestid.js');
|
|
10
14
|
var ControlledDateRangePickerTypes = require('./date-range-picker/ControlledDateRangePickerTypes.js');
|
|
@@ -22,21 +26,27 @@ var useRegExpMask = require('./mask-hook/hooks/useRegExpMask.js');
|
|
|
22
26
|
var useZipCodeMask = require('./mask-hook/hooks/useZipCodeMask.js');
|
|
23
27
|
var DSInputText = require('./text-input/DSInputText.js');
|
|
24
28
|
var dataTestIds = require('./text-input/exported-related/data-test-ids.js');
|
|
25
|
-
var theming = require('./text-input/exported-related/theming.js');
|
|
29
|
+
var theming$1 = require('./text-input/exported-related/theming.js');
|
|
26
30
|
var ControlledToggle = require('./toggle/ControlledToggle.js');
|
|
27
31
|
var DSControlledLargeTextInput = require('./large-text-input/DSControlledLargeTextInput.js');
|
|
28
32
|
var dataTestIds$1 = require('./large-text-input/exported-related/data-test-ids.js');
|
|
29
|
-
var theming$
|
|
33
|
+
var theming$2 = require('./large-text-input/exported-related/theming.js');
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
exports.DSAutocomplete = Autocomplete.DSAutocomplete;
|
|
34
38
|
exports.DSAutocompleteWithSchema = Autocomplete.DSAutocompleteWithSchema;
|
|
39
|
+
exports.DSInputGroup = InputGroup.DSInputGroup;
|
|
40
|
+
exports.DSInputGroupWithSchema = InputGroup.DSInputGroupWithSchema;
|
|
41
|
+
exports.InputGroupDataTestIds = InputGroupDataTestIds.InputGroupDataTestIds;
|
|
35
42
|
exports.DSControlledCheckbox = ControlledCheckbox.DSControlledCheckbox;
|
|
36
43
|
exports.DSControlledCheckboxWithSchema = ControlledCheckbox.DSControlledCheckboxWithSchema;
|
|
37
44
|
exports.DSComboBox = ComboBox.DSComboBox;
|
|
38
45
|
exports.DSComboBoxV3 = ComboBox.DSComboBox;
|
|
39
46
|
exports.DSComboBoxWithSchema = ComboBox.DSComboBoxWithSchema;
|
|
47
|
+
exports.DSComboBoxName = theming.DSComboBoxName;
|
|
48
|
+
exports.DSComboboxSlots = theming.DSComboboxSlots;
|
|
49
|
+
exports.ComboboxDataTestid = ComboboxDataTestids.ComboboxDataTestid;
|
|
40
50
|
exports.DSControlledDateRangePicker = ControlledDateRangePicker.DSControlledDateRangePicker;
|
|
41
51
|
exports.DSControlledDateRangePickerWithSchema = ControlledDateRangePicker.DSControlledDateRangePickerWithSchema;
|
|
42
52
|
exports.ControlledDateRangePickerDatatestid = ControlledDateRangePickerDatatestid.ControlledDateRangePickerDatatestid;
|
|
@@ -63,7 +73,6 @@ exports.UseSSNMaskWithSchema = useSSNMask.UseSSNMaskWithSchema;
|
|
|
63
73
|
exports.getSSNMaskedValue = useSSNMask.getSSNMaskedValue;
|
|
64
74
|
exports.useSSNMask = useSSNMask.useSSNMask;
|
|
65
75
|
exports.UseRegExpMaskWithSchema = useRegExpMask.UseRegExpMaskWithSchema;
|
|
66
|
-
exports.isRegExp = useRegExpMask.isRegExp;
|
|
67
76
|
exports.useRegExpMask = useRegExpMask.useRegExpMask;
|
|
68
77
|
exports.UseZipCodeMaskWithSchema = useZipCodeMask.UseZipCodeMaskWithSchema;
|
|
69
78
|
exports.getUseZipMaskedValue = useZipCodeMask.getUseZipMaskedValue;
|
|
@@ -71,12 +80,12 @@ exports.useZipCodeMask = useZipCodeMask.useZipCodeMask;
|
|
|
71
80
|
exports.DSInputText = DSInputText.DSInputText;
|
|
72
81
|
exports.DSInputTextWithSchema = DSInputText.DSInputTextWithSchema;
|
|
73
82
|
exports.DSInputTextDataTestIds = dataTestIds.DSInputTextDataTestIds;
|
|
74
|
-
exports.DSInputTextName = theming.DSInputTextName;
|
|
75
|
-
exports.DSInputTextSlots = theming.DSInputTextSlots;
|
|
83
|
+
exports.DSInputTextName = theming$1.DSInputTextName;
|
|
84
|
+
exports.DSInputTextSlots = theming$1.DSInputTextSlots;
|
|
76
85
|
exports.DSControlledToggle = ControlledToggle.DSControlledToggle;
|
|
77
86
|
exports.DSControlledToggleWithSchema = ControlledToggle.DSControlledToggleWithSchema;
|
|
78
87
|
exports.DSControlledLargeTextInput = DSControlledLargeTextInput.DSControlledLargeTextInput;
|
|
79
88
|
exports.DSControlledLargeTextInputWithSchema = DSControlledLargeTextInput.DSControlledLargeTextInputWithSchema;
|
|
80
89
|
exports.DSControlledLargetTextInputDatatestids = dataTestIds$1.DSControlledLargetTextInputDatatestids;
|
|
81
|
-
exports.DSControlledLargeTextInputName = theming$
|
|
82
|
-
exports.DSControlledLargeTextInputSlots = theming$
|
|
90
|
+
exports.DSControlledLargeTextInputName = theming$2.DSControlledLargeTextInputName;
|
|
91
|
+
exports.DSControlledLargeTextInputSlots = theming$2.DSControlledLargeTextInputSlots;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
14
|
+
var styled = require('./styled.js');
|
|
15
|
+
var reactDescPropTypes = require('./react-desc-prop-types.js');
|
|
16
|
+
var InputGroupDataTestIds = require('./InputGroupDataTestIds.js');
|
|
17
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
23
|
+
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
+
|
|
28
|
+
const DSInputGroup = props => {
|
|
29
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(props, reactDescPropTypes.propTypes);
|
|
30
|
+
const {
|
|
31
|
+
children,
|
|
32
|
+
leftAddon,
|
|
33
|
+
rightAddon
|
|
34
|
+
} = props;
|
|
35
|
+
const globals = dsPropsHelpers.useGetGlobalAttributes(props);
|
|
36
|
+
const cols = React.useMemo(() => {
|
|
37
|
+
if (leftAddon && rightAddon) {
|
|
38
|
+
return ['max-content', 'auto', 'max-content'];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (leftAddon && !rightAddon) {
|
|
42
|
+
return ['max-content', 'auto'];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!leftAddon && rightAddon) {
|
|
46
|
+
return ['auto', 'max-content'];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return ['auto'];
|
|
50
|
+
}, [leftAddon, rightAddon]);
|
|
51
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledContainer, _objectSpread(_objectSpread({
|
|
52
|
+
cols: cols,
|
|
53
|
+
"data-testid": InputGroupDataTestIds.InputGroupDataTestIds.CONTAINER
|
|
54
|
+
}, globals), {}, {
|
|
55
|
+
children: [leftAddon && /*#__PURE__*/_jsx__default["default"](styled.StyledLeftAddon, {
|
|
56
|
+
"data-testid": InputGroupDataTestIds.InputGroupDataTestIds.LEFTADDON
|
|
57
|
+
}, void 0, leftAddon), /*#__PURE__*/_jsx__default["default"](styled.StyledInput, {
|
|
58
|
+
"data-testid": InputGroupDataTestIds.InputGroupDataTestIds.INPUTCONTAINER
|
|
59
|
+
}, void 0, children), rightAddon && /*#__PURE__*/_jsx__default["default"](styled.StyledRightAddon, {
|
|
60
|
+
"data-testid": InputGroupDataTestIds.InputGroupDataTestIds.RIGHTADDON
|
|
61
|
+
}, void 0, rightAddon)]
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const DSInputGroupWithSchema = dsPropsHelpers.describe(DSInputGroup);
|
|
66
|
+
DSInputGroupWithSchema.propTypes = reactDescPropTypes.propTypes;
|
|
67
|
+
|
|
68
|
+
exports.DSInputGroup = DSInputGroup;
|
|
69
|
+
exports.DSInputGroupWithSchema = DSInputGroupWithSchema;
|
|
@@ -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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var InputGroup = require('./InputGroup.js');
|
|
6
|
+
var InputGroupDataTestIds = require('./InputGroupDataTestIds.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.DSInputGroup = InputGroup.DSInputGroup;
|
|
11
|
+
exports.DSInputGroupWithSchema = InputGroup.DSInputGroupWithSchema;
|
|
12
|
+
exports.InputGroupDataTestIds = InputGroupDataTestIds.InputGroupDataTestIds;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
const propTypes = {
|
|
9
|
+
leftAddon: dsPropsHelpers.PropTypes.element.description('Component to be added at the left side of the input'),
|
|
10
|
+
rightAddon: dsPropsHelpers.PropTypes.element.description('Component to be added at the right side of the input'),
|
|
11
|
+
children: dsPropsHelpers.PropTypes.node.isRequired.description('React component to apply autocomplete functionality').defaultValue('')
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.propTypes = propTypes;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var styled = require('styled-components');
|
|
6
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
7
|
+
require('../text-input/DSInputText.js');
|
|
8
|
+
var theming = require('../text-input/exported-related/theming.js');
|
|
9
|
+
require('../combobox/ComboBox.js');
|
|
10
|
+
var theming$1 = require('../combobox/theming.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
|
+
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
17
|
+
const StyledContainer = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
18
|
+
componentId: "sc-12elcva-0"
|
|
19
|
+
})(["width:100%;height:28px;& > div:nth-child(1){.", "-", ",.", "-", ",.", "-", "{border-top-right-radius:0;border-bottom-right-radius:0;}}& > div:nth-child(2):nth-last-child(2){.", "-", ",.", "-", ",.", "-", "{border-radius:0;}}& > div:nth-child(2):nth-last-child(1){.", "-", ",.", "-", ",.", "-", "{border-top-left-radius:0;border-bottom-left-radius:0;}}"], theming.DSInputTextName, theming.DSInputTextSlots.INPUT_WRAPPER, theming.DSInputTextName, theming.DSInputTextSlots.INPUT, theming$1.DSComboBoxName, theming$1.DSComboboxSlots.INPUT_WRAPPER, theming.DSInputTextName, theming.DSInputTextSlots.INPUT_WRAPPER, theming.DSInputTextName, theming.DSInputTextSlots.INPUT, theming$1.DSComboBoxName, theming$1.DSComboboxSlots.INPUT_WRAPPER, theming.DSInputTextName, theming.DSInputTextSlots.INPUT_WRAPPER, theming.DSInputTextName, theming.DSInputTextSlots.INPUT, theming$1.DSComboBoxName, theming$1.DSComboboxSlots.INPUT_WRAPPER);
|
|
20
|
+
const StyledAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
21
|
+
componentId: "sc-12elcva-1"
|
|
22
|
+
})(["outline:1px solid ", ";outline-offset:-1px;height:inherit;display:flex;button{border-width:1px;}&:hover{z-index:1;button:not(:disabled){border:1px solid ", ";}}&:focus-within{z-index:1;}"], _ref => {
|
|
23
|
+
let {
|
|
24
|
+
theme
|
|
25
|
+
} = _ref;
|
|
26
|
+
return theme.colors.neutral['400'];
|
|
27
|
+
}, _ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
theme
|
|
30
|
+
} = _ref2;
|
|
31
|
+
return theme.colors.brand['700'];
|
|
32
|
+
});
|
|
33
|
+
const StyledLeftAddon = /*#__PURE__*/styled__default["default"](StyledAddon).withConfig({
|
|
34
|
+
componentId: "sc-12elcva-2"
|
|
35
|
+
})(["border-top-left-radius:2px;border-bottom-left-radius:2px;margin-right:-1px;&:hover{button:not(:disabled){border-top-right-radius:0px;border-bottom-right-radius:0px;}}"]);
|
|
36
|
+
const StyledRightAddon = /*#__PURE__*/styled__default["default"](StyledAddon).withConfig({
|
|
37
|
+
componentId: "sc-12elcva-3"
|
|
38
|
+
})(["border-top-right-radius:2px;border-bottom-right-radius:2px;margin-left:-1px;&:hover{button:not(:disabled){border-top-left-radius:0px;border-bottom-left-radius:0px;}}"]);
|
|
39
|
+
const StyledInput = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
40
|
+
componentId: "sc-12elcva-4"
|
|
41
|
+
})(["&:focus-within,&:hover{z-index:1;}"]);
|
|
42
|
+
|
|
43
|
+
exports.StyledContainer = StyledContainer;
|
|
44
|
+
exports.StyledInput = StyledInput;
|
|
45
|
+
exports.StyledLeftAddon = StyledLeftAddon;
|
|
46
|
+
exports.StyledRightAddon = StyledRightAddon;
|
|
@@ -20,7 +20,6 @@ exports.UseSSNMaskWithSchema = useSSNMask.UseSSNMaskWithSchema;
|
|
|
20
20
|
exports.getSSNMaskedValue = useSSNMask.getSSNMaskedValue;
|
|
21
21
|
exports.useSSNMask = useSSNMask.useSSNMask;
|
|
22
22
|
exports.UseRegExpMaskWithSchema = useRegExpMask.UseRegExpMaskWithSchema;
|
|
23
|
-
exports.isRegExp = useRegExpMask.isRegExp;
|
|
24
23
|
exports.useRegExpMask = useRegExpMask.useRegExpMask;
|
|
25
24
|
exports.UseZipCodeMaskWithSchema = useZipCodeMask.UseZipCodeMaskWithSchema;
|
|
26
25
|
exports.getUseZipMaskedValue = useZipCodeMask.getUseZipMaskedValue;
|
|
@@ -22,8 +22,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
22
22
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
23
23
|
|
|
24
24
|
const _excluded = ["valueSetter", "onChange", "onKeyDown", "onBlur"];
|
|
25
|
-
const phoneSpecialChars = [['(', 0], [') ', 4], ['-', 9]];
|
|
26
|
-
const internationalPhoneSpecialChars = [['+1 (', 0], [') ', 7], ['-', 12]];
|
|
25
|
+
const phoneSpecialChars = [['(', 0], [') ', 4], [' - ', 9]];
|
|
26
|
+
const internationalPhoneSpecialChars = [['+1 (', 0], [') ', 7], [' - ', 12]];
|
|
27
27
|
|
|
28
28
|
const conformValue = (rawValue, cursorPos, lastKeyCode, opts) => {
|
|
29
29
|
const characters = rawValue.split(''); // Work with digits only
|
|
@@ -118,5 +118,4 @@ const UseRegExpMaskWithSchema = dsPropsHelpers.describe(useRegExpMask);
|
|
|
118
118
|
UseRegExpMaskWithSchema.propTypes = reactDescPropTypes.DSMaskRegExpHookPropsTypes;
|
|
119
119
|
|
|
120
120
|
exports.UseRegExpMaskWithSchema = UseRegExpMaskWithSchema;
|
|
121
|
-
exports.isRegExp = isRegExp;
|
|
122
121
|
exports.useRegExpMask = useRegExpMask;
|
package/cjs/mask-hook/index.js
CHANGED
|
@@ -20,7 +20,6 @@ exports.UseSSNMaskWithSchema = useSSNMask.UseSSNMaskWithSchema;
|
|
|
20
20
|
exports.getSSNMaskedValue = useSSNMask.getSSNMaskedValue;
|
|
21
21
|
exports.useSSNMask = useSSNMask.useSSNMask;
|
|
22
22
|
exports.UseRegExpMaskWithSchema = useRegExpMask.UseRegExpMaskWithSchema;
|
|
23
|
-
exports.isRegExp = useRegExpMask.isRegExp;
|
|
24
23
|
exports.useRegExpMask = useRegExpMask.useRegExpMask;
|
|
25
24
|
exports.UseZipCodeMaskWithSchema = useZipCodeMask.UseZipCodeMaskWithSchema;
|
|
26
25
|
exports.getUseZipMaskedValue = useZipCodeMask.getUseZipMaskedValue;
|