@elliemae/ds-controlled-form 2.4.2-rc.1 → 2.4.2-rc.11
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/parts/A11yFocusedOption.js +43 -0
- package/cjs/autocomplete/parts/container/Container.js +36 -24
- package/cjs/autocomplete/parts/container/styled.js +2 -2
- package/cjs/autocomplete/parts/menu-list/MenuList.js +4 -2
- 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/react-desc-prop-types.js +2 -1
- package/cjs/checkbox/styles.js +4 -2
- package/cjs/combobox/ComboBoxCTX.js +6 -3
- package/cjs/combobox/config/useComboBox.js +15 -4
- package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
- package/cjs/combobox/parts/A11ySelectedValues.js +0 -2
- package/cjs/combobox/parts/DropdownIndicator.js +2 -2
- package/cjs/combobox/parts/container/Container.js +10 -13
- package/cjs/combobox/parts/controls/Controls.js +16 -18
- package/cjs/combobox/parts/controls/useOnPillsNavigation.js +3 -3
- package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -2
- package/cjs/combobox/parts/controls-input/useControlsInput.js +3 -2
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +16 -23
- package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +6 -6
- package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +3 -3
- package/cjs/combobox/parts/menu-list/MenuList.js +7 -5
- package/cjs/combobox/parts/menu-list/styled.js +5 -3
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +16 -15
- package/cjs/combobox/react-desc-prop-types.js +3 -2
- package/cjs/combobox/utils/listHelper.js +10 -0
- 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/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 +21 -20
- package/esm/autocomplete/parts/A11yFocusedOption.js +32 -0
- package/esm/autocomplete/parts/container/Container.js +39 -27
- package/esm/autocomplete/parts/container/styled.js +2 -2
- package/esm/autocomplete/parts/menu-list/MenuList.js +5 -3
- 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/react-desc-prop-types.js +2 -1
- package/esm/checkbox/styles.js +4 -3
- package/esm/combobox/ComboBoxCTX.js +6 -3
- package/esm/combobox/config/useComboBox.js +16 -5
- package/esm/combobox/parts/A11yFocusedOption.js +15 -7
- package/esm/combobox/parts/A11ySelectedValues.js +0 -2
- package/esm/combobox/parts/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/container/Container.js +10 -13
- package/esm/combobox/parts/controls/Controls.js +16 -18
- package/esm/combobox/parts/controls/useOnPillsNavigation.js +3 -3
- package/esm/combobox/parts/controls-input/ControlsInput.js +2 -2
- package/esm/combobox/parts/controls-input/useControlsInput.js +3 -2
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +17 -24
- package/esm/combobox/parts/controls-input/useMaskedOnChange.js +6 -6
- package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/header-list/useHeaderListHandlers.js +3 -3
- package/esm/combobox/parts/menu-list/MenuList.js +7 -5
- package/esm/combobox/parts/menu-list/styled.js +5 -4
- package/esm/combobox/parts/menu-list/useItemRenderer.js +18 -17
- package/esm/combobox/react-desc-prop-types.js +3 -2
- package/esm/combobox/utils/listHelper.js +10 -1
- 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 +12 -12
- 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/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 +18 -17
- 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 +1 -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;
|
|
@@ -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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dataTestIds = require('./data-test-ids.js');
|
|
6
|
+
var theming = require('./theming.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.InputGroupDataTestIds = dataTestIds.InputGroupDataTestIds;
|
|
11
|
+
exports.DSInputGroupName = theming.DSInputGroupName;
|
|
12
|
+
exports.DSInputGroupSlots = theming.DSInputGroupSlots;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const DSInputGroupName = 'ds-input-group';
|
|
6
|
+
const DSInputGroupSlots = {
|
|
7
|
+
CONTAINER: 'root',
|
|
8
|
+
LEFT_ADDON: 'leftaddon',
|
|
9
|
+
RIGHT_ADDON: 'rightaddon'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.DSInputGroupName = DSInputGroupName;
|
|
13
|
+
exports.DSInputGroupSlots = DSInputGroupSlots;
|
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
6
7
|
var dsGrid = require('@elliemae/ds-grid');
|
|
7
8
|
require('../text-input/DSInputText.js');
|
|
8
|
-
var theming = require('../text-input/exported-related/theming.js');
|
|
9
|
+
var theming$1 = require('../text-input/exported-related/theming.js');
|
|
9
10
|
require('../combobox/ComboBox.js');
|
|
10
|
-
var theming$
|
|
11
|
+
var theming$2 = require('../combobox/theming.js');
|
|
12
|
+
var theming = require('./exported-related/theming.js');
|
|
11
13
|
|
|
12
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
15
|
|
|
14
|
-
var
|
|
16
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
const StyledContainer =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 => {
|
|
18
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
19
|
+
const StyledContainer = dsSystem.styled(dsGrid.Grid, {
|
|
20
|
+
name: theming.DSInputGroupName,
|
|
21
|
+
slot: theming.DSInputGroupSlots.CONTAINER
|
|
22
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n width: 100%;\n height: 28px;\n\n // input in left position with right addon\n & > div:nth-child(1) {\n .", "-", ",\n .", "-", ",\n .", "-", " {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n }\n\n // input in center position with left and right addon\n & > div:nth-child(2):nth-last-child(2) {\n .", "-", ",\n .", "-", ",\n .", "-", " {\n border-radius: 0;\n }\n }\n\n // input in right position with left addon\n & > div:nth-child(2):nth-last-child(1) {\n .", "-", ",\n .", "-", ",\n .", "-", " {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n }\n"])), theming$1.DSInputTextName, theming$1.DSInputTextSlots.INPUT_WRAPPER, theming$1.DSInputTextName, theming$1.DSInputTextSlots.INPUT, theming$2.DSComboBoxName, theming$2.DSComboboxSlots.INPUT_WRAPPER, theming$1.DSInputTextName, theming$1.DSInputTextSlots.INPUT_WRAPPER, theming$1.DSInputTextName, theming$1.DSInputTextSlots.INPUT, theming$2.DSComboBoxName, theming$2.DSComboboxSlots.INPUT_WRAPPER, theming$1.DSInputTextName, theming$1.DSInputTextSlots.INPUT_WRAPPER, theming$1.DSInputTextName, theming$1.DSInputTextSlots.INPUT, theming$2.DSComboBoxName, theming$2.DSComboboxSlots.INPUT_WRAPPER);
|
|
23
|
+
const StyledAddon = dsSystem.styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n outline: 1px solid ", ";\n outline-offset: -1px;\n height: inherit;\n display: flex;\n button {\n border-width: 1px;\n }\n &:hover {\n z-index: 2;\n button:not(:disabled) {\n border: 1px solid ", ";\n }\n }\n &:focus-within {\n z-index: 2;\n }\n"])), _ref => {
|
|
23
24
|
let {
|
|
24
25
|
theme
|
|
25
26
|
} = _ref;
|
|
@@ -30,15 +31,15 @@ const StyledAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
|
30
31
|
} = _ref2;
|
|
31
32
|
return theme.colors.brand['700'];
|
|
32
33
|
});
|
|
33
|
-
const StyledLeftAddon =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const StyledLeftAddon = dsSystem.styled(StyledAddon, {
|
|
35
|
+
name: theming.DSInputGroupName,
|
|
36
|
+
slot: theming.DSInputGroupSlots.LEFT_ADDON
|
|
37
|
+
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n border-top-left-radius: 2px;\n border-bottom-left-radius: 2px;\n margin-right: -1px;\n &:hover {\n button:not(:disabled) {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n"])));
|
|
38
|
+
const StyledRightAddon = dsSystem.styled(StyledAddon, {
|
|
39
|
+
name: theming.DSInputGroupName,
|
|
40
|
+
slot: theming.DSInputGroupSlots.RIGHT_ADDON
|
|
41
|
+
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px;\n margin-left: -1px;\n &:hover {\n button:not(:disabled) {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n"])));
|
|
42
|
+
const StyledInput = dsSystem.styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["\n z-index: 1;\n"])));
|
|
42
43
|
|
|
43
44
|
exports.StyledContainer = StyledContainer;
|
|
44
45
|
exports.StyledInput = StyledInput;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
6
|
+
import { useContext, useMemo } from 'react';
|
|
7
|
+
import { styled } from '@elliemae/ds-system';
|
|
8
|
+
import { AutocompleteContext } from '../AutocompleteCTX.js';
|
|
9
|
+
import { getSelectableOptions } from '../utils/listHelper.js';
|
|
10
|
+
|
|
11
|
+
var _templateObject;
|
|
12
|
+
const isSeparator = el => (el === null || el === void 0 ? void 0 : el.type) === 'separator';
|
|
13
|
+
const StyledA11ySelectedValues = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 1px;\n height: 1px;\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n"])));
|
|
14
|
+
const A11yFocusedOption = () => {
|
|
15
|
+
const {
|
|
16
|
+
props: {
|
|
17
|
+
options
|
|
18
|
+
},
|
|
19
|
+
focusOptionIdx,
|
|
20
|
+
showPopover
|
|
21
|
+
} = useContext(AutocompleteContext);
|
|
22
|
+
return useMemo(() => {
|
|
23
|
+
const selectabledOptions = getSelectableOptions(options);
|
|
24
|
+
const focusOption = options.find(option => !isSeparator(option) && option.dsId === focusOptionIdx);
|
|
25
|
+
const focusSelectableOptionIdx = selectabledOptions.findIndex(option => option.dsId === focusOptionIdx);
|
|
26
|
+
return /*#__PURE__*/_jsx(StyledA11ySelectedValues, {
|
|
27
|
+
"aria-live": "polite"
|
|
28
|
+
}, void 0, !isSeparator(focusOption) && showPopover && focusOption && "option ".concat(focusOption.label, " focused.").concat(focusSelectableOptionIdx + 1, " of ").concat(selectabledOptions.length, "\n "));
|
|
29
|
+
}, [options, showPopover, focusOptionIdx]);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { A11yFocusedOption, StyledA11ySelectedValues, isSeparator };
|