@elliemae/ds-controlled-form 2.4.2-rc.9 → 2.4.3-rc.1
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 +9 -4
- package/cjs/checkbox/config/useValidateProps.js +6 -3
- package/cjs/checkbox/react-desc-prop-types.js +2 -1
- package/cjs/checkbox/styles.js +93 -32
- 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 +10 -5
- package/esm/checkbox/config/useValidateProps.js +6 -3
- package/esm/checkbox/react-desc-prop-types.js +2 -1
- package/esm/checkbox/styles.js +93 -29
- 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 +2 -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
|
@@ -5,7 +5,7 @@ import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
|
5
5
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
6
6
|
import { useContext, useCallback } from 'react';
|
|
7
7
|
import { ComboBoxContext } from '../../ComboBoxCTX.js';
|
|
8
|
-
import { getOptions, getSuggestedValueOnChange, findInCircularList, getLastValueSelected } from '../../utils/listHelper.js';
|
|
8
|
+
import { getOptions, scrollIfNeeded, getSuggestedValueOnChange, findInCircularList, getLastValueSelected } from '../../utils/listHelper.js';
|
|
9
9
|
import { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants.js';
|
|
10
10
|
|
|
11
11
|
const isOptionFocuseable = opt => !['section', 'separator'].includes(opt.type) && !opt.disabled;
|
|
@@ -26,12 +26,12 @@ const useKeyboardNavigation = () => {
|
|
|
26
26
|
withoutPortal
|
|
27
27
|
},
|
|
28
28
|
inputValue,
|
|
29
|
-
|
|
29
|
+
menuState,
|
|
30
30
|
focusOptionIdx,
|
|
31
31
|
listRef,
|
|
32
32
|
selectAllCheckboxRef,
|
|
33
33
|
toggleSelectionButtonRef,
|
|
34
|
-
|
|
34
|
+
setMenuState,
|
|
35
35
|
setInputValue,
|
|
36
36
|
scrollOptionIntoView,
|
|
37
37
|
setFocusOptionIdx
|
|
@@ -44,17 +44,12 @@ const useKeyboardNavigation = () => {
|
|
|
44
44
|
// =============================================================================
|
|
45
45
|
// CUSTOM KEYS
|
|
46
46
|
// =============================================================================
|
|
47
|
-
if (onKeyDown &&
|
|
47
|
+
if (onKeyDown && currentItem?.type === MENU_OPTION_TYPES.OPTION) onKeyDown(e, currentItem);
|
|
48
48
|
|
|
49
|
-
if (['ArrowDown', 'ArrowUp', 'Enter', 'Spacebar'].includes(e.key) || e.keyCode >= 48 && e.keyCode <= 90) {
|
|
50
|
-
|
|
49
|
+
if ((['ArrowDown', 'ArrowUp', 'Enter', 'Spacebar'].includes(e.key) || e.keyCode >= 48 && e.keyCode <= 90) && !menuState) {
|
|
50
|
+
setMenuState(true);
|
|
51
51
|
window.requestAnimationFrame(() => {
|
|
52
|
-
if (listRef.current
|
|
53
|
-
window.scrollTo({
|
|
54
|
-
top: listRef.current.offsetHeight,
|
|
55
|
-
behavior: 'smooth'
|
|
56
|
-
});
|
|
57
|
-
}
|
|
52
|
+
if (listRef.current) scrollIfNeeded(listRef.current);
|
|
58
53
|
});
|
|
59
54
|
} // =============================================================================
|
|
60
55
|
// ESCAPE
|
|
@@ -69,13 +64,13 @@ const useKeyboardNavigation = () => {
|
|
|
69
64
|
setInputValue('');
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
if (!inline)
|
|
67
|
+
if (!inline) setMenuState(false, 'close', e);
|
|
73
68
|
} // =============================================================================
|
|
74
69
|
// ENTER KEY TO CREATE ELEMENTS
|
|
75
70
|
// =============================================================================
|
|
76
71
|
|
|
77
72
|
|
|
78
|
-
if (e.key === 'Enter' &&
|
|
73
|
+
if (e.key === 'Enter' && currentItem?.type === INTERNAL_MENU_OPTION_TYPES.CREATABLE && onCreate) {
|
|
79
74
|
onCreate(inputValue); // blank active item to force search last one
|
|
80
75
|
|
|
81
76
|
setFocusOptionIdx('');
|
|
@@ -91,12 +86,12 @@ const useKeyboardNavigation = () => {
|
|
|
91
86
|
e.preventDefault();
|
|
92
87
|
e.stopPropagation();
|
|
93
88
|
|
|
94
|
-
if (focusOptionIdx !== '' && (
|
|
89
|
+
if (focusOptionIdx !== '' && (menuState || inline) && currentItem?.type === MENU_OPTION_TYPES.OPTION && !currentItem.disabled) {
|
|
95
90
|
if (onFilter) onFilter(allOptions, '');
|
|
96
91
|
setInputValue('');
|
|
97
92
|
|
|
98
93
|
if (!multiple) {
|
|
99
|
-
|
|
94
|
+
setMenuState(false, 'selectOption', e);
|
|
100
95
|
}
|
|
101
96
|
|
|
102
97
|
onChange(getSuggestedValueOnChange(currentItem, selectedValues), currentItem, e);
|
|
@@ -104,7 +99,7 @@ const useKeyboardNavigation = () => {
|
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
if (e.key === 'Enter' && e.altKey) {
|
|
107
|
-
|
|
102
|
+
setMenuState(false, 'selectOption', e);
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
if (e.key === 'a' && e.ctrlKey && multiple && onSelectAll) {
|
|
@@ -118,7 +113,7 @@ const useKeyboardNavigation = () => {
|
|
|
118
113
|
e.preventDefault();
|
|
119
114
|
e.stopPropagation();
|
|
120
115
|
|
|
121
|
-
if ((
|
|
116
|
+
if ((menuState || inline) && selectableOptions.length) {
|
|
122
117
|
const nextItemIndexIndex = findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable);
|
|
123
118
|
|
|
124
119
|
if (nextItemIndexIndex > -1) {
|
|
@@ -135,12 +130,12 @@ const useKeyboardNavigation = () => {
|
|
|
135
130
|
const prevItemIndex = findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable, -1);
|
|
136
131
|
|
|
137
132
|
if (prevItemIndex > -1) {
|
|
138
|
-
if (
|
|
133
|
+
if (menuState || inline) {
|
|
139
134
|
setFocusOptionIdx(filteredOptions[prevItemIndex].dsId);
|
|
140
135
|
scrollOptionIntoView(filteredOptions[prevItemIndex].dsId);
|
|
141
136
|
} else {
|
|
142
137
|
// open menu and search last item to focused
|
|
143
|
-
|
|
138
|
+
setMenuState(true, 'open', e);
|
|
144
139
|
const lastItemIndex = findInCircularList(filteredOptions, 0, isOptionFocuseable, -1);
|
|
145
140
|
setFocusOptionIdx(filteredOptions[lastItemIndex].dsId);
|
|
146
141
|
setTimeout(() => {
|
|
@@ -163,22 +158,18 @@ const useKeyboardNavigation = () => {
|
|
|
163
158
|
if (onFilter) onFilter(allOptions, inputValue);
|
|
164
159
|
}
|
|
165
160
|
|
|
166
|
-
if (e.key === 'Tab' && !inline &&
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const element = (_selectAllCheckboxRef = selectAllCheckboxRef.current) !== null && _selectAllCheckboxRef !== void 0 ? _selectAllCheckboxRef : toggleSelectionButtonRef.current;
|
|
161
|
+
if (e.key === 'Tab' && !inline && menuState) {
|
|
162
|
+
const element = selectAllCheckboxRef.current ?? toggleSelectionButtonRef.current;
|
|
170
163
|
|
|
171
164
|
if (element) {
|
|
172
165
|
e.preventDefault();
|
|
173
166
|
element.focus();
|
|
167
|
+
} else {
|
|
168
|
+
setMenuState(false, 'blur', e);
|
|
174
169
|
}
|
|
175
170
|
}
|
|
176
|
-
|
|
177
|
-
if (e.key === 'Tab' && !multiple && showPopover) {
|
|
178
|
-
setShowPopover(false);
|
|
179
|
-
}
|
|
180
171
|
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
181
|
-
[onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal,
|
|
172
|
+
[onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal, setMenuState, onCancel, onFilter, setInputValue, listRef, focusOptionIdx, menuState, selectableOptions.length, filteredOptions, currentItemIndex, setFocusOptionIdx, selectedValues, onChange, selectAllCheckboxRef, toggleSelectionButtonRef]);
|
|
182
173
|
return {
|
|
183
174
|
onInputKeyDown
|
|
184
175
|
};
|
|
@@ -9,31 +9,31 @@ const useMaskedOnChange = () => {
|
|
|
9
9
|
onFilter,
|
|
10
10
|
allOptions
|
|
11
11
|
},
|
|
12
|
-
|
|
12
|
+
setMenuState,
|
|
13
13
|
setInputValue,
|
|
14
14
|
setShowSelectedOptions
|
|
15
15
|
} = useContext(ComboBoxContext); // default onchange when no mask provided
|
|
16
16
|
|
|
17
17
|
const handleOnChange = useCallback(e => {
|
|
18
18
|
setShowSelectedOptions(false);
|
|
19
|
-
|
|
19
|
+
setMenuState(true, 'filter', e);
|
|
20
20
|
|
|
21
21
|
if (onFilter) {
|
|
22
22
|
onFilter(filterOptions(e.currentTarget.value, allOptions), e.currentTarget.value);
|
|
23
23
|
setInputValue(e.currentTarget.value);
|
|
24
24
|
}
|
|
25
|
-
}, [allOptions, onFilter, setInputValue,
|
|
25
|
+
}, [allOptions, onFilter, setInputValue, setMenuState, setShowSelectedOptions]); // onchange used when mask is provided
|
|
26
26
|
|
|
27
|
-
const handleOnChangeMask = useCallback((
|
|
27
|
+
const handleOnChangeMask = useCallback((e, mask) => {
|
|
28
28
|
setShowSelectedOptions(false);
|
|
29
|
-
|
|
29
|
+
setMenuState(true, 'filter', e);
|
|
30
30
|
if (mask && onFilter) onFilter(filterOptions(mask, allOptions), mask);else if (!mask && onFilter) onFilter(allOptions, '');
|
|
31
|
-
}, [allOptions, onFilter,
|
|
31
|
+
}, [allOptions, onFilter, setMenuState, setShowSelectedOptions]);
|
|
32
32
|
const onChangeMask = useMask({
|
|
33
33
|
valueSetter: setInputValue,
|
|
34
34
|
onChange: handleOnChangeMask
|
|
35
35
|
});
|
|
36
|
-
return
|
|
36
|
+
return onChangeMask?.onChange || handleOnChange;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export { useMaskedOnChange };
|
|
@@ -12,14 +12,14 @@ const DropdownIndicator = () => {
|
|
|
12
12
|
props: {
|
|
13
13
|
disabled
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
menuState
|
|
16
16
|
} = useContext(ComboBoxContext);
|
|
17
17
|
return /*#__PURE__*/_jsx(StyledDropDownButton, {
|
|
18
18
|
"data-testid": ComboboxDataTestid.DROPDOWN,
|
|
19
19
|
"aria-controls": "combo-listbox",
|
|
20
20
|
"aria-labelledby": "combo-label",
|
|
21
21
|
disabled: disabled,
|
|
22
|
-
"aria-expanded":
|
|
22
|
+
"aria-expanded": menuState,
|
|
23
23
|
"aria-haspopup": "listbox",
|
|
24
24
|
"aria-hidden": true,
|
|
25
25
|
buttonType: "icon",
|
|
@@ -51,7 +51,7 @@ const HeaderList = () => {
|
|
|
51
51
|
size: BUTTON_SIZES.S,
|
|
52
52
|
"data-testid": ComboboxDataTestid.MULTISELECT.SHOW_SELECTED_OPTIONS_TOGGLE,
|
|
53
53
|
innerRef: toggleSelectionButtonRef
|
|
54
|
-
}, void 0, !showSelectedOptions ?
|
|
54
|
+
}, void 0, !showSelectedOptions ? `SHOW SELECTED [${multiSelectedValues.length}]` : 'SHOW ALL') : _StyledNoOptionsSelec || (_StyledNoOptionsSelec = /*#__PURE__*/_jsx(StyledNoOptionsSelected, {}, void 0, "0 SELECTED"))));
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
export { HeaderList };
|
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
1
|
import { styled } from '@elliemae/ds-system';
|
|
3
2
|
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
const StyledHeaderListWrapper = styled.div
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
/* eslint-disable max-len */
|
|
5
|
+
const StyledHeaderListWrapper = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
z-index: 10;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
padding: 0px 12px 0px 16px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 28px;
|
|
14
|
+
background-color: #fff;
|
|
15
|
+
box-shadow: 0 4px 2px -4px ${props => props.theme.colors.neutral[700]};
|
|
16
|
+
overflow-x: hidden;
|
|
17
|
+
|
|
18
|
+
& button {
|
|
19
|
+
font-size: 13px;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
const StyledButtonSelection = styled(DSButtonV2)`
|
|
23
|
+
border-radius: 0px;
|
|
24
|
+
padding: 0 ${props => props.theme.space.xxs};
|
|
25
|
+
margin: 0;
|
|
26
|
+
align-items: center;
|
|
27
|
+
transition: unset;
|
|
28
|
+
&:hover:not([disabled]) {
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
color: ${props => props.theme.colors.brand['700']};
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
const StyledSelectedItems = styled.div`
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
`;
|
|
37
|
+
const StyledNoOptionsSelected = styled.div`
|
|
38
|
+
padding: 0 ${props => props.theme.space.xxs};
|
|
39
|
+
`;
|
|
40
|
+
const StyledSelectAllCheckbox = styled.div`
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
`;
|
|
11
44
|
|
|
12
45
|
export { StyledButtonSelection, StyledHeaderListWrapper, StyledNoOptionsSelected, StyledSelectAllCheckbox, StyledSelectedItems };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
@@ -16,7 +15,7 @@ const useHeaderListHandlers = () => {
|
|
|
16
15
|
},
|
|
17
16
|
showSelectedOptions,
|
|
18
17
|
setShowSelectedOptions,
|
|
19
|
-
|
|
18
|
+
setMenuState
|
|
20
19
|
} = useContext(ComboBoxContext);
|
|
21
20
|
const multiSelectedValues = selectedValues;
|
|
22
21
|
const selectableOptions = getSelectableOptions(filteredOptions);
|
|
@@ -25,7 +24,7 @@ const useHeaderListHandlers = () => {
|
|
|
25
24
|
return true;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
if (
|
|
27
|
+
if (multiSelectedValues?.length === 0) {
|
|
29
28
|
return false;
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -55,27 +54,21 @@ const useHeaderListHandlers = () => {
|
|
|
55
54
|
|
|
56
55
|
const handleKeyDown = useCallback(e => {
|
|
57
56
|
if (e.key === 'Escape') {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
setShowPopover(false);
|
|
61
|
-
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
|
|
57
|
+
setMenuState(false, 'close', e);
|
|
58
|
+
innerRef.current?.focus();
|
|
62
59
|
}
|
|
63
|
-
}, [
|
|
60
|
+
}, [setMenuState, innerRef]); // when hitting tab on selected values button filter we target the input again
|
|
64
61
|
|
|
65
62
|
const handleFilterSelectionBtnOnTab = useCallback(e => {
|
|
66
63
|
if (e.key === 'Tab' && !e.shiftKey) {
|
|
67
|
-
var _innerRef$current2;
|
|
68
|
-
|
|
69
64
|
e.preventDefault();
|
|
70
|
-
|
|
65
|
+
innerRef.current?.focus();
|
|
71
66
|
}
|
|
72
67
|
}, [innerRef]);
|
|
73
68
|
const handleCheckAllOnTab = useCallback(e => {
|
|
74
69
|
if (e.key === 'Tab' && !e.shiftKey && multiSelectedValues.length === 0) {
|
|
75
|
-
var _innerRef$current3;
|
|
76
|
-
|
|
77
70
|
e.preventDefault();
|
|
78
|
-
|
|
71
|
+
innerRef.current?.focus();
|
|
79
72
|
}
|
|
80
73
|
}, [innerRef, multiSelectedValues]);
|
|
81
74
|
useEffect(() => {
|
|
@@ -8,11 +8,14 @@ import { HeaderList } from '../header-list/HeaderList.js';
|
|
|
8
8
|
import { useItemRenderer } from './useItemRenderer.js';
|
|
9
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
|
-
var _HeaderList
|
|
11
|
+
var _HeaderList;
|
|
12
12
|
const MenuList = () => {
|
|
13
|
+
var _StyledNoResultsWrapp;
|
|
14
|
+
|
|
13
15
|
const {
|
|
14
16
|
props: {
|
|
15
17
|
menuMinWidth,
|
|
18
|
+
noOptionsMessage,
|
|
16
19
|
menuMaxHeight,
|
|
17
20
|
onCreate,
|
|
18
21
|
inline,
|
|
@@ -53,15 +56,14 @@ const MenuList = () => {
|
|
|
53
56
|
role: "listbox",
|
|
54
57
|
"data-testid": ComboboxDataTestid.LIST,
|
|
55
58
|
style: {
|
|
56
|
-
height: virtualListHelpers
|
|
59
|
+
height: virtualListHelpers?.totalSize,
|
|
57
60
|
margin: inline ? '0px' : '8px 0px'
|
|
58
61
|
}
|
|
59
62
|
}, void 0, ItemRenderer)
|
|
60
63
|
}) : _StyledNoResultsWrapp || (_StyledNoResultsWrapp = /*#__PURE__*/_jsx(StyledNoResultsWrapper, {
|
|
61
|
-
role: "alert"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}, width), [wrapperListRef, inline, preventLoseInputFocus, menuMinWidth, withHeader, filteredOptions.length, onCreate, menuMaxHeight, listRef, virtualListHelpers === null || virtualListHelpers === void 0 ? void 0 : virtualListHelpers.totalSize, ItemRenderer, width]);
|
|
64
|
+
role: "alert"
|
|
65
|
+
}, void 0, noOptionsMessage))]
|
|
66
|
+
}, width), [wrapperListRef, inline, preventLoseInputFocus, width, menuMinWidth, withHeader, filteredOptions.length, onCreate, menuMaxHeight, listRef, virtualListHelpers?.totalSize, ItemRenderer, noOptionsMessage]);
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
export { MenuList };
|
|
@@ -1,37 +1,58 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
1
|
import { styled } from '@elliemae/ds-system';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const StyledListWrapper = styled.div`
|
|
4
|
+
min-width: ${_ref => {
|
|
6
5
|
let {
|
|
7
6
|
inline,
|
|
8
7
|
minWidth
|
|
9
8
|
} = _ref;
|
|
10
|
-
return inline ? '100%' :
|
|
11
|
-
}
|
|
9
|
+
return inline ? '100%' : `${minWidth}px`;
|
|
10
|
+
}};
|
|
11
|
+
width: ${_ref2 => {
|
|
12
12
|
let {
|
|
13
13
|
width
|
|
14
14
|
} = _ref2;
|
|
15
|
-
return
|
|
16
|
-
}
|
|
15
|
+
return `${width}px`;
|
|
16
|
+
}};
|
|
17
|
+
background-color: #ffffff;
|
|
18
|
+
max-height: ${_ref3 => {
|
|
17
19
|
let {
|
|
18
20
|
maxHeight
|
|
19
21
|
} = _ref3;
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
return `${maxHeight}px`;
|
|
23
|
+
}};
|
|
24
|
+
z-index: 100;
|
|
25
|
+
`;
|
|
26
|
+
const StyledList = styled.ul`
|
|
27
|
+
position: relative;
|
|
28
|
+
padding: 0;
|
|
29
|
+
background-color: #ffffff;
|
|
30
|
+
overflow-x: hidden;
|
|
31
|
+
`;
|
|
32
|
+
const StyledVirtualListWrapper = styled.div`
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
margin-top: ${_ref4 => {
|
|
24
35
|
let {
|
|
25
36
|
withHeader
|
|
26
37
|
} = _ref4;
|
|
27
38
|
return withHeader ? '28px' : '';
|
|
28
|
-
}
|
|
39
|
+
}};
|
|
40
|
+
max-height: ${_ref5 => {
|
|
29
41
|
let {
|
|
30
42
|
maxHeight
|
|
31
43
|
} = _ref5;
|
|
32
|
-
return maxHeight ?
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const
|
|
44
|
+
return maxHeight ? `${maxHeight}px` : '300px';
|
|
45
|
+
}};
|
|
46
|
+
`;
|
|
47
|
+
const StyledCreatableLabel = styled.span`
|
|
48
|
+
font-weight: bold;
|
|
49
|
+
font-style: italic;
|
|
50
|
+
`;
|
|
51
|
+
const StyledCreatableValue = styled.span`
|
|
52
|
+
word-break: break-all;
|
|
53
|
+
`;
|
|
54
|
+
const StyledNoResultsWrapper = styled.div`
|
|
55
|
+
padding: 16px;
|
|
56
|
+
`;
|
|
36
57
|
|
|
37
|
-
export { StyledCreatableLabel, StyledList, StyledListWrapper, StyledNoResultsWrapper, StyledVirtualListWrapper };
|
|
58
|
+
export { StyledCreatableLabel, StyledCreatableValue, StyledList, StyledListWrapper, StyledNoResultsWrapper, StyledVirtualListWrapper };
|
|
@@ -11,10 +11,10 @@ import { useContext, useCallback, useMemo } from 'react';
|
|
|
11
11
|
import { Grid } from '@elliemae/ds-grid';
|
|
12
12
|
import { Section, Separator, SingleMenuItem, MultiMenuItem } from '@elliemae/ds-form';
|
|
13
13
|
import { ComboBoxContext } from '../../ComboBoxCTX.js';
|
|
14
|
-
import { StyledCreatableLabel } from './styled.js';
|
|
14
|
+
import { StyledCreatableLabel, StyledCreatableValue } from './styled.js';
|
|
15
15
|
import { getSuggestedValueOnChange, isSelected } from '../../utils/listHelper.js';
|
|
16
16
|
import { ComboboxDataTestid } from '../../ComboboxDataTestids.js';
|
|
17
|
-
import {
|
|
17
|
+
import { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants.js';
|
|
18
18
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
19
19
|
|
|
20
20
|
var _StyledCreatableLabel;
|
|
@@ -32,7 +32,7 @@ const useItemRenderer = () => {
|
|
|
32
32
|
onFilter,
|
|
33
33
|
allOptions
|
|
34
34
|
},
|
|
35
|
-
|
|
35
|
+
setMenuState,
|
|
36
36
|
inputValue,
|
|
37
37
|
focusOptionIdx,
|
|
38
38
|
setInputValue,
|
|
@@ -40,20 +40,21 @@ const useItemRenderer = () => {
|
|
|
40
40
|
} = useContext(ComboBoxContext);
|
|
41
41
|
const multiple = Array.isArray(selectedValues);
|
|
42
42
|
const CBItem = multiple ? MultiMenuItem : SingleMenuItem;
|
|
43
|
+
const handleOnCreateClick = useCallback(() => {
|
|
44
|
+
if (inputValue && onCreate) {
|
|
45
|
+
onCreate(inputValue);
|
|
46
|
+
setInputValue('');
|
|
47
|
+
if (onFilter) onFilter(allOptions, inputValue);
|
|
48
|
+
}
|
|
49
|
+
}, [onFilter, onCreate, inputValue, allOptions, setInputValue]);
|
|
43
50
|
const handleClick = useCallback((option, e) => {
|
|
44
|
-
if (option.type ===
|
|
45
|
-
if (inputValue) {
|
|
46
|
-
onCreate(inputValue);
|
|
47
|
-
setInputValue('');
|
|
48
|
-
onFilter(allOptions, inputValue);
|
|
49
|
-
}
|
|
50
|
-
} else if (option.type === MENU_OPTION_TYPES.OPTION) {
|
|
51
|
+
if (option.type === MENU_OPTION_TYPES.OPTION) {
|
|
51
52
|
if (!option.disabled) {
|
|
52
53
|
if (onFilter) onFilter(allOptions, inputValue);
|
|
53
54
|
setInputValue('');
|
|
54
55
|
|
|
55
56
|
if (!multiple) {
|
|
56
|
-
|
|
57
|
+
setMenuState(false, 'selectOption', e);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
onChange(getSuggestedValueOnChange(option, selectedValues), option, e);
|
|
@@ -63,7 +64,7 @@ const useItemRenderer = () => {
|
|
|
63
64
|
|
|
64
65
|
e.stopPropagation();
|
|
65
66
|
e.preventDefault();
|
|
66
|
-
}, [onFilter, selectedValues, onChange,
|
|
67
|
+
}, [onFilter, selectedValues, allOptions, onChange, setMenuState, multiple]); // prevent blur from controls input
|
|
67
68
|
|
|
68
69
|
const handleOnMouseDown = useCallback(e => {
|
|
69
70
|
e.preventDefault();
|
|
@@ -81,9 +82,9 @@ const useItemRenderer = () => {
|
|
|
81
82
|
top: 0,
|
|
82
83
|
left: 0,
|
|
83
84
|
width: '100%',
|
|
84
|
-
transform:
|
|
85
|
+
transform: `translateY(${vItem.start}px)`
|
|
85
86
|
},
|
|
86
|
-
key:
|
|
87
|
+
key: `${option.dsId}`,
|
|
87
88
|
innerRef: vItem.measureRef
|
|
88
89
|
};
|
|
89
90
|
|
|
@@ -106,8 +107,8 @@ const useItemRenderer = () => {
|
|
|
106
107
|
onClick: e => handleClick(option, e),
|
|
107
108
|
onMouseDown: handleOnMouseDown,
|
|
108
109
|
isActive: option.dsId === focusOptionIdx,
|
|
109
|
-
isSelected: isSelected(selectedValues, option)
|
|
110
|
-
|
|
110
|
+
isSelected: isSelected(selectedValues, option),
|
|
111
|
+
tabIndex: -1
|
|
111
112
|
}));
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -121,14 +122,14 @@ const useItemRenderer = () => {
|
|
|
121
122
|
label
|
|
122
123
|
} = _ref;
|
|
123
124
|
return /*#__PURE__*/_jsx(Grid, {
|
|
125
|
+
p: "8px",
|
|
124
126
|
cols: ['min-content', 'auto'],
|
|
125
|
-
height: "16px",
|
|
126
127
|
gutter: "xxs",
|
|
127
128
|
alignItems: "center"
|
|
128
|
-
}, void 0, _StyledCreatableLabel || (_StyledCreatableLabel = /*#__PURE__*/_jsx(StyledCreatableLabel, {}, void 0, "Add:")), /*#__PURE__*/_jsx(
|
|
129
|
+
}, void 0, _StyledCreatableLabel || (_StyledCreatableLabel = /*#__PURE__*/_jsx(StyledCreatableLabel, {}, void 0, "Add:")), /*#__PURE__*/_jsx(StyledCreatableValue, {}, void 0, `"${label}"`));
|
|
129
130
|
},
|
|
130
131
|
label: option.label,
|
|
131
|
-
onClick:
|
|
132
|
+
onClick: handleOnCreateClick
|
|
132
133
|
}));
|
|
133
134
|
}
|
|
134
135
|
|
|
@@ -31,7 +31,7 @@ const MultiSelectedValuesContainer = () => {
|
|
|
31
31
|
}, pill.dsId)), multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /*#__PURE__*/_jsx(DSPillV2, {
|
|
32
32
|
size: "s",
|
|
33
33
|
labelTruncated: false,
|
|
34
|
-
label:
|
|
34
|
+
label: `+${multiSelectedValue.length - correctPillsToShow}`,
|
|
35
35
|
type: "value",
|
|
36
36
|
disabled: disabled
|
|
37
37
|
}, "grouped"))), [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled]);
|
|
@@ -23,12 +23,10 @@ const RemovableSelectedValuePill = props => {
|
|
|
23
23
|
type: disabled ? 'value' : 'removable',
|
|
24
24
|
tabIndex: -1,
|
|
25
25
|
onRemove: e => {
|
|
26
|
-
var _innerRef$current;
|
|
27
|
-
|
|
28
26
|
// preventing the menu to be opened
|
|
29
27
|
e.stopPropagation();
|
|
30
28
|
onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);
|
|
31
|
-
|
|
29
|
+
innerRef.current?.focus();
|
|
32
30
|
}
|
|
33
31
|
}, pill.value);
|
|
34
32
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
2
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
3
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
@@ -49,7 +48,7 @@ const useGroupPills = () => {
|
|
|
49
48
|
let currentWidth = 0;
|
|
50
49
|
const referenceWidth = selectedOptionsRef.current.offsetWidth;
|
|
51
50
|
const pills = [...pillGroupRef.current.querySelectorAll(disabled ? '.ds-pill-wrapper-value' : '.ds-pill-wrapper-removable')];
|
|
52
|
-
const pillsWidth = pills.map(pill => pill
|
|
51
|
+
const pillsWidth = pills.map(pill => pill?.offsetWidth);
|
|
53
52
|
pillsWidth.forEach((pillWidth, idx) => {
|
|
54
53
|
currentWidth += pillWidth;
|
|
55
54
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
1
|
import { styled } from '@elliemae/ds-system';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const StyledA11ySelectedValues = styled.span`
|
|
4
|
+
width: 1px;
|
|
5
|
+
height: 1px;
|
|
6
|
+
position: absolute;
|
|
7
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
8
|
+
`;
|
|
6
9
|
|
|
7
10
|
export { StyledA11ySelectedValues };
|
|
@@ -18,12 +18,13 @@ const ComboboxPropTypes = _objectSpread(_objectSpread({}, globalAttributesPropTy
|
|
|
18
18
|
disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),
|
|
19
19
|
autoFocus: PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),
|
|
20
20
|
hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),
|
|
21
|
+
noOptionsMessage: PropTypes.string.description('Custome message to be display when no matches found after filtering').defaultValue('No Matches Found'),
|
|
22
|
+
closeMenuOnScroll: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]).description('If true, close the select menu when the user scrolls the document/body.').defaultValue(false),
|
|
21
23
|
onChange: PropTypes.func.isRequired.description('function triggered when an option is selected it will send the options selected').defaultValue('() => {}'),
|
|
22
24
|
onFilter: PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),
|
|
23
25
|
onCreate: PropTypes.func.description('function triggered when user select "create" a new item whenever is not a match in the all option list').defaultValue(''),
|
|
24
26
|
onCancel: PropTypes.func.description('function triggered when user press ESC key').defaultValue('() => {}'),
|
|
25
|
-
|
|
26
|
-
onMenuClose: PropTypes.func.description('function triggered when user close the menu list').defaultValue('() => {}'),
|
|
27
|
+
onMenuChange: PropTypes.func.description('function triggered when user open or close the menu list').defaultValue('() => {}'),
|
|
27
28
|
inputMinWidth: PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),
|
|
28
29
|
menuMinWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),
|
|
29
30
|
menuMaxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MENU_OPTION_TYPES } from './constants.js';
|
|
2
2
|
|
|
3
|
-
const isSeparator = el =>
|
|
4
|
-
const isOption = el =>
|
|
3
|
+
const isSeparator = el => el?.type === MENU_OPTION_TYPES.SEPARATOR;
|
|
4
|
+
const isOption = el => el?.type === MENU_OPTION_TYPES.OPTION;
|
|
5
5
|
|
|
6
6
|
export { isOption, isSeparator };
|