@qualtrics/ui-react 2.20.0 → 2.22.0
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/CHANGELOG.md +17 -33
- package/dist/__shared/cjs/{index-90d4069b.js → index-025620bf.js} +718 -673
- package/dist/__shared/cjs/{index-579c4690.js → index-41a013d2.js} +4 -4
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -4
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -2
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +11 -11
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +12 -16
- package/dist/components/ColorPicker/ColorPicker.js +15 -9
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyout.js +9 -4
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +8 -6
- package/dist/components/ColorPicker/Hue.js +3 -9
- package/dist/components/ColorPicker/Palette.js +13 -9
- package/dist/components/ColorPicker/Saturation.js +9 -17
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +3 -2
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +10 -9
- package/dist/components/Combobox/Combobox.js +54 -31
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +3 -2
- package/dist/components/Combobox/ComboboxInput.js +4 -4
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +5 -2
- package/dist/components/Dropdown/Dropdown.js +14 -14
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -19
- package/dist/components/Dropdown/DropdownList.js +4 -4
- package/dist/components/Dropdown/DropdownOption.js +5 -7
- package/dist/components/Dropdown/DropdownSearch.js +12 -9
- package/dist/components/FilePicker/FilePicker.js +13 -13
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FormField/FormFieldContext.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +12 -9
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -2
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionSet.js +5 -5
- package/dist/components/LogicEditor/LogicEditor.js +1 -1
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +2 -1
- package/dist/components/Modal/Modal.js +14 -13
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +41 -30
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -2
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +19 -15
- package/dist/components/NewMenu/parts/MenuItem.js +1 -1
- package/dist/components/NumberStepper/NumberStepper.js +7 -6
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperIncrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperInput.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +5 -5
- package/dist/components/Pagination/PaginationPageInput.js +11 -9
- package/dist/components/Pagination/PaginationPreviousButton.js +5 -5
- package/dist/components/Popover/Popover.js +9 -7
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +4 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +4 -4
- package/dist/components/Radio/Radio.js +12 -11
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +4 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav.js +2 -1
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -1
- package/dist/components/Slider/RangeSlider.js +2 -2
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +1 -1
- package/dist/components/Switch/Switch.js +11 -11
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabList.js +6 -5
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +15 -7
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -4
- package/dist/components/deprecated_ColorPicker/Color.js +6 -6
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -2
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -1
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -3
- package/dist/components/deprecated_ColorPicker/Saturation.js +5 -5
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +8 -8
- package/dist/components/deprecated_Tabs/Tabs.js +11 -7
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanels.js +4 -29
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +8 -8
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -3
- package/dist/hooks/useBreakpoints/useBreakpoints.js +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -1
- package/dist/hooks/useControllableState/useControllableState.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +4 -1
- package/dist/hooks/useId/useId.js +1 -1
- package/dist/hooks/useOverlay/useOverlay.js +11 -6
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +2 -1
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +4 -2
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/createIconComponent.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +17 -8
- package/dist/index.es.js +1 -7
- package/dist/index.js +4 -7
- package/dist/next/AdvancedTable/AdvancedTable.js +86 -87
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +6 -4
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +18 -10
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +7 -6
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +5 -4
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -1
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +3 -2
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +6 -5
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Combobox/ComboboxFlyout.js +2 -2
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +2 -2
- package/dist/next/Combobox/ComboboxOption.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +12 -8
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +1 -1
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +3 -2
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +2 -1
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +2 -1
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +1 -1
- package/dist/next/Drawer/Drawer.js +7 -4
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +2 -2
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +11 -5
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuItem.js +19 -11
- package/dist/next/Menu/MenuPane.js +70 -40
- package/dist/next/Menu/MenuSearch.js +16 -71
- package/dist/next/Menu/SubMenu.js +63 -46
- package/dist/next/Menu/constants.js +5 -1
- package/dist/next/Menu/useMutationObserver.js +17 -0
- package/dist/next/Menu/usePaneSearch.js +109 -7
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +7 -6
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +8 -2
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimeDropdown.js +4 -4
- package/dist/next/TimePicker/TimeInput.js +2 -2
- package/dist/next/TimePicker/TimePicker.js +4 -4
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +2 -1
- package/dist/next/TimePicker/utils.js +10 -9
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +2 -1
- package/dist/next/index.js +601 -432
- package/dist/utils/Flyout/Flyout.js +1 -1
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +9 -5
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +2 -1
- package/dist/utils/Translation/useTranslation.js +4 -5
- package/dist/utils/filterChildren/filterChildren.js +2 -1
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -1
- package/dist/utils/mergeRefs/mergeRefs.js +1 -1
- package/dist/utils/wrapEvent/wrapEvent.js +2 -2
- package/icons/package.json +1 -0
- package/next/package.json +2 -1
- package/package.json +4 -4
- package/dist/utils/keyboardUser/index.js +0 -1
- package/dist/utils/keyboardUser/keyboardUser.js +0 -30
|
@@ -26,6 +26,7 @@ import ArrowNav from './parts/ArrowNav/ArrowNav.js';
|
|
|
26
26
|
import MenuSearchBox from './parts/MenuSearchBox.js';
|
|
27
27
|
|
|
28
28
|
const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
29
|
+
var _externalAnchor$props, _externalAnchor$props2, _useMenuContext, _externalAnchor$props3, _externalAnchor$props4, _externalAnchor$props5, _externalAnchor$props6, _externalAnchor$props7, _externalAnchor$props8, _externalAnchor$props9, _anchorRef$current;
|
|
29
30
|
let {
|
|
30
31
|
anchor: externalAnchor,
|
|
31
32
|
'aria-label': externalAriaLabel,
|
|
@@ -66,9 +67,9 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
66
67
|
private_isFirstElementHighlightedOnUserActivatedOpen = true,
|
|
67
68
|
...rest
|
|
68
69
|
} = _ref;
|
|
69
|
-
const anchorId = useId(externalAnchor
|
|
70
|
-
const arrowNavId =
|
|
71
|
-
const parentCloseAndFocusAnchor = useMenuContext()
|
|
70
|
+
const anchorId = useId((_externalAnchor$props = externalAnchor === null || externalAnchor === void 0 ? void 0 : (_externalAnchor$props2 = externalAnchor.props) === null || _externalAnchor$props2 === void 0 ? void 0 : _externalAnchor$props2.id) !== null && _externalAnchor$props !== void 0 ? _externalAnchor$props : externalId);
|
|
71
|
+
const arrowNavId = "".concat(anchorId, "-menu");
|
|
72
|
+
const parentCloseAndFocusAnchor = (_useMenuContext = useMenuContext()) === null || _useMenuContext === void 0 ? void 0 : _useMenuContext.closeAndFocusAnchor;
|
|
72
73
|
const isSubmenu = Boolean(parentCloseAndFocusAnchor);
|
|
73
74
|
const {
|
|
74
75
|
translate
|
|
@@ -87,20 +88,23 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
87
88
|
// Call onIsOpenChange whenever externalIsOpen changes
|
|
88
89
|
useDidUpdate(() => {
|
|
89
90
|
if (isSubmenu) {
|
|
90
|
-
|
|
91
|
+
var _onIsOpenChangeRef$cu;
|
|
92
|
+
(_onIsOpenChangeRef$cu = onIsOpenChangeRef.current) === null || _onIsOpenChangeRef$cu === void 0 ? void 0 : _onIsOpenChangeRef$cu.call(onIsOpenChangeRef, externalIsOpen);
|
|
91
93
|
}
|
|
92
94
|
}, [externalIsOpen, onIsOpenChangeRef, isSubmenu]);
|
|
93
95
|
// Call onIsOpenChange if open on mount or on unmount
|
|
94
96
|
useEffect(() => {
|
|
95
97
|
if (isSubmenu) {
|
|
96
98
|
if (externalIsOpenRef.current) {
|
|
97
|
-
|
|
99
|
+
var _onIsOpenChangeRef$cu2;
|
|
100
|
+
(_onIsOpenChangeRef$cu2 = onIsOpenChangeRef.current) === null || _onIsOpenChangeRef$cu2 === void 0 ? void 0 : _onIsOpenChangeRef$cu2.call(onIsOpenChangeRef, true);
|
|
98
101
|
}
|
|
99
102
|
return () => {
|
|
100
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
104
|
if (externalIsOpenRef.current) {
|
|
105
|
+
var _onIsOpenChangeRef$cu3;
|
|
102
106
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
-
onIsOpenChangeRef.current
|
|
107
|
+
(_onIsOpenChangeRef$cu3 = onIsOpenChangeRef.current) === null || _onIsOpenChangeRef$cu3 === void 0 ? void 0 : _onIsOpenChangeRef$cu3.call(onIsOpenChangeRef, false);
|
|
104
108
|
}
|
|
105
109
|
};
|
|
106
110
|
}
|
|
@@ -114,11 +118,15 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
114
118
|
}, [setHighlightedIndex, setIsOpen, setSearchTerm]);
|
|
115
119
|
const handleMultiSelectChange = item => {
|
|
116
120
|
let arr = selectedValue || selectedValue === 0 ? [].concat(selectedValue) : [];
|
|
117
|
-
const i = arr.findIndex(v =>
|
|
121
|
+
const i = arr.findIndex(v => {
|
|
122
|
+
var _item$props;
|
|
123
|
+
return v === (item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.value);
|
|
124
|
+
});
|
|
118
125
|
if (i !== -1) {
|
|
119
126
|
arr.splice(i, 1);
|
|
120
127
|
} else {
|
|
121
|
-
|
|
128
|
+
var _item$props2;
|
|
129
|
+
arr = union(arr, item === null || item === void 0 ? void 0 : (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.value);
|
|
122
130
|
}
|
|
123
131
|
setSelectedValue(arr, getLabelFromValue(children, arr), item);
|
|
124
132
|
};
|
|
@@ -131,11 +139,12 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
131
139
|
setSelectedValue(value, getLabelFromValue(children, value), item);
|
|
132
140
|
};
|
|
133
141
|
const handleItemSelected = item => {
|
|
142
|
+
var _item$props3;
|
|
134
143
|
if (!selectable) {
|
|
135
144
|
closeAndFocusAnchor();
|
|
136
145
|
return;
|
|
137
146
|
}
|
|
138
|
-
const value = item
|
|
147
|
+
const value = item === null || item === void 0 ? void 0 : (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.value;
|
|
139
148
|
if (!value && value !== 0) {
|
|
140
149
|
// eslint-disable-next-line no-console
|
|
141
150
|
console.warn('<MenuItem> should have a "value" prop when used in a <SelectMenu>', item);
|
|
@@ -201,12 +210,12 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
201
210
|
onSelectedValueChange: handleSubmenuOnSelectedValueChange
|
|
202
211
|
});
|
|
203
212
|
}
|
|
204
|
-
if (child
|
|
205
|
-
var _context;
|
|
213
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === MenuItem) {
|
|
214
|
+
var _context, _child$props, _child$props2;
|
|
206
215
|
menuItemIndex += 1;
|
|
207
216
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
208
217
|
isHighlighted: actualIndex === highlightedIndex,
|
|
209
|
-
isSelected: selectable && typeof selectedValue !== 'undefined' && Array.isArray(selectedValue) ? _includesInstanceProperty(_context = selectedValue).call(_context, child
|
|
218
|
+
isSelected: selectable && typeof selectedValue !== 'undefined' && Array.isArray(selectedValue) ? _includesInstanceProperty(_context = selectedValue).call(_context, child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.value) : (child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.value) === selectedValue,
|
|
210
219
|
onSelect: wrapEvent(child.props.onSelect, () => {
|
|
211
220
|
handleItemSelected(child);
|
|
212
221
|
}),
|
|
@@ -216,21 +225,21 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
216
225
|
}
|
|
217
226
|
return child;
|
|
218
227
|
});
|
|
219
|
-
const anchorLabel = label
|
|
220
|
-
const menuAnchorLabel = anchorLabel
|
|
228
|
+
const anchorLabel = label !== null && label !== void 0 ? label : getLabelFromValue(children, selectedValue);
|
|
229
|
+
const menuAnchorLabel = anchorLabel !== null && anchorLabel !== void 0 ? anchorLabel : defaultLabel;
|
|
221
230
|
const announceToScreenReader = useScreenReaderAnnouncement('assertive');
|
|
222
|
-
const ariaLabelledBy = externalAnchor
|
|
223
|
-
const ariaLabel = externalAnchor
|
|
224
|
-
const ariaExpanded = externalAnchor
|
|
231
|
+
const ariaLabelledBy = (_externalAnchor$props3 = externalAnchor === null || externalAnchor === void 0 ? void 0 : (_externalAnchor$props4 = externalAnchor.props) === null || _externalAnchor$props4 === void 0 ? void 0 : _externalAnchor$props4['aria-labelledby']) !== null && _externalAnchor$props3 !== void 0 ? _externalAnchor$props3 : externalAriaLabelledBy ? "".concat(externalAriaLabelledBy, " ").concat(anchorId) : undefined;
|
|
232
|
+
const ariaLabel = (_externalAnchor$props5 = externalAnchor === null || externalAnchor === void 0 ? void 0 : (_externalAnchor$props6 = externalAnchor.props) === null || _externalAnchor$props6 === void 0 ? void 0 : _externalAnchor$props6['aria-label']) !== null && _externalAnchor$props5 !== void 0 ? _externalAnchor$props5 : externalAriaLabel && typeof menuAnchorLabel === 'string' ? "".concat(externalAriaLabel, " ").concat(menuAnchorLabel) : externalAriaLabel;
|
|
233
|
+
const ariaExpanded = (externalAnchor === null || externalAnchor === void 0 ? void 0 : externalAnchor.props['aria-expanded']) !== undefined ? externalAnchor.props['aria-expanded'] : isOpen ? true : undefined;
|
|
225
234
|
const actualAnchor = externalAnchor !== undefined ? /*#__PURE__*/React__default.cloneElement(externalAnchor, {
|
|
226
235
|
ref: mergeRefs(ref, anchorRef, externalAnchor.ref),
|
|
227
|
-
tabIndex: externalAnchor.props.tabIndex
|
|
228
|
-
role: externalAnchor.props.role
|
|
236
|
+
tabIndex: (_externalAnchor$props7 = externalAnchor.props.tabIndex) !== null && _externalAnchor$props7 !== void 0 ? _externalAnchor$props7 : 0,
|
|
237
|
+
role: (_externalAnchor$props8 = externalAnchor.props.role) !== null && _externalAnchor$props8 !== void 0 ? _externalAnchor$props8 : 'button',
|
|
229
238
|
id: anchorId,
|
|
230
239
|
'aria-controls': isOpen ? arrowNavId : undefined,
|
|
231
240
|
'aria-expanded': ariaExpanded,
|
|
232
241
|
'aria-haspopup': 'menu',
|
|
233
|
-
'aria-disabled': externalAnchor.props['aria-disabled']
|
|
242
|
+
'aria-disabled': (_externalAnchor$props9 = externalAnchor.props['aria-disabled']) !== null && _externalAnchor$props9 !== void 0 ? _externalAnchor$props9 : disabled,
|
|
234
243
|
'aria-labelledby': ariaLabelledBy,
|
|
235
244
|
'aria-label': ariaLabel,
|
|
236
245
|
onMouseDown: preventClickOutside,
|
|
@@ -311,17 +320,17 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
311
320
|
id: arrowNavId,
|
|
312
321
|
role: "menu",
|
|
313
322
|
"aria-labelledby": anchorId,
|
|
314
|
-
isNavItem: child => child
|
|
323
|
+
isNavItem: child => (child === null || child === void 0 ? void 0 : child.type) === MenuItem || (child === null || child === void 0 ? void 0 : child.type) === MenuSearchBox || isType(child, menuType),
|
|
315
324
|
style: {
|
|
316
325
|
zIndex,
|
|
317
|
-
maxWidth: maxFlyoutWidth
|
|
318
|
-
width: maxFlyoutWidth
|
|
326
|
+
maxWidth: maxFlyoutWidth !== null && maxFlyoutWidth !== void 0 ? maxFlyoutWidth : undefined,
|
|
327
|
+
width: maxFlyoutWidth !== null && maxFlyoutWidth !== void 0 ? maxFlyoutWidth : undefined
|
|
319
328
|
},
|
|
320
329
|
onMouseDown: preventClickOutside,
|
|
321
330
|
className: classNames(styles.contentPane, flyoutClassName),
|
|
322
331
|
highlightedIndex: highlightedIndex,
|
|
323
332
|
maxHeight: maxHeight,
|
|
324
|
-
minWidth: isSubmenu ? undefined : Math.min(350, Math.max(160, anchorRef
|
|
333
|
+
minWidth: isSubmenu ? undefined : Math.min(350, Math.max(160, anchorRef === null || anchorRef === void 0 ? void 0 : (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.offsetWidth)),
|
|
325
334
|
searchable: searchable,
|
|
326
335
|
onHighlightedIndexChange: i => setHighlightedIndex(i),
|
|
327
336
|
searchTerm: searchTerm,
|
|
@@ -340,8 +349,9 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
340
349
|
// (not menu container) so we focus anchor before browser moves focus
|
|
341
350
|
closeAndFocusAnchor();
|
|
342
351
|
} else if (e.key === 'ArrowLeft' && isSubmenu) {
|
|
352
|
+
var _arrowNavRef$current;
|
|
343
353
|
// Only update the highlighted index for the current menu (i.e. if the event bubbles up to a parent menu, don't update the highlighted index for the parent menu)
|
|
344
|
-
if (arrowNavRef.current
|
|
354
|
+
if ((_arrowNavRef$current = arrowNavRef.current) !== null && _arrowNavRef$current !== void 0 && _arrowNavRef$current.contains(e.target) && e.target !== searchBoxRef.current) {
|
|
345
355
|
setHighlightedIndex(-1);
|
|
346
356
|
}
|
|
347
357
|
}
|
|
@@ -368,8 +378,7 @@ function filterItems(valueToFilterBy, items) {
|
|
|
368
378
|
return _includesInstanceProperty(_context3 = item.props.children.toLowerCase()).call(_context3, searchTermLowerCase);
|
|
369
379
|
}
|
|
370
380
|
// eslint-disable-next-line no-console
|
|
371
|
-
console.warn(
|
|
372
|
-
Ensure prop "children" is of type "string" or provide a "label" prop!`, item);
|
|
381
|
+
console.warn("<MenuItem> not included in search results!\n Ensure prop \"children\" is of type \"string\" or provide a \"label\" prop!", item);
|
|
373
382
|
return false;
|
|
374
383
|
});
|
|
375
384
|
return result;
|
|
@@ -388,11 +397,12 @@ function getDescendent(children, value) {
|
|
|
388
397
|
if (value === undefined) return null;
|
|
389
398
|
const childArray = React__default.Children.toArray(children);
|
|
390
399
|
for (let i = 0; i < childArray.length; i += 1) {
|
|
400
|
+
var _child$props3, _child$props4;
|
|
391
401
|
const child = childArray[i];
|
|
392
|
-
if (child
|
|
402
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === MenuItem && (child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.value) === value) {
|
|
393
403
|
return child;
|
|
394
404
|
}
|
|
395
|
-
if (child
|
|
405
|
+
if ((child === null || child === void 0 ? void 0 : child.type) !== MenuItem && child !== null && child !== void 0 && (_child$props4 = child.props) !== null && _child$props4 !== void 0 && _child$props4.children) {
|
|
396
406
|
const descendent = getDescendent(child.props.children, value);
|
|
397
407
|
if (descendent) {
|
|
398
408
|
return descendent;
|
|
@@ -402,7 +412,8 @@ function getDescendent(children, value) {
|
|
|
402
412
|
return null;
|
|
403
413
|
}
|
|
404
414
|
function getLabel(menuOptionNode) {
|
|
405
|
-
|
|
415
|
+
var _menuOptionNode$props;
|
|
416
|
+
if ( /*#__PURE__*/isValidElement(menuOptionNode)) return getLabel(menuOptionNode === null || menuOptionNode === void 0 ? void 0 : (_menuOptionNode$props = menuOptionNode.props) === null || _menuOptionNode$props === void 0 ? void 0 : _menuOptionNode$props.children);
|
|
406
417
|
return menuOptionNode;
|
|
407
418
|
}
|
|
408
419
|
function union(arr1, arr2) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"menuBtn":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._60mfK._60mfK{min-width:0;max-width:100%;padding:0 4px 0 12px;white-space:nowrap;line-height:20px;font-size:14px;cursor:pointer;justify-content:space-between;text-align:left;outline:none;background-color:#fafafa;border:none;box-shadow:inset 0 0 0 1px #898989;border-radius:4px;height:36px;color:#515559;fill:#515559}._60mfK._60mfK,._60mfK._60mfK ._wGBb3{display:inline-flex;align-items:center}._60mfK._60mfK ._wGBb3{overflow:hidden;text-overflow:ellipsis}._60mfK._60mfK._naGrE{min-height:26px;height:26px}._60mfK._60mfK._ZvVGR{color:#32363a}._60mfK._60mfK:hover:not([aria-disabled=true]){background-color:#f5f5f5}._60mfK._60mfK:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._60mfK._60mfK[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._60mfK._60mfK[aria-disabled=true]>svg{fill:#515559;opacity:.4}._60mfK._60mfK[aria-disabled=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._60mfK._60mfK._cikaT{padding-left:0}._60mfK._60mfK._xR8IM{margin-top:4px}._60mfK._60mfK ._hmZF5{fill:#515559}._60mfK._60mfK ._hmZF5._naGrE{top:0}._60mfK._60mfK ._hmZF5._SBAGM{transform:rotate(-180deg)}._-g0t4{margin:0;font-size:14px;color:#32363a;fill:#32363a;list-style:none;min-width:160px;max-width:350px;min-height:10px;max-height:99%;background:#fff;border:1px solid #eee;border-radius:4px;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);z-index:1000;overflow-x:hidden;overflow-y:auto;overflow:hidden auto}._-g0t4::-webkit-scrollbar,._-g0t4::-webkit-scrollbar-thumb{visibility:hidden;width:8px;border-radius:4px}._-g0t4::-webkit-scrollbar{background-color:rgba(0,0,0,.06)}._-g0t4::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.4)}._-g0t4:hover::-webkit-scrollbar,._-g0t4:hover::-webkit-scrollbar-thumb,._-g0t4[focus-within]::-webkit-scrollbar,._-g0t4[focus-within]::-webkit-scrollbar-thumb{visibility:visible}._-g0t4:focus-within::-webkit-scrollbar,._-g0t4:focus-within::-webkit-scrollbar-thumb,._-g0t4:hover::-webkit-scrollbar,._-g0t4:hover::-webkit-scrollbar-thumb{visibility:visible}._RsVxs{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word}._RsVxs[aria-disabled=true]{cursor:not-allowed;color:rgba(50,54,58,.65);fill:rgba(50,54,58,.65)}._RsVxs._DKBC6{background-color:#efefef}._RsVxs._M70bO{box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._RsVxs._ZvVGR{background-color:#ebf3fb;font-weight:500;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif}._RsVxs._ZvVGR._DKBC6{background-color:#e4effa}._RsVxs._TJUMw{cursor:default}._RsVxs:active:not(._-DBWB):not(._ZvVGR):not([aria-disabled=true]):not(._TJUMw){background-color:#e8e9e9}._-DBWB{padding-right:32px}._-DBWB ._hmZF5{position:absolute;top:8px;right:3px;fill:#515559}._AYlq7{padding:8px;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0;position:-webkit-sticky;position:sticky;top:0;z-index:20;background-color:#fff}._AAP-Y{position:absolute;top:13px;left:13px}._jHpj7._jHpj7{padding-left:32px}._xsdFo{margin:2px 12px 2px 0;flex-shrink:0}._xsdFo._rwIGj>svg{border-color:#0b6ed0}._GOSTK{display:flex;justify-self:center;margin:8px}";
|
|
4
|
+
var styles = {"menuBtn":"_60mfK","menuBtnLabel":"_wGBb3","small":"_naGrE","selected":"_ZvVGR","unlabelledButton":"_cikaT","formLabelled":"_xR8IM","rightIcon":"_hmZF5","open":"_SBAGM","contentPane":"_-g0t4","menuItem":"_RsVxs","active":"_DKBC6","focus":"_M70bO","noMenuItems":"_TJUMw","subMenu":"_-DBWB","searchBox":"_AYlq7","searchBoxIcon":"_AAP-Y","searchBoxInput":"_jHpj7","checkbox":"_xsdFo","highlighted":"_rwIGj","menuSpinner":"_GOSTK"};
|
|
5
|
+
var stylesheet="._60mfK._60mfK{min-width:0;max-width:100%;padding:0 4px 0 12px;white-space:nowrap;line-height:20px;font-size:14px;cursor:pointer;justify-content:space-between;text-align:left;outline:none;background-color:#fafafa;border:none;box-shadow:inset 0 0 0 1px #898989;border-radius:4px;height:36px;color:#515559;fill:#515559}._60mfK._60mfK,._60mfK._60mfK ._wGBb3{display:inline-flex;align-items:center}._60mfK._60mfK ._wGBb3{overflow:hidden;text-overflow:ellipsis}._60mfK._60mfK._naGrE{min-height:26px;height:26px}._60mfK._60mfK._ZvVGR{color:#32363a}._60mfK._60mfK:hover:not([aria-disabled=true]){background-color:#f5f5f5}._60mfK._60mfK:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._60mfK._60mfK[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._60mfK._60mfK[aria-disabled=true]>svg{fill:#515559;opacity:.4}._60mfK._60mfK[aria-disabled=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._60mfK._60mfK._cikaT{padding-left:0}._60mfK._60mfK._xR8IM{margin-top:4px}._60mfK._60mfK ._hmZF5{fill:#515559}._60mfK._60mfK ._hmZF5._naGrE{top:0}._60mfK._60mfK ._hmZF5._SBAGM{transform:rotate(-180deg)}._-g0t4{margin:0;font-size:14px;color:#32363a;fill:#32363a;list-style:none;min-width:160px;max-width:350px;min-height:10px;max-height:99%;background:#fff;border:1px solid #eee;border-radius:4px;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);z-index:1000;overflow-x:hidden;overflow-y:auto;overflow:hidden auto}._-g0t4::-webkit-scrollbar,._-g0t4::-webkit-scrollbar-thumb{visibility:hidden;width:8px;border-radius:4px}._-g0t4::-webkit-scrollbar{background-color:rgba(0,0,0,.06)}._-g0t4::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.4)}._-g0t4:hover::-webkit-scrollbar,._-g0t4:hover::-webkit-scrollbar-thumb,._-g0t4[focus-within]::-webkit-scrollbar,._-g0t4[focus-within]::-webkit-scrollbar-thumb{visibility:visible}._-g0t4:focus-within::-webkit-scrollbar,._-g0t4:focus-within::-webkit-scrollbar-thumb,._-g0t4:hover::-webkit-scrollbar,._-g0t4:hover::-webkit-scrollbar-thumb{visibility:visible}._RsVxs{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word}._RsVxs[aria-disabled=true]{cursor:not-allowed;color:rgba(50,54,58,.65);fill:rgba(50,54,58,.65)}._RsVxs._DKBC6{background-color:#efefef}._RsVxs._M70bO{box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._RsVxs._ZvVGR{background-color:#ebf3fb;font-weight:500;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif}._RsVxs._ZvVGR._DKBC6{background-color:#e4effa}._RsVxs._TJUMw{cursor:default}._RsVxs:active:not(._-DBWB):not(._ZvVGR):not([aria-disabled=true]):not(._TJUMw){background-color:#e8e9e9}._-DBWB{padding-right:32px}._-DBWB ._hmZF5{position:absolute;top:8px;right:3px;fill:#515559}._AYlq7{padding:8px;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0;position:-webkit-sticky;position:sticky;top:0;z-index:20;background-color:#fff}._AAP-Y{position:absolute;top:13px;left:13px}._jHpj7._jHpj7{padding-left:32px}._xsdFo{margin:2px 12px 2px 0;flex-shrink:0}._xsdFo._rwIGj>svg{border-color:#0b6ed0}._GOSTK{display:flex;justify-self:center;margin:8px}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -18,8 +18,8 @@ const SelectMenu = /*#__PURE__*/React__default.forwardRef(function SelectMenu(_r
|
|
|
18
18
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
19
19
|
args[_key - 1] = arguments[_key];
|
|
20
20
|
}
|
|
21
|
-
onSelectedValueChange
|
|
22
|
-
onChange
|
|
21
|
+
onSelectedValueChange === null || onSelectedValueChange === void 0 ? void 0 : onSelectedValueChange(value, ...args);
|
|
22
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
23
23
|
}
|
|
24
24
|
}, rest));
|
|
25
25
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
2
|
-
import React__default, { useRef,
|
|
2
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
3
|
+
import { useFocusVisible } from '@react-aria/interactions';
|
|
3
4
|
import '../../../../utils/index.js';
|
|
4
5
|
import MenuSearchBox from '../MenuSearchBox.js';
|
|
5
6
|
import '../../../../hooks/index.js';
|
|
6
7
|
import mergeRefs from '../../../../utils/mergeRefs/mergeRefs.js';
|
|
7
8
|
import useId from '../../../../hooks/useId/useId.js';
|
|
8
9
|
import wrapEvent from '../../../../utils/wrapEvent/wrapEvent.js';
|
|
9
|
-
import useLatest from '../../../../hooks/useLatest/useLatest.js';
|
|
10
10
|
import { SUBMENU_POPPER_OFFSET, FLYOUT_POPPER_OFFSET } from '../../../../utils/constants.js';
|
|
11
11
|
|
|
12
12
|
function useChildrenRefs(children, getAdditionalProps, isNavItem, searchable) {
|
|
@@ -52,17 +52,19 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
52
52
|
'aria-labelledby': ariaLabelledBy,
|
|
53
53
|
...rest
|
|
54
54
|
} = _ref;
|
|
55
|
-
const [isKeyboardUser, setIsKeyboardUser] = useState(false);
|
|
56
55
|
const containerRef = useRef(null);
|
|
57
56
|
const menuId = useId();
|
|
57
|
+
const {
|
|
58
|
+
isFocusVisible
|
|
59
|
+
} = useFocusVisible({
|
|
60
|
+
isTextInput: true
|
|
61
|
+
});
|
|
58
62
|
const [refs, allChildren] = useChildrenRefs(children, (child, index) => ({
|
|
59
63
|
tabIndex: -1,
|
|
60
64
|
onMouseEnter: wrapEvent(child.props.onMouseEnter, () => {
|
|
61
|
-
setIsKeyboardUser(false);
|
|
62
65
|
onHighlightedIndexChange(index);
|
|
63
66
|
})
|
|
64
67
|
}), isNavItem, searchable);
|
|
65
|
-
const isKeyboardUserRef = useLatest(isKeyboardUser);
|
|
66
68
|
|
|
67
69
|
// Update the focused menu item when the highlighted index changes
|
|
68
70
|
useEffect(() => {
|
|
@@ -71,7 +73,7 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
71
73
|
// Scroll the item into view when navigating with a keyboard
|
|
72
74
|
const element = refs.current[highlightedIndex];
|
|
73
75
|
const searchInputSize = searchable ? 53 : 0;
|
|
74
|
-
if (
|
|
76
|
+
if (containerRef.current && isFocusVisible) {
|
|
75
77
|
const scrollBottom = containerRef.current.clientHeight + containerRef.current.scrollTop;
|
|
76
78
|
const elementBottom = element.offsetTop + element.offsetHeight;
|
|
77
79
|
if (elementBottom > scrollBottom) {
|
|
@@ -88,17 +90,17 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
88
90
|
preventScroll: true
|
|
89
91
|
});
|
|
90
92
|
} else if (highlightedIndex === 0 && searchable) {
|
|
91
|
-
searchBoxRef
|
|
93
|
+
searchBoxRef === null || searchBoxRef === void 0 ? void 0 : searchBoxRef.current.focus();
|
|
92
94
|
} else {
|
|
93
|
-
|
|
95
|
+
var _anchorRef$current;
|
|
96
|
+
anchorRef === null || anchorRef === void 0 ? void 0 : (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.focus();
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
}, [highlightedIndex, refs, searchable, allChildren.length,
|
|
97
100
|
// Needed to prevent QuickSearch from losing focus in some cases when items are loaded asynchronously while the user is navigating
|
|
98
|
-
isPopperReady,
|
|
101
|
+
isPopperReady, searchBoxRef, anchorRef]);
|
|
99
102
|
const numChildren = refs.current.length;
|
|
100
103
|
const handleKeyDown = e => {
|
|
101
|
-
setIsKeyboardUser(true);
|
|
102
104
|
if (e.key === 'ArrowDown') {
|
|
103
105
|
e.preventDefault(); // prevent scroll
|
|
104
106
|
if (highlightedIndex !== -1) {
|
|
@@ -110,14 +112,16 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
110
112
|
onHighlightedIndexChange((highlightedIndex - 1 + numChildren) % numChildren);
|
|
111
113
|
}
|
|
112
114
|
} else if (e.key === 'PageUp' || e.key === 'Home') {
|
|
115
|
+
var _containerRef$current;
|
|
113
116
|
// Only call the highlighted index change handler for the current nav list (i.e. if the event bubbles up to a parent nav list, don't call the highlighted index change handler on the parent nav list)
|
|
114
|
-
if (containerRef.current
|
|
117
|
+
if ((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(e.target)) {
|
|
115
118
|
e.preventDefault();
|
|
116
119
|
onHighlightedIndexChange(0);
|
|
117
120
|
}
|
|
118
121
|
} else if (e.key === 'PageDown' || e.key === 'End') {
|
|
122
|
+
var _containerRef$current2;
|
|
119
123
|
// Only call the highlighted index change handler for the current nav list (i.e. if the event bubbles up to a parent nav list, don't call the highlighted index change handler on the parent nav list)
|
|
120
|
-
if (containerRef.current
|
|
124
|
+
if ((_containerRef$current2 = containerRef.current) !== null && _containerRef$current2 !== void 0 && _containerRef$current2.contains(e.target)) {
|
|
121
125
|
e.preventDefault();
|
|
122
126
|
const lastIndex = numChildren - 1;
|
|
123
127
|
onHighlightedIndexChange(lastIndex);
|
|
@@ -135,20 +139,20 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
135
139
|
style: {
|
|
136
140
|
...style,
|
|
137
141
|
minWidth,
|
|
138
|
-
maxHeight: maxHeight
|
|
142
|
+
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight :
|
|
139
143
|
// This logic is located here instead of BaseMenu.js so the maxHeight will update with screen resizing (Popper has a resize listener that causes this to rerender)
|
|
140
144
|
Math.min(350, (isSubmenu ?
|
|
141
145
|
// Submenus: window height - submenu popper offset - 8px of container padding - half of anchor height (fallback to default 18px))
|
|
142
146
|
document.documentElement.clientHeight - SUBMENU_POPPER_OFFSET[0] :
|
|
143
147
|
// Menus: half of window height - menu popper offset - 8px of container padding - half of anchor height (fallback to default 18px)
|
|
144
|
-
document.documentElement.clientHeight / 2 - FLYOUT_POPPER_OFFSET[1]) - 8 - (anchorRef
|
|
148
|
+
document.documentElement.clientHeight / 2 - FLYOUT_POPPER_OFFSET[1]) - 8 - (anchorRef !== null && anchorRef !== void 0 && anchorRef.current ? anchorRef.current.offsetHeight / 2 : 18))
|
|
145
149
|
}
|
|
146
150
|
}, rest), searchable && /*#__PURE__*/React__default.createElement(MenuSearchBox, {
|
|
147
151
|
"aria-controls": menuId,
|
|
148
152
|
value: searchTerm,
|
|
149
153
|
ref: searchBoxRef,
|
|
150
154
|
onChange: e => {
|
|
151
|
-
setSearchTerm
|
|
155
|
+
setSearchTerm === null || setSearchTerm === void 0 ? void 0 : setSearchTerm(e.target.value);
|
|
152
156
|
},
|
|
153
157
|
onFocus: () => onHighlightedIndexChange(0)
|
|
154
158
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -34,7 +34,7 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
34
34
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
35
35
|
React__default.createElement("div", _extends({}, rest, {
|
|
36
36
|
ref: ref,
|
|
37
|
-
role: role
|
|
37
|
+
role: role !== null && role !== void 0 ? role : defaultRole,
|
|
38
38
|
tabIndex: tabIndex,
|
|
39
39
|
"aria-disabled": disabled,
|
|
40
40
|
"aria-checked": isSelectable ? isSelected : undefined,
|
|
@@ -159,15 +159,16 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
if (regex.test(val)) {
|
|
162
|
+
var _val$split;
|
|
162
163
|
const currentIsSeparatedByComma = isSeparatedByComma(val);
|
|
163
164
|
const currentDecimalSeparator = currentIsSeparatedByComma ? ',' : '.';
|
|
164
|
-
const decimalPortion = val.split(currentDecimalSeparator)
|
|
165
|
-
if (decimalPortion
|
|
165
|
+
const decimalPortion = (_val$split = val.split(currentDecimalSeparator)) === null || _val$split === void 0 ? void 0 : _val$split[1];
|
|
166
|
+
if ((decimalPortion === null || decimalPortion === void 0 ? void 0 : decimalPortion.length) > 2) {
|
|
166
167
|
let rounded = String(roundToTwoDecimalPlaces(convertToNumber(val)));
|
|
167
168
|
|
|
168
169
|
// If a user types a number that rounds out to a whole number, such as '23.000' or `1.999`, the '.' is rounded away, causing the user to lose their place in the input.
|
|
169
170
|
if (rounded.indexOf('.') === -1) {
|
|
170
|
-
rounded +=
|
|
171
|
+
rounded += "".concat(currentDecimalSeparator, "00");
|
|
171
172
|
}
|
|
172
173
|
setInputValue(localizeNumber(rounded, currentIsSeparatedByComma));
|
|
173
174
|
} else {
|
|
@@ -218,7 +219,7 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
218
219
|
} = e;
|
|
219
220
|
if (!componentHasFocus.current && currentTarget.contains(document.activeElement)) {
|
|
220
221
|
componentHasFocus.current = true;
|
|
221
|
-
onFocus
|
|
222
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
222
223
|
}
|
|
223
224
|
},
|
|
224
225
|
onBlur: e => {
|
|
@@ -231,7 +232,7 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
231
232
|
// Check if the new focused element is a child of the original container
|
|
232
233
|
if (!currentTarget.contains(document.activeElement)) {
|
|
233
234
|
componentHasFocus.current = false;
|
|
234
|
-
onBlur
|
|
235
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
235
236
|
}
|
|
236
237
|
});
|
|
237
238
|
}
|
|
@@ -247,7 +248,7 @@ function convertToNumber(value) {
|
|
|
247
248
|
if (typeof value === 'number') {
|
|
248
249
|
return value;
|
|
249
250
|
}
|
|
250
|
-
const num = Number(value
|
|
251
|
+
const num = Number(value === null || value === void 0 ? void 0 : value.replace(',', '.'));
|
|
251
252
|
if (Number.isNaN(num)) {
|
|
252
253
|
return 0;
|
|
253
254
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"numberStepperContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._ILS2Z{display:inline-flex;width:127px}._ss4RT{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._ss4RT:hover:not(._-KXK0){cursor:pointer;background:#f5f5f5}._ss4RT._EFVaO{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._ss4RT._-KXK0{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._ss4RT._-KXK0>svg{opacity:.4}._ss4RT::-webkit-inner-spin-button,._ss4RT::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._ss4RT:focus{z-index:0;border:none;border-radius:4px}._ss4RT:focus:not(._EFVaO){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._-9-Fm,._ss4RT:focus:not(._-KXK0){background:#fafafa}._-9-Fm{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._-9-Fm:hover:not(._-KXK0){cursor:pointer;background:#f5f5f5}._-9-Fm:active:not(._-KXK0){background:#e5e5e5}._-9-Fm._-KXK0{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._-9-Fm._-KXK0>svg{opacity:.4}._MUars{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._MUars:hover:not(._-KXK0){cursor:pointer;background:#f5f5f5}._MUars:active:not(._-KXK0){background:#e5e5e5}._MUars._-KXK0{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._MUars._-KXK0>svg{opacity:.4}";
|
|
4
|
+
var styles = {"numberStepperContainer":"_ILS2Z","numberStepperInput":"_ss4RT","disabled":"_-KXK0","invalid":"_EFVaO","decrementBtn":"_-9-Fm","incrementBtn":"_MUars"};
|
|
5
|
+
var stylesheet="._ILS2Z{display:inline-flex;width:127px}._ss4RT{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._ss4RT:hover:not(._-KXK0){cursor:pointer;background:#f5f5f5}._ss4RT._EFVaO{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._ss4RT._-KXK0{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._ss4RT._-KXK0>svg{opacity:.4}._ss4RT::-webkit-inner-spin-button,._ss4RT::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._ss4RT:focus{z-index:0;border:none;border-radius:4px}._ss4RT:focus:not(._EFVaO){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._-9-Fm,._ss4RT:focus:not(._-KXK0){background:#fafafa}._-9-Fm{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._-9-Fm:hover:not(._-KXK0){cursor:pointer;background:#f5f5f5}._-9-Fm:active:not(._-KXK0){background:#e5e5e5}._-9-Fm._-KXK0{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._-9-Fm._-KXK0>svg{opacity:.4}._MUars{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._MUars:hover:not(._-KXK0){cursor:pointer;background:#f5f5f5}._MUars:active:not(._-KXK0){background:#e5e5e5}._MUars._-KXK0{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._MUars._-KXK0>svg{opacity:.4}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -55,7 +55,7 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
55
55
|
* depending on the key that was pressed.
|
|
56
56
|
*/
|
|
57
57
|
const handleKeyDown = e => {
|
|
58
|
-
onKeyDown
|
|
58
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
59
59
|
if (isExternallyDisabled) return;
|
|
60
60
|
if (e.key === 'ArrowUp') {
|
|
61
61
|
// Prevents browser's default increment
|
|
@@ -90,7 +90,7 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
90
90
|
* Selects the DOM element
|
|
91
91
|
*/
|
|
92
92
|
const handleFocus = e => {
|
|
93
|
-
onFocus
|
|
93
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
94
94
|
if (isExternallyDisabled) return;
|
|
95
95
|
e.target.select();
|
|
96
96
|
};
|
|
@@ -100,7 +100,7 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
100
100
|
* Calls `handleInputBlur`
|
|
101
101
|
*/
|
|
102
102
|
const handleBlur = e => {
|
|
103
|
-
onBlur
|
|
103
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
104
104
|
if (isExternallyDisabled) return;
|
|
105
105
|
handleInputBlur(e);
|
|
106
106
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"pageContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._tBHRX{height:100vh;width:100vw;display:grid;grid-template-rows:auto 1fr;grid-template-columns:auto auto 1fr;grid-template-areas:\"pageHeader pageHeader pageHeader\" \"sidebarNav configPane mainContent\"}._QIS0t{grid-area:pageHeader}._UVTe-{grid-area:mainContent;height:100%;overflow:auto}";
|
|
4
|
+
var styles = {"pageContainer":"_tBHRX","pageHeader":"_QIS0t","mainContent":"_UVTe-"};
|
|
5
|
+
var stylesheet="._tBHRX{height:100vh;width:100vw;display:grid;grid-template-rows:auto 1fr;grid-template-columns:auto auto 1fr;grid-template-areas:\"pageHeader pageHeader pageHeader\" \"sidebarNav configPane mainContent\"}._QIS0t{grid-area:pageHeader}._UVTe-{grid-area:mainContent;height:100%;overflow:auto}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -58,7 +58,7 @@ const Pagination = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
58
58
|
* @param {Number} newPage - The value entered into the input
|
|
59
59
|
*/
|
|
60
60
|
const handlePageChange = useCallback(newPage => {
|
|
61
|
-
onPageChange
|
|
61
|
+
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange({
|
|
62
62
|
page: newPage
|
|
63
63
|
});
|
|
64
64
|
}, [onPageChange]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"pagination":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._cNhXA{display:flex;align-items:center;justify-content:center;font-size:14px;white-space:pre}._dS7rP{margin-right:8px}._5xY-E{margin-left:8px}._9Zz4n{margin:-10px -15px}._0Iz9k{width:100%;text-align:center}";
|
|
4
|
+
var styles = {"pagination":"_cNhXA","previousButton":"_dS7rP","nextButton":"_5xY-E","btnIcon":"_9Zz4n","input":"_0Iz9k"};
|
|
5
|
+
var stylesheet="._cNhXA{display:flex;align-items:center;justify-content:center;font-size:14px;white-space:pre}._dS7rP{margin-right:8px}._5xY-E{margin-left:8px}._9Zz4n{margin:-10px -15px}._0Iz9k{width:100%;text-align:center}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -43,19 +43,19 @@ const PaginationNextButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
43
43
|
*/
|
|
44
44
|
const increment = () => {
|
|
45
45
|
const newPage = pageInputValue + 1;
|
|
46
|
-
setPageInputValue
|
|
47
|
-
handlePageChange
|
|
46
|
+
setPageInputValue === null || setPageInputValue === void 0 ? void 0 : setPageInputValue(newPage);
|
|
47
|
+
handlePageChange === null || handlePageChange === void 0 ? void 0 : handlePageChange(newPage);
|
|
48
48
|
};
|
|
49
49
|
return /*#__PURE__*/React__default.createElement(Button, _extends({}, rest, {
|
|
50
|
-
disabled: disabled
|
|
50
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : pageInputValue === numPages,
|
|
51
51
|
ref: ref,
|
|
52
52
|
kind: "tertiary",
|
|
53
53
|
onClick: e => {
|
|
54
|
-
onClick
|
|
54
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
55
55
|
increment();
|
|
56
56
|
},
|
|
57
57
|
className: classNames(className, styles.nextButton),
|
|
58
|
-
"data-testid": dataTestIdFromProps
|
|
58
|
+
"data-testid": dataTestIdFromProps !== null && dataTestIdFromProps !== void 0 ? dataTestIdFromProps : getSubDataTestId(dataTestId, 'NextButton'),
|
|
59
59
|
"aria-label": buttonLabel
|
|
60
60
|
}), /*#__PURE__*/React__default.createElement(ChevronRightIcon, {
|
|
61
61
|
className: styles.btnIcon,
|