@elliemae/ds-controlled-form 2.4.2-rc.9 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/autocomplete/config/useAutocomplete.js +0 -1
- package/cjs/autocomplete/parts/A11yFocusedOption.js +46 -0
- package/cjs/autocomplete/parts/container/Container.js +36 -24
- package/cjs/autocomplete/parts/container/styled.js +2 -2
- package/cjs/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
- package/cjs/autocomplete/parts/menu-list/MenuList.js +6 -6
- package/cjs/autocomplete/parts/menu-list/styled.js +2 -2
- package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
- package/cjs/autocomplete/parts/styled.js +2 -0
- package/cjs/autocomplete/utils/listHelper.js +1 -1
- package/cjs/checkbox/ControlledCheckbox.js +1 -1
- package/cjs/checkbox/config/useValidateProps.js +6 -3
- package/cjs/checkbox/react-desc-prop-types.js +2 -1
- package/cjs/checkbox/styles.js +73 -27
- package/cjs/checkbox/utils/styleHelpers.js +20 -2
- package/cjs/combobox/ComboBoxCTX.js +6 -3
- package/cjs/combobox/config/useComboBox.js +16 -6
- package/cjs/combobox/config/useCorrectOptions.js +1 -2
- package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
- package/cjs/combobox/parts/A11ySelectedValues.js +2 -4
- package/cjs/combobox/parts/DropdownIndicator.js +15 -7
- package/cjs/combobox/parts/container/Container.js +11 -14
- package/cjs/combobox/parts/container/styled.js +11 -10
- package/cjs/combobox/parts/controls/Controls.js +19 -27
- package/cjs/combobox/parts/controls/styled.js +54 -22
- package/cjs/combobox/parts/controls/useOnPillsNavigation.js +7 -15
- package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -2
- package/cjs/combobox/parts/controls-input/styled.js +41 -11
- package/cjs/combobox/parts/controls-input/useControlsInput.js +4 -7
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +19 -28
- package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
- package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/cjs/combobox/parts/header-list/HeaderList.js +1 -1
- package/cjs/combobox/parts/header-list/styled.js +39 -10
- package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
- package/cjs/combobox/parts/menu-list/MenuList.js +8 -6
- package/cjs/combobox/parts/menu-list/styled.js +38 -20
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +18 -17
- package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
- package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
- package/cjs/combobox/parts/styled.js +6 -7
- package/cjs/combobox/react-desc-prop-types.js +3 -2
- package/cjs/combobox/sharedTypes.js +2 -2
- package/cjs/combobox/utils/listHelper.js +14 -9
- package/cjs/date-range-picker/config/useRangePickerLogic.js +4 -8
- package/cjs/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
- package/cjs/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
- package/cjs/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
- package/cjs/date-time-picker/config/useChangeHandlers.js +3 -3
- package/cjs/date-time-picker/config/useControlledDateTimePicker.js +1 -1
- package/cjs/date-time-picker/config/useFocusTracker.js +1 -1
- package/cjs/date-time-picker/config/useGetDestructuredValues.js +6 -6
- package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
- package/cjs/date-time-picker/config/useGetReferences.js +1 -1
- package/cjs/date-time-picker/config/useRelevantValueFromProps.js +1 -1
- package/cjs/date-time-picker/config/useValidateProps.js +42 -11
- package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +1 -3
- package/cjs/date-time-picker/parts/DateInputs/DDInput.js +3 -7
- package/cjs/date-time-picker/parts/DateInputs/MMInput.js +3 -7
- package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +3 -7
- package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +13 -23
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +6 -14
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +8 -10
- package/cjs/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -15
- package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +1 -2
- package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +0 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +3 -5
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +3 -5
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +5 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +6 -8
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +5 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -15
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +2 -5
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +2 -5
- package/cjs/date-time-picker/parts/Styleds.js +12 -6
- package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +2 -4
- package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +3 -8
- package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +3 -7
- package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +14 -26
- package/cjs/date-time-picker/utils/dateHelpers.js +17 -34
- package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
- package/cjs/date-time-picker/utils/stringHelpers.js +5 -11
- package/cjs/input-group/InputGroup.js +8 -7
- package/cjs/input-group/exported-related/data-test-ids.js +12 -0
- package/cjs/input-group/exported-related/index.js +12 -0
- package/cjs/input-group/exported-related/theming.js +13 -0
- package/cjs/input-group/styled.js +90 -23
- package/cjs/large-text-input/DSControlledLargeTextInput.js +1 -1
- package/cjs/large-text-input/styles.js +27 -13
- package/cjs/mask-hook/hooks/useNumberMask.js +1 -5
- package/cjs/mask-hook/hooks/usePhoneMask.js +1 -4
- package/cjs/mask-hook/hooks/useRegExpMask.js +4 -7
- package/cjs/mask-hook/hooks/useSSNMask.js +1 -4
- package/cjs/mask-hook/hooks/useZipCodeMask.js +1 -4
- package/cjs/mask-hook/utils/addSpecialCharacters.js +0 -1
- package/cjs/mask-hook/utils/flatStringArray.js +0 -1
- package/cjs/text-input/config/useInputText.js +0 -1
- package/cjs/text-input/styled/borders.js +18 -11
- package/cjs/text-input/styled/components.js +49 -10
- package/cjs/toggle/ControlledToggle.js +2 -3
- package/cjs/toggle/styles.js +7 -5
- package/esm/autocomplete/config/useAutocomplete.js +0 -1
- package/esm/autocomplete/parts/A11yFocusedOption.js +36 -0
- package/esm/autocomplete/parts/container/Container.js +39 -27
- package/esm/autocomplete/parts/container/styled.js +2 -2
- package/esm/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
- package/esm/autocomplete/parts/menu-list/MenuList.js +7 -7
- package/esm/autocomplete/parts/menu-list/styled.js +2 -2
- package/esm/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
- package/esm/autocomplete/parts/styled.js +1 -0
- package/esm/autocomplete/utils/listHelper.js +1 -1
- package/esm/checkbox/ControlledCheckbox.js +2 -2
- package/esm/checkbox/config/useValidateProps.js +6 -3
- package/esm/checkbox/react-desc-prop-types.js +2 -1
- package/esm/checkbox/styles.js +73 -24
- package/esm/checkbox/utils/styleHelpers.js +20 -2
- package/esm/combobox/ComboBoxCTX.js +6 -3
- package/esm/combobox/config/useComboBox.js +16 -6
- package/esm/combobox/config/useCorrectOptions.js +1 -2
- package/esm/combobox/parts/A11yFocusedOption.js +15 -7
- package/esm/combobox/parts/A11ySelectedValues.js +2 -4
- package/esm/combobox/parts/DropdownIndicator.js +15 -6
- package/esm/combobox/parts/container/Container.js +11 -14
- package/esm/combobox/parts/container/styled.js +11 -6
- package/esm/combobox/parts/controls/Controls.js +19 -27
- package/esm/combobox/parts/controls/styled.js +54 -18
- package/esm/combobox/parts/controls/useOnPillsNavigation.js +7 -15
- package/esm/combobox/parts/controls-input/ControlsInput.js +2 -2
- package/esm/combobox/parts/controls-input/styled.js +41 -7
- package/esm/combobox/parts/controls-input/useControlsInput.js +4 -7
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +20 -29
- package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
- package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/header-list/HeaderList.js +1 -1
- package/esm/combobox/parts/header-list/styled.js +40 -7
- package/esm/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
- package/esm/combobox/parts/menu-list/MenuList.js +8 -6
- package/esm/combobox/parts/menu-list/styled.js +38 -17
- package/esm/combobox/parts/menu-list/useItemRenderer.js +20 -19
- package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
- package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
- package/esm/combobox/parts/styled.js +6 -3
- package/esm/combobox/react-desc-prop-types.js +3 -2
- package/esm/combobox/sharedTypes.js +2 -2
- package/esm/combobox/utils/listHelper.js +14 -10
- package/esm/date-range-picker/config/useRangePickerLogic.js +3 -7
- package/esm/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
- package/esm/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
- package/esm/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
- package/esm/date-time-picker/config/useChangeHandlers.js +3 -3
- package/esm/date-time-picker/config/useControlledDateTimePicker.js +1 -1
- package/esm/date-time-picker/config/useFocusTracker.js +1 -1
- package/esm/date-time-picker/config/useGetDestructuredValues.js +6 -6
- package/esm/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
- package/esm/date-time-picker/config/useGetReferences.js +1 -1
- package/esm/date-time-picker/config/useRelevantValueFromProps.js +1 -1
- package/esm/date-time-picker/config/useValidateProps.js +42 -11
- package/esm/date-time-picker/parts/ClearButton/ClearButton.js +1 -3
- package/esm/date-time-picker/parts/DateInputs/DDInput.js +3 -7
- package/esm/date-time-picker/parts/DateInputs/MMInput.js +3 -7
- package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +3 -7
- package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +13 -23
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +6 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +8 -10
- package/esm/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +0 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +0 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +3 -5
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +3 -5
- package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +5 -7
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +6 -8
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +5 -7
- package/esm/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
- package/esm/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -14
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +2 -5
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
- package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +2 -5
- package/esm/date-time-picker/parts/Styleds.js +12 -6
- package/esm/date-time-picker/parts/TimeInputs/HHInput.js +2 -4
- package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +3 -8
- package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +3 -7
- package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +14 -26
- package/esm/date-time-picker/utils/dateHelpers.js +17 -34
- package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
- package/esm/date-time-picker/utils/stringHelpers.js +5 -11
- package/esm/input-group/InputGroup.js +5 -4
- package/esm/input-group/exported-related/data-test-ids.js +8 -0
- package/esm/input-group/exported-related/index.js +2 -0
- package/esm/input-group/exported-related/theming.js +8 -0
- package/esm/input-group/styled.js +89 -18
- package/esm/large-text-input/DSControlledLargeTextInput.js +1 -1
- package/esm/large-text-input/styles.js +27 -9
- package/esm/mask-hook/hooks/useNumberMask.js +1 -5
- package/esm/mask-hook/hooks/usePhoneMask.js +1 -4
- package/esm/mask-hook/hooks/useRegExpMask.js +4 -7
- package/esm/mask-hook/hooks/useSSNMask.js +1 -4
- package/esm/mask-hook/hooks/useZipCodeMask.js +1 -4
- package/esm/mask-hook/utils/addSpecialCharacters.js +0 -1
- package/esm/mask-hook/utils/flatStringArray.js +0 -1
- package/esm/text-input/config/useInputText.js +0 -1
- package/esm/text-input/styled/borders.js +18 -7
- package/esm/text-input/styled/components.js +49 -6
- package/esm/toggle/ControlledToggle.js +0 -1
- package/esm/toggle/styles.js +7 -5
- package/package.json +35 -15
- package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
- package/types/autocomplete/parts/container/styled.d.ts +1 -1
- package/types/autocomplete/parts/styled.d.ts +0 -0
- package/types/autocomplete/utils/listHelper.d.ts +5 -5
- package/types/checkbox/react-desc-prop-types.d.ts +1 -1
- package/types/checkbox/styles.d.ts +1 -0
- package/types/combobox/parts/menu-list/styled.d.ts +1 -0
- package/types/combobox/react-desc-prop-types.d.ts +8 -6
- package/types/combobox/sharedTypes.d.ts +3 -2
- package/types/combobox/utils/listHelper.d.ts +1 -0
- package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
- package/types/input-group/exported-related/index.d.ts +2 -0
- package/types/input-group/exported-related/theming.d.ts +6 -0
- package/types/input-group/styled.d.ts +4 -7
- package/types/text-input/config/useInputText.d.ts +4 -4
|
@@ -30,12 +30,12 @@ const useKeyboardNavigation = () => {
|
|
|
30
30
|
withoutPortal
|
|
31
31
|
},
|
|
32
32
|
inputValue,
|
|
33
|
-
|
|
33
|
+
menuState,
|
|
34
34
|
focusOptionIdx,
|
|
35
35
|
listRef,
|
|
36
36
|
selectAllCheckboxRef,
|
|
37
37
|
toggleSelectionButtonRef,
|
|
38
|
-
|
|
38
|
+
setMenuState,
|
|
39
39
|
setInputValue,
|
|
40
40
|
scrollOptionIntoView,
|
|
41
41
|
setFocusOptionIdx
|
|
@@ -48,17 +48,12 @@ const useKeyboardNavigation = () => {
|
|
|
48
48
|
// =============================================================================
|
|
49
49
|
// CUSTOM KEYS
|
|
50
50
|
// =============================================================================
|
|
51
|
-
if (onKeyDown &&
|
|
51
|
+
if (onKeyDown && currentItem?.type === constants.MENU_OPTION_TYPES.OPTION) onKeyDown(e, currentItem);
|
|
52
52
|
|
|
53
|
-
if (['ArrowDown', 'ArrowUp', 'Enter', 'Spacebar'].includes(e.key) || e.keyCode >= 48 && e.keyCode <= 90) {
|
|
54
|
-
|
|
53
|
+
if ((['ArrowDown', 'ArrowUp', 'Enter', 'Spacebar'].includes(e.key) || e.keyCode >= 48 && e.keyCode <= 90) && !menuState) {
|
|
54
|
+
setMenuState(true);
|
|
55
55
|
window.requestAnimationFrame(() => {
|
|
56
|
-
if (listRef.current
|
|
57
|
-
window.scrollTo({
|
|
58
|
-
top: listRef.current.offsetHeight,
|
|
59
|
-
behavior: 'smooth'
|
|
60
|
-
});
|
|
61
|
-
}
|
|
56
|
+
if (listRef.current) listHelper.scrollIfNeeded(listRef.current);
|
|
62
57
|
});
|
|
63
58
|
} // =============================================================================
|
|
64
59
|
// ESCAPE
|
|
@@ -73,13 +68,13 @@ const useKeyboardNavigation = () => {
|
|
|
73
68
|
setInputValue('');
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
if (!inline)
|
|
71
|
+
if (!inline) setMenuState(false, 'close', e);
|
|
77
72
|
} // =============================================================================
|
|
78
73
|
// ENTER KEY TO CREATE ELEMENTS
|
|
79
74
|
// =============================================================================
|
|
80
75
|
|
|
81
76
|
|
|
82
|
-
if (e.key === 'Enter' &&
|
|
77
|
+
if (e.key === 'Enter' && currentItem?.type === constants.INTERNAL_MENU_OPTION_TYPES.CREATABLE && onCreate) {
|
|
83
78
|
onCreate(inputValue); // blank active item to force search last one
|
|
84
79
|
|
|
85
80
|
setFocusOptionIdx('');
|
|
@@ -95,12 +90,12 @@ const useKeyboardNavigation = () => {
|
|
|
95
90
|
e.preventDefault();
|
|
96
91
|
e.stopPropagation();
|
|
97
92
|
|
|
98
|
-
if (focusOptionIdx !== '' && (
|
|
93
|
+
if (focusOptionIdx !== '' && (menuState || inline) && currentItem?.type === constants.MENU_OPTION_TYPES.OPTION && !currentItem.disabled) {
|
|
99
94
|
if (onFilter) onFilter(allOptions, '');
|
|
100
95
|
setInputValue('');
|
|
101
96
|
|
|
102
97
|
if (!multiple) {
|
|
103
|
-
|
|
98
|
+
setMenuState(false, 'selectOption', e);
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
onChange(listHelper.getSuggestedValueOnChange(currentItem, selectedValues), currentItem, e);
|
|
@@ -108,7 +103,7 @@ const useKeyboardNavigation = () => {
|
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
if (e.key === 'Enter' && e.altKey) {
|
|
111
|
-
|
|
106
|
+
setMenuState(false, 'selectOption', e);
|
|
112
107
|
}
|
|
113
108
|
|
|
114
109
|
if (e.key === 'a' && e.ctrlKey && multiple && onSelectAll) {
|
|
@@ -122,7 +117,7 @@ const useKeyboardNavigation = () => {
|
|
|
122
117
|
e.preventDefault();
|
|
123
118
|
e.stopPropagation();
|
|
124
119
|
|
|
125
|
-
if ((
|
|
120
|
+
if ((menuState || inline) && selectableOptions.length) {
|
|
126
121
|
const nextItemIndexIndex = listHelper.findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable);
|
|
127
122
|
|
|
128
123
|
if (nextItemIndexIndex > -1) {
|
|
@@ -139,12 +134,12 @@ const useKeyboardNavigation = () => {
|
|
|
139
134
|
const prevItemIndex = listHelper.findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable, -1);
|
|
140
135
|
|
|
141
136
|
if (prevItemIndex > -1) {
|
|
142
|
-
if (
|
|
137
|
+
if (menuState || inline) {
|
|
143
138
|
setFocusOptionIdx(filteredOptions[prevItemIndex].dsId);
|
|
144
139
|
scrollOptionIntoView(filteredOptions[prevItemIndex].dsId);
|
|
145
140
|
} else {
|
|
146
141
|
// open menu and search last item to focused
|
|
147
|
-
|
|
142
|
+
setMenuState(true, 'open', e);
|
|
148
143
|
const lastItemIndex = listHelper.findInCircularList(filteredOptions, 0, isOptionFocuseable, -1);
|
|
149
144
|
setFocusOptionIdx(filteredOptions[lastItemIndex].dsId);
|
|
150
145
|
setTimeout(() => {
|
|
@@ -167,22 +162,18 @@ const useKeyboardNavigation = () => {
|
|
|
167
162
|
if (onFilter) onFilter(allOptions, inputValue);
|
|
168
163
|
}
|
|
169
164
|
|
|
170
|
-
if (e.key === 'Tab' && !inline &&
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const element = (_selectAllCheckboxRef = selectAllCheckboxRef.current) !== null && _selectAllCheckboxRef !== void 0 ? _selectAllCheckboxRef : toggleSelectionButtonRef.current;
|
|
165
|
+
if (e.key === 'Tab' && !inline && menuState) {
|
|
166
|
+
const element = selectAllCheckboxRef.current ?? toggleSelectionButtonRef.current;
|
|
174
167
|
|
|
175
168
|
if (element) {
|
|
176
169
|
e.preventDefault();
|
|
177
170
|
element.focus();
|
|
171
|
+
} else {
|
|
172
|
+
setMenuState(false, 'blur', e);
|
|
178
173
|
}
|
|
179
174
|
}
|
|
180
|
-
|
|
181
|
-
if (e.key === 'Tab' && !multiple && showPopover) {
|
|
182
|
-
setShowPopover(false);
|
|
183
|
-
}
|
|
184
175
|
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
185
|
-
[onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal,
|
|
176
|
+
[onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal, setMenuState, onCancel, onFilter, setInputValue, listRef, focusOptionIdx, menuState, selectableOptions.length, filteredOptions, currentItemIndex, setFocusOptionIdx, selectedValues, onChange, selectAllCheckboxRef, toggleSelectionButtonRef]);
|
|
186
177
|
return {
|
|
187
178
|
onInputKeyDown
|
|
188
179
|
};
|
|
@@ -13,31 +13,31 @@ const useMaskedOnChange = () => {
|
|
|
13
13
|
onFilter,
|
|
14
14
|
allOptions
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
setMenuState,
|
|
17
17
|
setInputValue,
|
|
18
18
|
setShowSelectedOptions
|
|
19
19
|
} = React.useContext(ComboBoxCTX.ComboBoxContext); // default onchange when no mask provided
|
|
20
20
|
|
|
21
21
|
const handleOnChange = React.useCallback(e => {
|
|
22
22
|
setShowSelectedOptions(false);
|
|
23
|
-
|
|
23
|
+
setMenuState(true, 'filter', e);
|
|
24
24
|
|
|
25
25
|
if (onFilter) {
|
|
26
26
|
onFilter(listHelper.filterOptions(e.currentTarget.value, allOptions), e.currentTarget.value);
|
|
27
27
|
setInputValue(e.currentTarget.value);
|
|
28
28
|
}
|
|
29
|
-
}, [allOptions, onFilter, setInputValue,
|
|
29
|
+
}, [allOptions, onFilter, setInputValue, setMenuState, setShowSelectedOptions]); // onchange used when mask is provided
|
|
30
30
|
|
|
31
|
-
const handleOnChangeMask = React.useCallback((
|
|
31
|
+
const handleOnChangeMask = React.useCallback((e, mask) => {
|
|
32
32
|
setShowSelectedOptions(false);
|
|
33
|
-
|
|
33
|
+
setMenuState(true, 'filter', e);
|
|
34
34
|
if (mask && onFilter) onFilter(listHelper.filterOptions(mask, allOptions), mask);else if (!mask && onFilter) onFilter(allOptions, '');
|
|
35
|
-
}, [allOptions, onFilter,
|
|
35
|
+
}, [allOptions, onFilter, setMenuState, setShowSelectedOptions]);
|
|
36
36
|
const onChangeMask = useMask({
|
|
37
37
|
valueSetter: setInputValue,
|
|
38
38
|
onChange: handleOnChangeMask
|
|
39
39
|
});
|
|
40
|
-
return
|
|
40
|
+
return onChangeMask?.onChange || handleOnChange;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
exports.useMaskedOnChange = useMaskedOnChange;
|
|
@@ -20,14 +20,14 @@ const DropdownIndicator = () => {
|
|
|
20
20
|
props: {
|
|
21
21
|
disabled
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
menuState
|
|
24
24
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
25
25
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledDropDownButton, {
|
|
26
26
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.DROPDOWN,
|
|
27
27
|
"aria-controls": "combo-listbox",
|
|
28
28
|
"aria-labelledby": "combo-label",
|
|
29
29
|
disabled: disabled,
|
|
30
|
-
"aria-expanded":
|
|
30
|
+
"aria-expanded": menuState,
|
|
31
31
|
"aria-haspopup": "listbox",
|
|
32
32
|
"aria-hidden": true,
|
|
33
33
|
buttonType: "icon",
|
|
@@ -59,7 +59,7 @@ const HeaderList = () => {
|
|
|
59
59
|
size: DSButton.BUTTON_SIZES.S,
|
|
60
60
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.MULTISELECT.SHOW_SELECTED_OPTIONS_TOGGLE,
|
|
61
61
|
innerRef: toggleSelectionButtonRef
|
|
62
|
-
}, void 0, !showSelectedOptions ?
|
|
62
|
+
}, void 0, !showSelectedOptions ? `SHOW SELECTED [${multiSelectedValues.length}]` : 'SHOW ALL') : _StyledNoOptionsSelec || (_StyledNoOptionsSelec = /*#__PURE__*/_jsx__default["default"](styled.StyledNoOptionsSelected, {}, void 0, "0 SELECTED"))));
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
exports.HeaderList = HeaderList;
|
|
@@ -2,20 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
5
|
var dsSystem = require('@elliemae/ds-system');
|
|
7
6
|
var DSButton = require('@elliemae/ds-button');
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/* eslint-disable max-len */
|
|
9
|
+
const StyledHeaderListWrapper = dsSystem.styled.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
position: fixed;
|
|
12
|
+
top: 0;
|
|
13
|
+
z-index: 10;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
padding: 0px 12px 0px 16px;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 28px;
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
box-shadow: 0 4px 2px -4px ${props => props.theme.colors.neutral[700]};
|
|
20
|
+
overflow-x: hidden;
|
|
10
21
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const StyledButtonSelection = dsSystem.styled(DSButton.DSButtonV2)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
& button {
|
|
23
|
+
font-size: 13px;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const StyledButtonSelection = dsSystem.styled(DSButton.DSButtonV2)`
|
|
27
|
+
border-radius: 0px;
|
|
28
|
+
padding: 0 ${props => props.theme.space.xxs};
|
|
29
|
+
margin: 0;
|
|
30
|
+
align-items: center;
|
|
31
|
+
transition: unset;
|
|
32
|
+
&:hover:not([disabled]) {
|
|
33
|
+
background-color: transparent;
|
|
34
|
+
color: ${props => props.theme.colors.brand['700']};
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
const StyledSelectedItems = dsSystem.styled.div`
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
`;
|
|
41
|
+
const StyledNoOptionsSelected = dsSystem.styled.div`
|
|
42
|
+
padding: 0 ${props => props.theme.space.xxs};
|
|
43
|
+
`;
|
|
44
|
+
const StyledSelectAllCheckbox = dsSystem.styled.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
`;
|
|
19
48
|
|
|
20
49
|
exports.StyledButtonSelection = StyledButtonSelection;
|
|
21
50
|
exports.StyledHeaderListWrapper = StyledHeaderListWrapper;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
@@ -20,7 +19,7 @@ const useHeaderListHandlers = () => {
|
|
|
20
19
|
},
|
|
21
20
|
showSelectedOptions,
|
|
22
21
|
setShowSelectedOptions,
|
|
23
|
-
|
|
22
|
+
setMenuState
|
|
24
23
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
25
24
|
const multiSelectedValues = selectedValues;
|
|
26
25
|
const selectableOptions = listHelper.getSelectableOptions(filteredOptions);
|
|
@@ -29,7 +28,7 @@ const useHeaderListHandlers = () => {
|
|
|
29
28
|
return true;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
if (
|
|
31
|
+
if (multiSelectedValues?.length === 0) {
|
|
33
32
|
return false;
|
|
34
33
|
}
|
|
35
34
|
|
|
@@ -59,27 +58,21 @@ const useHeaderListHandlers = () => {
|
|
|
59
58
|
|
|
60
59
|
const handleKeyDown = React.useCallback(e => {
|
|
61
60
|
if (e.key === 'Escape') {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setShowPopover(false);
|
|
65
|
-
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
|
|
61
|
+
setMenuState(false, 'close', e);
|
|
62
|
+
innerRef.current?.focus();
|
|
66
63
|
}
|
|
67
|
-
}, [
|
|
64
|
+
}, [setMenuState, innerRef]); // when hitting tab on selected values button filter we target the input again
|
|
68
65
|
|
|
69
66
|
const handleFilterSelectionBtnOnTab = React.useCallback(e => {
|
|
70
67
|
if (e.key === 'Tab' && !e.shiftKey) {
|
|
71
|
-
var _innerRef$current2;
|
|
72
|
-
|
|
73
68
|
e.preventDefault();
|
|
74
|
-
|
|
69
|
+
innerRef.current?.focus();
|
|
75
70
|
}
|
|
76
71
|
}, [innerRef]);
|
|
77
72
|
const handleCheckAllOnTab = React.useCallback(e => {
|
|
78
73
|
if (e.key === 'Tab' && !e.shiftKey && multiSelectedValues.length === 0) {
|
|
79
|
-
var _innerRef$current3;
|
|
80
|
-
|
|
81
74
|
e.preventDefault();
|
|
82
|
-
|
|
75
|
+
innerRef.current?.focus();
|
|
83
76
|
}
|
|
84
77
|
}, [innerRef, multiSelectedValues]);
|
|
85
78
|
React.useEffect(() => {
|
|
@@ -16,11 +16,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
|
|
17
17
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
18
|
|
|
19
|
-
var _HeaderList
|
|
19
|
+
var _HeaderList;
|
|
20
20
|
const MenuList = () => {
|
|
21
|
+
var _StyledNoResultsWrapp;
|
|
22
|
+
|
|
21
23
|
const {
|
|
22
24
|
props: {
|
|
23
25
|
menuMinWidth,
|
|
26
|
+
noOptionsMessage,
|
|
24
27
|
menuMaxHeight,
|
|
25
28
|
onCreate,
|
|
26
29
|
inline,
|
|
@@ -61,15 +64,14 @@ const MenuList = () => {
|
|
|
61
64
|
role: "listbox",
|
|
62
65
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.LIST,
|
|
63
66
|
style: {
|
|
64
|
-
height: virtualListHelpers
|
|
67
|
+
height: virtualListHelpers?.totalSize,
|
|
65
68
|
margin: inline ? '0px' : '8px 0px'
|
|
66
69
|
}
|
|
67
70
|
}, void 0, ItemRenderer)
|
|
68
71
|
}) : _StyledNoResultsWrapp || (_StyledNoResultsWrapp = /*#__PURE__*/_jsx__default["default"](styled.StyledNoResultsWrapper, {
|
|
69
|
-
role: "alert"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, width), [wrapperListRef, inline, preventLoseInputFocus, menuMinWidth, withHeader, filteredOptions.length, onCreate, menuMaxHeight, listRef, virtualListHelpers === null || virtualListHelpers === void 0 ? void 0 : virtualListHelpers.totalSize, ItemRenderer, width]);
|
|
72
|
+
role: "alert"
|
|
73
|
+
}, void 0, noOptionsMessage))]
|
|
74
|
+
}, width), [wrapperListRef, inline, preventLoseInputFocus, width, menuMinWidth, withHeader, filteredOptions.length, onCreate, menuMaxHeight, listRef, virtualListHelpers?.totalSize, ItemRenderer, noOptionsMessage]);
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
exports.MenuList = MenuList;
|
|
@@ -2,47 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
5
|
var dsSystem = require('@elliemae/ds-system');
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
11
|
-
|
|
12
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
13
|
-
const StyledListWrapper = dsSystem.styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n min-width: ", ";\n width: ", ";\n background-color: #ffffff;\n max-height: ", ";\n z-index: 100;\n"])), _ref => {
|
|
7
|
+
const StyledListWrapper = dsSystem.styled.div`
|
|
8
|
+
min-width: ${_ref => {
|
|
14
9
|
let {
|
|
15
10
|
inline,
|
|
16
11
|
minWidth
|
|
17
12
|
} = _ref;
|
|
18
|
-
return inline ? '100%' :
|
|
19
|
-
}
|
|
13
|
+
return inline ? '100%' : `${minWidth}px`;
|
|
14
|
+
}};
|
|
15
|
+
width: ${_ref2 => {
|
|
20
16
|
let {
|
|
21
17
|
width
|
|
22
18
|
} = _ref2;
|
|
23
|
-
return
|
|
24
|
-
}
|
|
19
|
+
return `${width}px`;
|
|
20
|
+
}};
|
|
21
|
+
background-color: #ffffff;
|
|
22
|
+
max-height: ${_ref3 => {
|
|
25
23
|
let {
|
|
26
24
|
maxHeight
|
|
27
25
|
} = _ref3;
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
return `${maxHeight}px`;
|
|
27
|
+
}};
|
|
28
|
+
z-index: 100;
|
|
29
|
+
`;
|
|
30
|
+
const StyledList = dsSystem.styled.ul`
|
|
31
|
+
position: relative;
|
|
32
|
+
padding: 0;
|
|
33
|
+
background-color: #ffffff;
|
|
34
|
+
overflow-x: hidden;
|
|
35
|
+
`;
|
|
36
|
+
const StyledVirtualListWrapper = dsSystem.styled.div`
|
|
37
|
+
overflow-y: auto;
|
|
38
|
+
margin-top: ${_ref4 => {
|
|
32
39
|
let {
|
|
33
40
|
withHeader
|
|
34
41
|
} = _ref4;
|
|
35
42
|
return withHeader ? '28px' : '';
|
|
36
|
-
}
|
|
43
|
+
}};
|
|
44
|
+
max-height: ${_ref5 => {
|
|
37
45
|
let {
|
|
38
46
|
maxHeight
|
|
39
47
|
} = _ref5;
|
|
40
|
-
return maxHeight ?
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const
|
|
48
|
+
return maxHeight ? `${maxHeight}px` : '300px';
|
|
49
|
+
}};
|
|
50
|
+
`;
|
|
51
|
+
const StyledCreatableLabel = dsSystem.styled.span`
|
|
52
|
+
font-weight: bold;
|
|
53
|
+
font-style: italic;
|
|
54
|
+
`;
|
|
55
|
+
const StyledCreatableValue = dsSystem.styled.span`
|
|
56
|
+
word-break: break-all;
|
|
57
|
+
`;
|
|
58
|
+
const StyledNoResultsWrapper = dsSystem.styled.div`
|
|
59
|
+
padding: 16px;
|
|
60
|
+
`;
|
|
44
61
|
|
|
45
62
|
exports.StyledCreatableLabel = StyledCreatableLabel;
|
|
63
|
+
exports.StyledCreatableValue = StyledCreatableValue;
|
|
46
64
|
exports.StyledList = StyledList;
|
|
47
65
|
exports.StyledListWrapper = StyledListWrapper;
|
|
48
66
|
exports.StyledNoResultsWrapper = StyledNoResultsWrapper;
|
|
@@ -41,7 +41,7 @@ const useItemRenderer = () => {
|
|
|
41
41
|
onFilter,
|
|
42
42
|
allOptions
|
|
43
43
|
},
|
|
44
|
-
|
|
44
|
+
setMenuState,
|
|
45
45
|
inputValue,
|
|
46
46
|
focusOptionIdx,
|
|
47
47
|
setInputValue,
|
|
@@ -49,20 +49,21 @@ const useItemRenderer = () => {
|
|
|
49
49
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
50
50
|
const multiple = Array.isArray(selectedValues);
|
|
51
51
|
const CBItem = multiple ? dsForm.MultiMenuItem : dsForm.SingleMenuItem;
|
|
52
|
+
const handleOnCreateClick = React.useCallback(() => {
|
|
53
|
+
if (inputValue && onCreate) {
|
|
54
|
+
onCreate(inputValue);
|
|
55
|
+
setInputValue('');
|
|
56
|
+
if (onFilter) onFilter(allOptions, inputValue);
|
|
57
|
+
}
|
|
58
|
+
}, [onFilter, onCreate, inputValue, allOptions, setInputValue]);
|
|
52
59
|
const handleClick = React.useCallback((option, e) => {
|
|
53
|
-
if (option.type === constants.
|
|
54
|
-
if (inputValue) {
|
|
55
|
-
onCreate(inputValue);
|
|
56
|
-
setInputValue('');
|
|
57
|
-
onFilter(allOptions, inputValue);
|
|
58
|
-
}
|
|
59
|
-
} else if (option.type === constants.MENU_OPTION_TYPES.OPTION) {
|
|
60
|
+
if (option.type === constants.MENU_OPTION_TYPES.OPTION) {
|
|
60
61
|
if (!option.disabled) {
|
|
61
62
|
if (onFilter) onFilter(allOptions, inputValue);
|
|
62
63
|
setInputValue('');
|
|
63
64
|
|
|
64
65
|
if (!multiple) {
|
|
65
|
-
|
|
66
|
+
setMenuState(false, 'selectOption', e);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
onChange(listHelper.getSuggestedValueOnChange(option, selectedValues), option, e);
|
|
@@ -72,7 +73,7 @@ const useItemRenderer = () => {
|
|
|
72
73
|
|
|
73
74
|
e.stopPropagation();
|
|
74
75
|
e.preventDefault();
|
|
75
|
-
}, [onFilter, selectedValues, onChange,
|
|
76
|
+
}, [onFilter, selectedValues, allOptions, onChange, setMenuState, multiple]); // prevent blur from controls input
|
|
76
77
|
|
|
77
78
|
const handleOnMouseDown = React.useCallback(e => {
|
|
78
79
|
e.preventDefault();
|
|
@@ -90,9 +91,9 @@ const useItemRenderer = () => {
|
|
|
90
91
|
top: 0,
|
|
91
92
|
left: 0,
|
|
92
93
|
width: '100%',
|
|
93
|
-
transform:
|
|
94
|
+
transform: `translateY(${vItem.start}px)`
|
|
94
95
|
},
|
|
95
|
-
key:
|
|
96
|
+
key: `${option.dsId}`,
|
|
96
97
|
innerRef: vItem.measureRef
|
|
97
98
|
};
|
|
98
99
|
|
|
@@ -115,8 +116,8 @@ const useItemRenderer = () => {
|
|
|
115
116
|
onClick: e => handleClick(option, e),
|
|
116
117
|
onMouseDown: handleOnMouseDown,
|
|
117
118
|
isActive: option.dsId === focusOptionIdx,
|
|
118
|
-
isSelected: listHelper.isSelected(selectedValues, option)
|
|
119
|
-
|
|
119
|
+
isSelected: listHelper.isSelected(selectedValues, option),
|
|
120
|
+
tabIndex: -1
|
|
120
121
|
}));
|
|
121
122
|
}
|
|
122
123
|
|
|
@@ -130,14 +131,14 @@ const useItemRenderer = () => {
|
|
|
130
131
|
label
|
|
131
132
|
} = _ref;
|
|
132
133
|
return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
134
|
+
p: "8px",
|
|
133
135
|
cols: ['min-content', 'auto'],
|
|
134
|
-
height: "16px",
|
|
135
136
|
gutter: "xxs",
|
|
136
137
|
alignItems: "center"
|
|
137
|
-
}, void 0, _StyledCreatableLabel || (_StyledCreatableLabel = /*#__PURE__*/_jsx__default["default"](styled.StyledCreatableLabel, {}, void 0, "Add:")), /*#__PURE__*/_jsx__default["default"](
|
|
138
|
+
}, void 0, _StyledCreatableLabel || (_StyledCreatableLabel = /*#__PURE__*/_jsx__default["default"](styled.StyledCreatableLabel, {}, void 0, "Add:")), /*#__PURE__*/_jsx__default["default"](styled.StyledCreatableValue, {}, void 0, `"${label}"`));
|
|
138
139
|
},
|
|
139
140
|
label: option.label,
|
|
140
|
-
onClick:
|
|
141
|
+
onClick: handleOnCreateClick
|
|
141
142
|
}));
|
|
142
143
|
}
|
|
143
144
|
|
|
@@ -39,7 +39,7 @@ const MultiSelectedValuesContainer = () => {
|
|
|
39
39
|
}, pill.dsId)), multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /*#__PURE__*/_jsx__default["default"](dsPills.DSPillV2, {
|
|
40
40
|
size: "s",
|
|
41
41
|
labelTruncated: false,
|
|
42
|
-
label:
|
|
42
|
+
label: `+${multiSelectedValue.length - correctPillsToShow}`,
|
|
43
43
|
type: "value",
|
|
44
44
|
disabled: disabled
|
|
45
45
|
}, "grouped"))), [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled]);
|
|
@@ -31,12 +31,10 @@ const RemovableSelectedValuePill = props => {
|
|
|
31
31
|
type: disabled ? 'value' : 'removable',
|
|
32
32
|
tabIndex: -1,
|
|
33
33
|
onRemove: e => {
|
|
34
|
-
var _innerRef$current;
|
|
35
|
-
|
|
36
34
|
// preventing the menu to be opened
|
|
37
35
|
e.stopPropagation();
|
|
38
36
|
onChange(listHelper.getSuggestedValueOnChange(pill, selectedValues), pill, e);
|
|
39
|
-
|
|
37
|
+
innerRef.current?.focus();
|
|
40
38
|
}
|
|
41
39
|
}, pill.value);
|
|
42
40
|
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
6
|
require('core-js/modules/esnext.iterator.map.js');
|
|
8
7
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
@@ -53,7 +52,7 @@ const useGroupPills = () => {
|
|
|
53
52
|
let currentWidth = 0;
|
|
54
53
|
const referenceWidth = selectedOptionsRef.current.offsetWidth;
|
|
55
54
|
const pills = [...pillGroupRef.current.querySelectorAll(disabled ? '.ds-pill-wrapper-value' : '.ds-pill-wrapper-removable')];
|
|
56
|
-
const pillsWidth = pills.map(pill => pill
|
|
55
|
+
const pillsWidth = pills.map(pill => pill?.offsetWidth);
|
|
57
56
|
pillsWidth.forEach((pillWidth, idx) => {
|
|
58
57
|
currentWidth += pillWidth;
|
|
59
58
|
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
5
|
var dsSystem = require('@elliemae/ds-system');
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const StyledA11ySelectedValues = dsSystem.styled.span`
|
|
8
|
+
width: 1px;
|
|
9
|
+
height: 1px;
|
|
10
|
+
position: absolute;
|
|
11
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
12
|
+
`;
|
|
14
13
|
|
|
15
14
|
exports.StyledA11ySelectedValues = StyledA11ySelectedValues;
|
|
@@ -26,12 +26,13 @@ const ComboboxPropTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalA
|
|
|
26
26
|
disabled: dsPropsHelpers.PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),
|
|
27
27
|
autoFocus: dsPropsHelpers.PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),
|
|
28
28
|
hasError: dsPropsHelpers.PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),
|
|
29
|
+
noOptionsMessage: dsPropsHelpers.PropTypes.string.description('Custome message to be display when no matches found after filtering').defaultValue('No Matches Found'),
|
|
30
|
+
closeMenuOnScroll: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.func, dsPropsHelpers.PropTypes.bool]).description('If true, close the select menu when the user scrolls the document/body.').defaultValue(false),
|
|
29
31
|
onChange: dsPropsHelpers.PropTypes.func.isRequired.description('function triggered when an option is selected it will send the options selected').defaultValue('() => {}'),
|
|
30
32
|
onFilter: dsPropsHelpers.PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),
|
|
31
33
|
onCreate: dsPropsHelpers.PropTypes.func.description('function triggered when user select "create" a new item whenever is not a match in the all option list').defaultValue(''),
|
|
32
34
|
onCancel: dsPropsHelpers.PropTypes.func.description('function triggered when user press ESC key').defaultValue('() => {}'),
|
|
33
|
-
|
|
34
|
-
onMenuClose: dsPropsHelpers.PropTypes.func.description('function triggered when user close the menu list').defaultValue('() => {}'),
|
|
35
|
+
onMenuChange: dsPropsHelpers.PropTypes.func.description('function triggered when user open or close the menu list').defaultValue('() => {}'),
|
|
35
36
|
inputMinWidth: dsPropsHelpers.PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),
|
|
36
37
|
menuMinWidth: dsPropsHelpers.PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),
|
|
37
38
|
menuMaxHeight: dsPropsHelpers.PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var constants = require('./constants.js');
|
|
6
6
|
|
|
7
|
-
const isSeparator = el =>
|
|
8
|
-
const isOption = el =>
|
|
7
|
+
const isSeparator = el => el?.type === constants.MENU_OPTION_TYPES.SEPARATOR;
|
|
8
|
+
const isOption = el => el?.type === constants.MENU_OPTION_TYPES.OPTION;
|
|
9
9
|
|
|
10
10
|
exports.isOption = isOption;
|
|
11
11
|
exports.isSeparator = isSeparator;
|