@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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
12
|
+
var AutocompleteCTX = require('../AutocompleteCTX.js');
|
|
13
|
+
var listHelper = require('../utils/listHelper.js');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
19
|
+
|
|
20
|
+
var _templateObject;
|
|
21
|
+
const isSeparator = el => (el === null || el === void 0 ? void 0 : el.type) === 'separator';
|
|
22
|
+
const StyledA11ySelectedValues = dsSystem.styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n width: 1px;\n height: 1px;\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n"])));
|
|
23
|
+
const A11yFocusedOption = () => {
|
|
24
|
+
const {
|
|
25
|
+
props: {
|
|
26
|
+
options
|
|
27
|
+
},
|
|
28
|
+
focusOptionIdx,
|
|
29
|
+
showPopover
|
|
30
|
+
} = React.useContext(AutocompleteCTX.AutocompleteContext);
|
|
31
|
+
return React.useMemo(() => {
|
|
32
|
+
const selectabledOptions = listHelper.getSelectableOptions(options);
|
|
33
|
+
const focusOption = options.find(option => !isSeparator(option) && option.dsId === focusOptionIdx);
|
|
34
|
+
const focusSelectableOptionIdx = selectabledOptions.findIndex(option => option.dsId === focusOptionIdx);
|
|
35
|
+
return /*#__PURE__*/_jsx__default["default"](StyledA11ySelectedValues, {
|
|
36
|
+
"aria-live": "polite"
|
|
37
|
+
}, void 0, !isSeparator(focusOption) && showPopover && focusOption && "option ".concat(focusOption.label, " focused.").concat(focusSelectableOptionIdx + 1, " of ").concat(selectabledOptions.length, "\n "));
|
|
38
|
+
}, [options, showPopover, focusOptionIdx]);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.A11yFocusedOption = A11yFocusedOption;
|
|
42
|
+
exports.StyledA11ySelectedValues = StyledA11ySelectedValues;
|
|
43
|
+
exports.isSeparator = isSeparator;
|
|
@@ -13,6 +13,7 @@ var styled = require('./styled.js');
|
|
|
13
13
|
var MenuList = require('../menu-list/MenuList.js');
|
|
14
14
|
var useKeyboardNavigation = require('./useKeyboardNavigation.js');
|
|
15
15
|
var AutocompleteDataTestids = require('../../AutocompleteDataTestids.js');
|
|
16
|
+
var A11yFocusedOption = require('../A11yFocusedOption.js');
|
|
16
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
17
18
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -20,10 +21,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
21
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
23
|
|
|
23
|
-
var _StyledPopperWrapper;
|
|
24
|
+
var _A11yFocusedOption, _StyledPopperWrapper;
|
|
24
25
|
const Container = () => {
|
|
25
26
|
const {
|
|
26
27
|
props: {
|
|
28
|
+
id,
|
|
27
29
|
startPlacementPreference,
|
|
28
30
|
children,
|
|
29
31
|
filter,
|
|
@@ -32,6 +34,7 @@ const Container = () => {
|
|
|
32
34
|
showPopover,
|
|
33
35
|
setReferenceElement,
|
|
34
36
|
setShowPopover,
|
|
37
|
+
focusOptionIdx,
|
|
35
38
|
referenceElement
|
|
36
39
|
} = React.useContext(AutocompleteCTX.AutocompleteContext);
|
|
37
40
|
React.useEffect(() => {
|
|
@@ -47,32 +50,41 @@ const Container = () => {
|
|
|
47
50
|
const handleCloseMenu = React.useCallback(() => {
|
|
48
51
|
setShowPopover(false);
|
|
49
52
|
}, [setShowPopover]);
|
|
50
|
-
const input = React__default["default"].Children.only(children);
|
|
51
53
|
const {
|
|
52
54
|
onInputKeyDown
|
|
53
55
|
} = useKeyboardNavigation.useKeyboardNavigation();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
const input = React__default["default"].Children.only(children);
|
|
57
|
+
const childrenWithProps = /*#__PURE__*/React__default["default"].isValidElement(input) ? /*#__PURE__*/React__default["default"].cloneElement(input, {
|
|
58
|
+
'aria-activedescendant': focusOptionIdx
|
|
59
|
+
}) : input;
|
|
60
|
+
const idList = React.useMemo(() => "".concat(id ? "".concat(id, "-") : '', "listbox"), [id]);
|
|
61
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
62
|
+
children: [_A11yFocusedOption || (_A11yFocusedOption = /*#__PURE__*/_jsx__default["default"](A11yFocusedOption.A11yFocusedOption, {})), /*#__PURE__*/jsxRuntime.jsxs(styled.StyledContainer, {
|
|
63
|
+
id: id,
|
|
64
|
+
ref: setReferenceElement,
|
|
65
|
+
role: "combobox",
|
|
66
|
+
"aria-autocomplete": "list",
|
|
67
|
+
"aria-controls": "autocomplete-listbox",
|
|
68
|
+
"aria-expanded": showPopover,
|
|
69
|
+
"aria-haspopup": "listbox",
|
|
70
|
+
"aria-owns": idList,
|
|
71
|
+
onKeyDown: onInputKeyDown,
|
|
72
|
+
"data-testid": AutocompleteDataTestids.AutocompleteDataTestid.CONTAINER,
|
|
73
|
+
children: [childrenWithProps, filter && /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
74
|
+
customOffset: [0, 5],
|
|
75
|
+
closeContextMenu: handleCloseMenu,
|
|
76
|
+
referenceElement: referenceElement,
|
|
77
|
+
showPopover: showPopover,
|
|
78
|
+
startPlacementPreference: startPlacementPreference,
|
|
79
|
+
placementOrderPreference: placementOrderPreference,
|
|
80
|
+
withoutPortal: true,
|
|
81
|
+
withoutArrow: true,
|
|
82
|
+
withoutAnimation: true,
|
|
83
|
+
zIndex: 10
|
|
84
|
+
}, void 0, _StyledPopperWrapper || (_StyledPopperWrapper = /*#__PURE__*/_jsx__default["default"](styled.StyledPopperWrapper, {
|
|
85
|
+
tabIndex: -1
|
|
86
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](MenuList.MenuList, {}))))]
|
|
87
|
+
})]
|
|
76
88
|
});
|
|
77
89
|
};
|
|
78
90
|
|
|
@@ -8,12 +8,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const StyledContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
12
12
|
componentId: "sc-xupfk9-0"
|
|
13
13
|
})(["width:100%;height:28px;position:relative;"]);
|
|
14
14
|
const StyledPopperWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
15
15
|
componentId: "sc-xupfk9-1"
|
|
16
16
|
})(["background:#fff;overflow:auto;position:relative;"]);
|
|
17
17
|
|
|
18
|
-
exports.
|
|
18
|
+
exports.StyledContainer = StyledContainer;
|
|
19
19
|
exports.StyledPopperWrapper = StyledPopperWrapper;
|
|
@@ -17,7 +17,8 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
17
17
|
const MenuList = () => {
|
|
18
18
|
const {
|
|
19
19
|
props: {
|
|
20
|
-
options
|
|
20
|
+
options,
|
|
21
|
+
id
|
|
21
22
|
},
|
|
22
23
|
referenceElement,
|
|
23
24
|
inputRef,
|
|
@@ -33,11 +34,12 @@ const MenuList = () => {
|
|
|
33
34
|
|
|
34
35
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
35
36
|
}, [inputRef]);
|
|
37
|
+
const idList = React.useMemo(() => "".concat(id ? "".concat(id, "-") : '', "listbox"), [id]);
|
|
36
38
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledListWrapper, {
|
|
37
39
|
tabIndex: -1,
|
|
38
40
|
onMouseDown: e => e.preventDefault(),
|
|
39
41
|
minWidth: referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth,
|
|
40
|
-
id:
|
|
42
|
+
id: idList,
|
|
41
43
|
role: "listbox"
|
|
42
44
|
}, void 0, options.length > 0 && /*#__PURE__*/jsxRuntime.jsx(styled.StyledVirtualListWrapper, {
|
|
43
45
|
tabIndex: -1,
|
|
@@ -13,7 +13,7 @@ const isSelectedValueMultiple = value => Array.isArray(value);
|
|
|
13
13
|
const findInCircularList = function (list, from, criteria) {
|
|
14
14
|
let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
15
15
|
|
|
16
|
-
for (let i = (from + step + list.length) % list.length; i !== from; i = (i + step + list.length) % list.length) {
|
|
16
|
+
for (let i = (from + step + list.length) % list.length; i !== from && from > -1; i = (i + step + list.length) % list.length) {
|
|
17
17
|
if (criteria(list[i])) return i;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -108,7 +108,7 @@ const DSControlledCheckbox = props => {
|
|
|
108
108
|
checked: checked,
|
|
109
109
|
"data-testid": "ds-checkbox-label",
|
|
110
110
|
wrapLabel: wrapLabel
|
|
111
|
-
}, void 0, wrapLabel ? label : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
111
|
+
}, void 0, wrapLabel ? /*#__PURE__*/_jsx__default["default"](styles.StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
112
112
|
value: label
|
|
113
113
|
}))]
|
|
114
114
|
}));
|
|
@@ -26,7 +26,8 @@ const defaultProps = {
|
|
|
26
26
|
const propTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
|
|
27
27
|
label: dsPropsHelpers.PropTypes.string.description('Checkbox Label property. This label is also going to be used as an aria-label for screen readers.'),
|
|
28
28
|
hasError: dsPropsHelpers.PropTypes.bool.description('Whether the checkbox has error or not.'),
|
|
29
|
-
innerRef: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.func, dsPropsHelpers.PropTypes.object]).description('Checkbox input ref.')
|
|
29
|
+
innerRef: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.func, dsPropsHelpers.PropTypes.object]).description('Checkbox input ref.'),
|
|
30
|
+
wrapLabel: dsPropsHelpers.PropTypes.bool.description('Whether to wrap or truncate the label')
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
exports.defaultProps = defaultProps;
|
package/cjs/checkbox/styles.js
CHANGED
|
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
13
13
|
|
|
14
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
15
15
|
const StyledContainer = dsSystem.styled('div', {
|
|
16
16
|
name: theming.DSCheckboxName,
|
|
17
17
|
slot: theming.DSCheckboxSlots.CONTAINER
|
|
@@ -101,7 +101,7 @@ const StyledLabel = dsSystem.styled('label', {
|
|
|
101
101
|
wrapLabel,
|
|
102
102
|
theme
|
|
103
103
|
} = _ref11;
|
|
104
|
-
return wrapLabel ? 'padding: 8px' : "padding-left: ".concat(theme.space.xxs);
|
|
104
|
+
return wrapLabel ? 'padding: 8px 0px 8px 8px;' : "padding-left: ".concat(theme.space.xxs);
|
|
105
105
|
}, _ref12 => {
|
|
106
106
|
let {
|
|
107
107
|
theme,
|
|
@@ -111,9 +111,11 @@ const StyledLabel = dsSystem.styled('label', {
|
|
|
111
111
|
} = _ref12;
|
|
112
112
|
return disabled && checked !== true || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
|
|
113
113
|
});
|
|
114
|
+
const StyledWrapLabel = dsSystem.styled('span')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral__default["default"]([""])));
|
|
114
115
|
|
|
115
116
|
exports.StyledCheckBox = StyledCheckBox;
|
|
116
117
|
exports.StyledContainer = StyledContainer;
|
|
117
118
|
exports.StyledInput = StyledInput;
|
|
118
119
|
exports.StyledInputMixed = StyledInputMixed;
|
|
119
120
|
exports.StyledLabel = StyledLabel;
|
|
121
|
+
exports.StyledWrapLabel = StyledWrapLabel;
|
|
@@ -16,12 +16,14 @@ const defaultProps = {
|
|
|
16
16
|
useMask: noop,
|
|
17
17
|
innerRef: /*#__PURE__*/React.createRef(),
|
|
18
18
|
startPlacementPreference: 'bottom-start',
|
|
19
|
-
placementOrderPreference: ['bottom-start', 'bottom-end']
|
|
19
|
+
placementOrderPreference: ['bottom-start', 'bottom-end'],
|
|
20
|
+
noOptionsMessage: 'No Matches Found',
|
|
21
|
+
filteredOptions: [] // override in useCombobox to avoid ref duplications when more than one cb is used
|
|
20
22
|
|
|
21
23
|
};
|
|
22
24
|
const defaultContext = {
|
|
23
25
|
props: defaultProps,
|
|
24
|
-
|
|
26
|
+
menuState: false,
|
|
25
27
|
hasFocus: false,
|
|
26
28
|
referenceElement: null,
|
|
27
29
|
inputValue: '',
|
|
@@ -40,7 +42,8 @@ const defaultContext = {
|
|
|
40
42
|
setInputValue: noop,
|
|
41
43
|
setReferenceElement: noop,
|
|
42
44
|
setFocusOptionIdx: noop,
|
|
43
|
-
setShowSelectedOptions: noop
|
|
45
|
+
setShowSelectedOptions: noop,
|
|
46
|
+
setMenuState: noop
|
|
44
47
|
};
|
|
45
48
|
/** Context for cross component communication */
|
|
46
49
|
|
|
@@ -44,8 +44,18 @@ const useComboBox = props => {
|
|
|
44
44
|
const toggleSelectionButtonRef = React.useRef(null);
|
|
45
45
|
const pillGroupRef = React.useRef(null);
|
|
46
46
|
const {
|
|
47
|
-
selectedValues
|
|
48
|
-
|
|
47
|
+
selectedValues,
|
|
48
|
+
isMenuOpen,
|
|
49
|
+
onMenuChange
|
|
50
|
+
} = propsWithDefaults;
|
|
51
|
+
const menuState = React.useMemo(() => {
|
|
52
|
+
if (isMenuOpen !== undefined) return isMenuOpen;
|
|
53
|
+
return showPopover;
|
|
54
|
+
}, [showPopover, isMenuOpen]);
|
|
55
|
+
const setMenuState = React.useCallback((newState, reason, e) => {
|
|
56
|
+
if (onMenuChange !== undefined) onMenuChange(newState, reason, e);
|
|
57
|
+
setShowPopover(newState);
|
|
58
|
+
}, [onMenuChange]); // ---------------------------------------------------------------------------
|
|
49
59
|
// Options with creatable option + filtered by selected
|
|
50
60
|
// ---------------------------------------------------------------------------
|
|
51
61
|
|
|
@@ -99,7 +109,7 @@ const useComboBox = props => {
|
|
|
99
109
|
filteredOptions: correctOptions
|
|
100
110
|
}),
|
|
101
111
|
virtualListHelpers,
|
|
102
|
-
|
|
112
|
+
menuState,
|
|
103
113
|
referenceElement,
|
|
104
114
|
listRef,
|
|
105
115
|
focusOptionIdx,
|
|
@@ -108,6 +118,7 @@ const useComboBox = props => {
|
|
|
108
118
|
selectAllCheckboxRef,
|
|
109
119
|
inputValue,
|
|
110
120
|
setInputValue,
|
|
121
|
+
setMenuState,
|
|
111
122
|
hasFocus,
|
|
112
123
|
toggleSelectionButtonRef,
|
|
113
124
|
pillGroupRef,
|
|
@@ -119,7 +130,7 @@ const useComboBox = props => {
|
|
|
119
130
|
scrollOptionIntoView,
|
|
120
131
|
setReferenceElement,
|
|
121
132
|
setShowPopover
|
|
122
|
-
}), [scrollOptionIntoView, correctOptions, hasFocus, propsWithDefaults, virtualListHelpers, inputValue, focusOptionIdx, wrapperListRef, showSelectedOptions,
|
|
133
|
+
}), [scrollOptionIntoView, setMenuState, correctOptions, hasFocus, propsWithDefaults, virtualListHelpers, inputValue, focusOptionIdx, wrapperListRef, showSelectedOptions, menuState, pillGroupRef, referenceElement, selectedOptionsRef, controlsWrapperRef, selectAllCheckboxRef, toggleSelectionButtonRef, listRef]);
|
|
123
134
|
return ctx;
|
|
124
135
|
};
|
|
125
136
|
|
|
@@ -19,22 +19,30 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
19
19
|
const A11yFocusedOption = () => {
|
|
20
20
|
const {
|
|
21
21
|
props: {
|
|
22
|
-
filteredOptions
|
|
22
|
+
filteredOptions,
|
|
23
|
+
selectedValues
|
|
23
24
|
},
|
|
24
25
|
focusOptionIdx,
|
|
25
|
-
|
|
26
|
+
menuState
|
|
26
27
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
27
28
|
const selectabledOptions = listHelper.getSelectableOptions(filteredOptions);
|
|
28
|
-
const focusOption = filteredOptions.find(option =>
|
|
29
|
+
const focusOption = filteredOptions.find(option => option.dsId === focusOptionIdx);
|
|
30
|
+
const isFocusOptionSelected = (focusOption === null || focusOption === void 0 ? void 0 : focusOption.type) === 'option' && listHelper.isSelected(selectedValues, focusOption);
|
|
29
31
|
const focusSelectableOptionIdx = selectabledOptions.findIndex(option => option.dsId === focusOptionIdx);
|
|
32
|
+
const navigationContext = 'Use up and down to choose options,press enter to choose focused option, press Escape to excuse dropdown menu';
|
|
30
33
|
return React.useMemo(() => {
|
|
31
|
-
if (!sharedTypes.isSeparator(focusOption) &&
|
|
34
|
+
if (!sharedTypes.isSeparator(focusOption) && menuState && focusOption && focusOption.type === 'option') return /*#__PURE__*/_jsx__default["default"](styled.StyledA11ySelectedValues, {
|
|
32
35
|
"aria-live": "polite",
|
|
33
36
|
"aria-atomic": "false",
|
|
34
37
|
"aria-relevant": "additions text"
|
|
35
|
-
},
|
|
38
|
+
}, menuState, "option ".concat(focusOption === null || focusOption === void 0 ? void 0 : focusOption.label, " ").concat(isFocusOptionSelected ? 'selected and ' : '', "focused .").concat(focusSelectableOptionIdx + 1, " of ").concat(selectabledOptions.length, ". ").concat(navigationContext, " "));
|
|
39
|
+
if ((focusOption === null || focusOption === void 0 ? void 0 : focusOption.type) === 'creatable') return /*#__PURE__*/_jsx__default["default"](styled.StyledA11ySelectedValues, {
|
|
40
|
+
"aria-live": "assertive",
|
|
41
|
+
"aria-atomic": "false",
|
|
42
|
+
"aria-relevant": "additions text"
|
|
43
|
+
}, menuState, "Press enter to Add: ".concat(focusOption === null || focusOption === void 0 ? void 0 : focusOption.label, ". ").concat(navigationContext));
|
|
36
44
|
return null;
|
|
37
|
-
}, [
|
|
45
|
+
}, [focusOption, menuState, isFocusOptionSelected, focusSelectableOptionIdx, selectabledOptions.length]);
|
|
38
46
|
};
|
|
39
47
|
|
|
40
48
|
exports.A11yFocusedOption = A11yFocusedOption;
|
|
@@ -27,8 +27,6 @@ const A11ySelectedValues = () => {
|
|
|
27
27
|
if (selectedValues.length > 0) {
|
|
28
28
|
msg = "Options selected: ".concat(selectedValues.map(item => item.label).join(', '));
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
msg = 'No Options Selected';
|
|
32
30
|
} else if (selectedValues) {
|
|
33
31
|
msg = "Option selected: ".concat(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.label);
|
|
34
32
|
}
|
|
@@ -29,7 +29,7 @@ const DropdownIndicator = () => {
|
|
|
29
29
|
props: {
|
|
30
30
|
disabled
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
menuState
|
|
33
33
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
34
34
|
const colorButton = React.useMemo(() => disabled ? ['neutral', 400] : ['brand-primary', 700], [disabled]);
|
|
35
35
|
const handleOnClick = React.useCallback(e => {
|
|
@@ -41,7 +41,7 @@ const DropdownIndicator = () => {
|
|
|
41
41
|
"aria-controls": "combo-listbox",
|
|
42
42
|
"aria-labelledby": "combo-label",
|
|
43
43
|
disabled: disabled,
|
|
44
|
-
"aria-expanded":
|
|
44
|
+
"aria-expanded": menuState,
|
|
45
45
|
"aria-haspopup": "listbox",
|
|
46
46
|
"aria-hidden": true,
|
|
47
47
|
buttonType: "icon",
|
|
@@ -38,15 +38,13 @@ const Container = () => {
|
|
|
38
38
|
|
|
39
39
|
const {
|
|
40
40
|
props,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
setMenuState,
|
|
42
|
+
menuState,
|
|
43
43
|
setReferenceElement,
|
|
44
44
|
referenceElement
|
|
45
45
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
46
46
|
const {
|
|
47
47
|
inline,
|
|
48
|
-
onMenuOpen,
|
|
49
|
-
onMenuClose,
|
|
50
48
|
innerRef,
|
|
51
49
|
startPlacementPreference,
|
|
52
50
|
placementOrderPreference,
|
|
@@ -62,20 +60,19 @@ const Container = () => {
|
|
|
62
60
|
e.preventDefault();
|
|
63
61
|
}, []);
|
|
64
62
|
const handleCloseMenu = React.useCallback(() => {
|
|
65
|
-
|
|
63
|
+
setMenuState(false, 'blur');
|
|
66
64
|
if (innerRef !== null && innerRef !== void 0 && innerRef.current) innerRef.current.blur();
|
|
67
|
-
}, [innerRef,
|
|
65
|
+
}, [innerRef, setMenuState]);
|
|
68
66
|
React.useEffect(() => {
|
|
69
|
-
const closeMenuOnWindowBlur = () =>
|
|
67
|
+
const closeMenuOnWindowBlur = () => {
|
|
68
|
+
setMenuState(false, 'blur');
|
|
69
|
+
};
|
|
70
70
|
|
|
71
71
|
window.addEventListener('blur', closeMenuOnWindowBlur);
|
|
72
72
|
return () => {
|
|
73
73
|
window.removeEventListener('blur', closeMenuOnWindowBlur);
|
|
74
74
|
};
|
|
75
|
-
}, [
|
|
76
|
-
React.useEffect(() => {
|
|
77
|
-
if (onMenuOpen && showPopover) onMenuOpen();else if (onMenuClose && !showPopover) onMenuClose();
|
|
78
|
-
}, [showPopover, onMenuOpen, onMenuClose]);
|
|
75
|
+
}, [setMenuState]);
|
|
79
76
|
return React.useMemo(() => /*#__PURE__*/jsxRuntime.jsx(styled.StyledContainer, _objectSpread(_objectSpread(_objectSpread({
|
|
80
77
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.CONTAINER,
|
|
81
78
|
ref: setReferenceElement
|
|
@@ -86,7 +83,7 @@ const Container = () => {
|
|
|
86
83
|
children: [_Controls2 || (_Controls2 = /*#__PURE__*/_jsx__default["default"](Controls.Controls, {})), /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
87
84
|
customOffset: [0, 5],
|
|
88
85
|
referenceElement: referenceElement,
|
|
89
|
-
showPopover:
|
|
86
|
+
showPopover: menuState,
|
|
90
87
|
closeContextMenu: handleCloseMenu,
|
|
91
88
|
startPlacementPreference: startPlacementPreference,
|
|
92
89
|
placementOrderPreference: placementOrderPreference,
|
|
@@ -99,7 +96,7 @@ const Container = () => {
|
|
|
99
96
|
onMouseDown: handleMouseDown
|
|
100
97
|
}, void 0, _MenuList2 || (_MenuList2 = /*#__PURE__*/_jsx__default["default"](MenuList.MenuList, {})))))]
|
|
101
98
|
})
|
|
102
|
-
})), [inline, setReferenceElement, globalsAttrs, referenceElement,
|
|
99
|
+
})), [inline, setReferenceElement, globalsAttrs, referenceElement, menuState, xStyledProps, handleCloseMenu, startPlacementPreference, placementOrderPreference, withoutPortal, zIndex, handleMouseDown]);
|
|
103
100
|
};
|
|
104
101
|
|
|
105
102
|
exports.Container = Container;
|
|
@@ -8,6 +8,7 @@ var DropdownIndicator = require('../DropdownIndicator.js');
|
|
|
8
8
|
var ComboboxDataTestids = require('../../ComboboxDataTestids.js');
|
|
9
9
|
var ComboBoxCTX = require('../../ComboBoxCTX.js');
|
|
10
10
|
var styled = require('./styled.js');
|
|
11
|
+
var listHelper = require('../../utils/listHelper.js');
|
|
11
12
|
var MultiSelectedValuesContainer = require('../multi-selected-values-container/MultiSelectedValuesContainer.js');
|
|
12
13
|
var ControlsInput = require('../controls-input/ControlsInput.js');
|
|
13
14
|
var useOnPillsNavigation = require('./useOnPillsNavigation.js');
|
|
@@ -20,7 +21,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
21
|
|
|
21
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
22
23
|
|
|
23
|
-
var _A11ySelectedValues,
|
|
24
|
+
var _A11ySelectedValues, _MultiSelectedValuesC, _A11yFocusedOption, _ControlsInput, _DropdownIndicator;
|
|
24
25
|
const Controls = () => {
|
|
25
26
|
const {
|
|
26
27
|
props: {
|
|
@@ -32,12 +33,12 @@ const Controls = () => {
|
|
|
32
33
|
innerRef
|
|
33
34
|
},
|
|
34
35
|
selectedOptionsRef,
|
|
35
|
-
|
|
36
|
+
setMenuState,
|
|
36
37
|
setFocusOptionIdx,
|
|
37
38
|
hasFocus,
|
|
38
39
|
listRef,
|
|
39
40
|
focusOptionIdx,
|
|
40
|
-
|
|
41
|
+
menuState,
|
|
41
42
|
controlsWrapperRef
|
|
42
43
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
43
44
|
const handleOnClick = React.useCallback(() => {
|
|
@@ -45,37 +46,34 @@ const Controls = () => {
|
|
|
45
46
|
|
|
46
47
|
if (disabled) return;
|
|
47
48
|
|
|
48
|
-
if (hasFocus &&
|
|
49
|
+
if (hasFocus && menuState && !inline) {
|
|
49
50
|
var _innerRef$current;
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
setMenuState(false);
|
|
52
53
|
setFocusOptionIdx('');
|
|
53
54
|
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.blur();
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
(_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
|
|
58
|
-
|
|
59
|
+
setMenuState(true);
|
|
59
60
|
window.requestAnimationFrame(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
behavior: 'smooth'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
61
|
+
window.requestAnimationFrame(() => {
|
|
62
|
+
if (listRef.current) listHelper.scrollIfNeeded(listRef.current);
|
|
63
|
+
});
|
|
66
64
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
}, [disabled, listRef, hasFocus,
|
|
65
|
+
}, [disabled, listRef, hasFocus, menuState, inline, innerRef, setMenuState, focusOptionIdx]); // this callback prevent to toggle the menu when clicking or removing pills
|
|
68
66
|
|
|
69
67
|
const handleOnPillsClick = React.useCallback(e => {
|
|
70
|
-
if (
|
|
68
|
+
if (menuState || disabled) {
|
|
71
69
|
e.stopPropagation();
|
|
72
70
|
} else {
|
|
73
71
|
var _innerRef$current3;
|
|
74
72
|
|
|
75
73
|
(_innerRef$current3 = innerRef.current) === null || _innerRef$current3 === void 0 ? void 0 : _innerRef$current3.focus();
|
|
76
|
-
|
|
74
|
+
setMenuState(true);
|
|
77
75
|
}
|
|
78
|
-
}, [
|
|
76
|
+
}, [menuState, innerRef, disabled, setMenuState]); // callback to prevent onBlur on the input when clicking in all the wrapper
|
|
79
77
|
|
|
80
78
|
const handleOnMouseDown = React.useCallback(e => {
|
|
81
79
|
if (document.activeElement === innerRef.current || inline) {
|
|
@@ -100,12 +98,12 @@ const Controls = () => {
|
|
|
100
98
|
children: [!inline && /*#__PURE__*/jsxRuntime.jsxs(styled.StyledSelection, {
|
|
101
99
|
ref: selectedOptionsRef,
|
|
102
100
|
onClick: handleOnPillsClick,
|
|
103
|
-
children: [_A11ySelectedValues || (_A11ySelectedValues = /*#__PURE__*/_jsx__default["default"](A11ySelectedValues.A11ySelectedValues, {})),
|
|
101
|
+
children: [_A11ySelectedValues || (_A11ySelectedValues = /*#__PURE__*/_jsx__default["default"](A11ySelectedValues.A11ySelectedValues, {})), Array.isArray(selectedValues) ? _MultiSelectedValuesC || (_MultiSelectedValuesC = /*#__PURE__*/_jsx__default["default"](MultiSelectedValuesContainer.MultiSelectedValuesContainer, {})) : /*#__PURE__*/_jsx__default["default"]("div", {
|
|
104
102
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES
|
|
105
103
|
}, void 0, selectedValues && /*#__PURE__*/_jsx__default["default"](RemovableSelectedValuePill.RemovableSelectedValuePill, {
|
|
106
104
|
pill: selectedValues
|
|
107
105
|
}))]
|
|
108
|
-
}), _ControlsInput || (_ControlsInput = /*#__PURE__*/_jsx__default["default"](ControlsInput.ControlsInput, {})), !inline && /*#__PURE__*/_jsx__default["default"](styled.StyledHeaderActionsWrapper, {
|
|
106
|
+
}), _A11yFocusedOption || (_A11yFocusedOption = /*#__PURE__*/_jsx__default["default"](A11yFocusedOption.A11yFocusedOption, {})), _ControlsInput || (_ControlsInput = /*#__PURE__*/_jsx__default["default"](ControlsInput.ControlsInput, {})), !inline && /*#__PURE__*/_jsx__default["default"](styled.StyledHeaderActionsWrapper, {
|
|
109
107
|
justifyContent: "center",
|
|
110
108
|
cols: ['min-content', 'min-content']
|
|
111
109
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyleHeaderActionsSeparator, {
|
|
@@ -13,7 +13,7 @@ const useOnPillsNavigation = () => {
|
|
|
13
13
|
},
|
|
14
14
|
inputValue,
|
|
15
15
|
hasFocus,
|
|
16
|
-
|
|
16
|
+
setMenuState,
|
|
17
17
|
selectedOptionsRef
|
|
18
18
|
} = React.useContext(ComboBoxCTX.ComboBoxContext); // todo: constant must be defined on pills component
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ const useOnPillsNavigation = () => {
|
|
|
24
24
|
var _innerRef$current;
|
|
25
25
|
|
|
26
26
|
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
|
|
27
|
-
|
|
27
|
+
setMenuState(true, 'open', e);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -47,7 +47,7 @@ const useOnPillsNavigation = () => {
|
|
|
47
47
|
(_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
}, [inputValue,
|
|
50
|
+
}, [inputValue, innerRef, setMenuState, selectedOptionsRef, hasFocus]);
|
|
51
51
|
return {
|
|
52
52
|
onKeyDownPills
|
|
53
53
|
};
|
|
@@ -27,7 +27,7 @@ const ControlsInput = () => {
|
|
|
27
27
|
},
|
|
28
28
|
focusOptionIdx,
|
|
29
29
|
inputValue,
|
|
30
|
-
|
|
30
|
+
menuState
|
|
31
31
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
32
32
|
const {
|
|
33
33
|
onInputKeyDown
|
|
@@ -52,7 +52,7 @@ const ControlsInput = () => {
|
|
|
52
52
|
placeholder: placeholder,
|
|
53
53
|
"aria-controls": "combo-listbox",
|
|
54
54
|
"aria-activedescendant": focusOptionIdx,
|
|
55
|
-
"aria-expanded":
|
|
55
|
+
"aria-expanded": menuState,
|
|
56
56
|
"aria-haspopup": "listbox",
|
|
57
57
|
"aria-describedby": "combobox-selected-items",
|
|
58
58
|
role: "combobox",
|
|
@@ -19,6 +19,7 @@ const useControlsInput = () => {
|
|
|
19
19
|
},
|
|
20
20
|
setHasFocus,
|
|
21
21
|
inputValue,
|
|
22
|
+
setMenuState,
|
|
22
23
|
setInputValue
|
|
23
24
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
24
25
|
const [width, setWidth] = React.useState(1); // use span reference to calculate the real width for the input
|
|
@@ -36,9 +37,9 @@ const useControlsInput = () => {
|
|
|
36
37
|
const handleOnChange = useMaskedOnChange.useMaskedOnChange();
|
|
37
38
|
const handleOnBlur = React.useCallback(() => {
|
|
38
39
|
setInputValue('');
|
|
39
|
-
if (onFilter) onFilter(allOptions
|
|
40
|
+
if (onFilter) onFilter(allOptions);
|
|
40
41
|
setHasFocus(false);
|
|
41
|
-
}, [setInputValue, onFilter, allOptions,
|
|
42
|
+
}, [setInputValue, onFilter, allOptions, setHasFocus]);
|
|
42
43
|
const handleOnFocus = React.useCallback(() => {
|
|
43
44
|
setHasFocus(true);
|
|
44
45
|
}, [setHasFocus]);
|