@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
package/dist/next/Input/Input.js
CHANGED
|
@@ -65,8 +65,8 @@ const Input = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
65
65
|
onChange: onChange,
|
|
66
66
|
className: inputClasses.input,
|
|
67
67
|
style: {
|
|
68
|
-
paddingLeft:
|
|
69
|
-
paddingRight:
|
|
68
|
+
paddingLeft: "".concat(addOnWidths.leftAddOnWidth + ADD_ON_HORIZONTAL_PADDING, "px"),
|
|
69
|
+
paddingRight: "".concat(addOnWidths.rightAddOnWidth + ADD_ON_HORIZONTAL_PADDING, "px")
|
|
70
70
|
},
|
|
71
71
|
ref: ref
|
|
72
72
|
})), getAddOnComponent(rightAddOn, inputClasses.rightAddOn, rightAddOnRef));
|
|
@@ -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 inputClasses = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._6lPJE{position:relative;display:inline-block;height:36px}._tf6zh{width:100%;height:100%;padding:8px 12px;color:#32363a;caret-color:#32363a;font-size:14px;background-color:#fafafa;border:1px solid #898989;border-radius:4px;outline:none}._tf6zh:hover{cursor:pointer;background-color:#f5f5f5}._tf6zh:focus{background-color:#fafafa;cursor:text;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;outline:none;border-color:transparent}._tf6zh:disabled,._tf6zh[aria-disabled=true]{background-color:#fafafa;border-color:#e5e5e5;color:#9d9fa1;-webkit-text-fill-color:#9d9fa1;cursor:not-allowed}._tf6zh:disabled::-moz-placeholder,._tf6zh[aria-disabled=true]::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._tf6zh:disabled::placeholder,._tf6zh[aria-disabled=true]::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._tf6zh:invalid,._tf6zh[aria-invalid=true]{border-color:#b00}._tf6zh:invalid:focus,._tf6zh[aria-invalid=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000;border-color:transparent}._tf6zh[type=number]{-moz-appearance:textfield}._tf6zh[type=number]::-webkit-inner-spin-button,._tf6zh[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._tf6zh::-moz-placeholder{color:#515559;opacity:1}._tf6zh::placeholder{color:#515559;opacity:1}._Ibm3C{pointer-events:none;color:#515559;fill:#515559}._AjGKm{display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._Q50hL{color:#515559;font-size:16px}._Z3mmE{left:0;margin-left:6px}._3fpIl,._Z3mmE{pointer-events:none;color:#515559;fill:#515559;display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._3fpIl{right:0;margin-right:6px}";
|
|
4
|
+
var inputClasses = {"container":"_6lPJE","input":"_tf6zh","addOn":"_Ibm3C","addOnVerticalCenter":"_AjGKm","addOnTextNode":"_Q50hL","leftAddOn":"_Z3mmE","rightAddOn":"_3fpIl"};
|
|
5
|
+
var stylesheet="._6lPJE{position:relative;display:inline-block;height:36px}._tf6zh{width:100%;height:100%;padding:8px 12px;color:#32363a;caret-color:#32363a;font-size:14px;background-color:#fafafa;border:1px solid #898989;border-radius:4px;outline:none}._tf6zh:hover{cursor:pointer;background-color:#f5f5f5}._tf6zh:focus{background-color:#fafafa;cursor:text;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;outline:none;border-color:transparent}._tf6zh:disabled,._tf6zh[aria-disabled=true]{background-color:#fafafa;border-color:#e5e5e5;color:#9d9fa1;-webkit-text-fill-color:#9d9fa1;cursor:not-allowed}._tf6zh:disabled::-moz-placeholder,._tf6zh[aria-disabled=true]::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._tf6zh:disabled::placeholder,._tf6zh[aria-disabled=true]::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._tf6zh:invalid,._tf6zh[aria-invalid=true]{border-color:#b00}._tf6zh:invalid:focus,._tf6zh[aria-invalid=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000;border-color:transparent}._tf6zh[type=number]{-moz-appearance:textfield}._tf6zh[type=number]::-webkit-inner-spin-button,._tf6zh[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._tf6zh::-moz-placeholder{color:#515559;opacity:1}._tf6zh::placeholder{color:#515559;opacity:1}._Ibm3C{pointer-events:none;color:#515559;fill:#515559}._AjGKm{display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._Q50hL{color:#515559;font-size:16px}._Z3mmE{left:0;margin-left:6px}._3fpIl,._Z3mmE{pointer-events:none;color:#515559;fill:#515559;display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._3fpIl{right:0;margin-right:6px}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { inputClasses as default, stylesheet };
|
package/dist/next/Menu/Menu.js
CHANGED
|
@@ -6,6 +6,7 @@ import useControllableState from '../../hooks/useControllableState/useControllab
|
|
|
6
6
|
|
|
7
7
|
/* eslint-disable max-classes-per-file */
|
|
8
8
|
const Menu = _ref => {
|
|
9
|
+
var _process$env;
|
|
9
10
|
let {
|
|
10
11
|
'data-testid': dataTestId,
|
|
11
12
|
isOpen,
|
|
@@ -13,9 +14,10 @@ const Menu = _ref => {
|
|
|
13
14
|
isDisabled,
|
|
14
15
|
children
|
|
15
16
|
} = _ref;
|
|
16
|
-
if (typeof process !== 'undefined' && process.env
|
|
17
|
-
|
|
18
|
-
window.
|
|
17
|
+
if (typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test' && window) {
|
|
18
|
+
var _window$ResizeObserve, _window$PointerEvent;
|
|
19
|
+
window.ResizeObserver = (_window$ResizeObserve = window.ResizeObserver) !== null && _window$ResizeObserve !== void 0 ? _window$ResizeObserve : ResizeObserver;
|
|
20
|
+
window.PointerEvent = (_window$PointerEvent = window.PointerEvent) !== null && _window$PointerEvent !== void 0 ? _window$PointerEvent : PointerEvent;
|
|
19
21
|
}
|
|
20
22
|
const [open, setOpen] = useControllableState(isOpen, onIsOpenChange, isOpen);
|
|
21
23
|
const [maskHeight, setMaskHeight] = useState(null);
|
|
@@ -33,6 +35,7 @@ const Menu = _ref => {
|
|
|
33
35
|
});
|
|
34
36
|
};
|
|
35
37
|
const openPaneDepth = useMemo(() => open ? submenus.size + 1 : 0, [submenus, open]);
|
|
38
|
+
const [searchBarConfigs, setSearchBarConfigs] = useState([]);
|
|
36
39
|
return /*#__PURE__*/React__default.createElement(MenuContextProvider, {
|
|
37
40
|
value: {
|
|
38
41
|
dataTestId,
|
|
@@ -42,11 +45,14 @@ const Menu = _ref => {
|
|
|
42
45
|
maskHeight,
|
|
43
46
|
setMaskHeight,
|
|
44
47
|
open,
|
|
45
|
-
triggerRef
|
|
48
|
+
triggerRef,
|
|
49
|
+
searchBarConfigs,
|
|
50
|
+
setSearchBarConfigs
|
|
46
51
|
}
|
|
47
52
|
}, /*#__PURE__*/React__default.createElement(Root, {
|
|
48
53
|
open: open,
|
|
49
|
-
onOpenChange: shouldOpen => setOpen(!isDisabled && shouldOpen)
|
|
54
|
+
onOpenChange: shouldOpen => setOpen(!isDisabled && shouldOpen),
|
|
55
|
+
modal: false
|
|
50
56
|
}, children));
|
|
51
57
|
};
|
|
52
58
|
|
package/dist/next/Menu/Menu2.js
CHANGED
|
@@ -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 = {"buttonContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._Ub19k{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._Ub19k>._4Ha8W{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._Ub19k>._4Ha8W:hover:not([aria-disabled=true]){background-color:#f5f5f5}._Ub19k>._4Ha8W.focus-visible,._Ub19k>._4Ha8W:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Ub19k>._4Ha8W+._JyDqK{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._Ub19k>._4Ha8W[data-state=open]+._JyDqK{transform:rotate(-180deg) translateY(50%)}._Ub19k>._4Ha8W[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._Ub19k>._4Ha8W[aria-disabled=true]+._JyDqK{fill:#515559;opacity:.4}._rWG1C>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._rWG1C>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._FgUgU{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._FgUgU._1V3KV{margin-left:30px;opacity:0}._FgUgU._3jwFU{margin-left:-30px}._6Eaw4{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._6Eaw4._96pWW{cursor:unset}._6Eaw4 ._EF6gu{fill:#32363a;margin-right:4px}._6Eaw4:focus,._6Eaw4:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._6Eaw4[aria-disabled=true]{cursor:not-allowed;opacity:.65}._6Eaw4._l5dhb{padding-right:32px}._6Eaw4._l5dhb ._JyDqK{position:absolute;height:100%;right:3px;fill:#515559}._6Eaw4._6Ukt4{pointer-events:none}._60fcN{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._60fcN._UyKRl{padding-top:49px}._ebned{z-index:1;pointer-events:none;position:fixed;left:0;top:0}._L6fLA{position:absolute;background-color:#fff;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;overflow:hidden;opacity:1;transition:opacity .35s}._L6fLA._3jwFU{opacity:0}._L6fLA._3jwFU>._4vs8I{margin-left:-30px}._L6fLA._1V3KV{opacity:0}._L6fLA._1V3KV>._4vs8I{margin-left:30px}._L6fLA>._4vs8I{transition:margin-left .35s;width:100%}._L6fLA._6Ukt4{pointer-events:none}body.keyboard-user ._6Eaw4:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
4
|
+
var styles = {"buttonContainer":"_Ub19k","button":"_4Ha8W","rightIcon":"_JyDqK","maskContainer":"_rWG1C","flyout":"_FgUgU","animatedRight":"_1V3KV","animatedLeft":"_3jwFU","menuItem":"_6Eaw4","noItems":"_96pWW","backIcon":"_EF6gu","subMenu":"_l5dhb","unresponsive":"_6Ukt4","stickyBox":"_60fcN","isSearchable":"_UyKRl","searchBoxesContainer":"_ebned","searchBox":"_L6fLA","searchInput":"_4vs8I"};
|
|
5
|
+
var stylesheet="._Ub19k{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._Ub19k>._4Ha8W{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._Ub19k>._4Ha8W:hover:not([aria-disabled=true]){background-color:#f5f5f5}._Ub19k>._4Ha8W.focus-visible,._Ub19k>._4Ha8W:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Ub19k>._4Ha8W+._JyDqK{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._Ub19k>._4Ha8W[data-state=open]+._JyDqK{transform:rotate(-180deg) translateY(50%)}._Ub19k>._4Ha8W[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._Ub19k>._4Ha8W[aria-disabled=true]+._JyDqK{fill:#515559;opacity:.4}._rWG1C>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._rWG1C>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._FgUgU{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._FgUgU._1V3KV{margin-left:30px;opacity:0}._FgUgU._3jwFU{margin-left:-30px}._6Eaw4{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._6Eaw4._96pWW{cursor:unset}._6Eaw4 ._EF6gu{fill:#32363a;margin-right:4px}._6Eaw4:focus,._6Eaw4:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._6Eaw4[aria-disabled=true]{cursor:not-allowed;opacity:.65}._6Eaw4._l5dhb{padding-right:32px}._6Eaw4._l5dhb ._JyDqK{position:absolute;height:100%;right:3px;fill:#515559}._6Eaw4._6Ukt4{pointer-events:none}._60fcN{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._60fcN._UyKRl{padding-top:49px}._ebned{z-index:1;pointer-events:none;position:fixed;left:0;top:0}._L6fLA{position:absolute;background-color:#fff;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;overflow:hidden;opacity:1;transition:opacity .35s}._L6fLA._3jwFU{opacity:0}._L6fLA._3jwFU>._4vs8I{margin-left:-30px}._L6fLA._1V3KV{opacity:0}._L6fLA._1V3KV>._4vs8I{margin-left:30px}._L6fLA>._4vs8I{transition:margin-left .35s;width:100%}._L6fLA._6Ukt4{pointer-events:none}body.keyboard-user ._6Eaw4:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -3,12 +3,12 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
|
|
|
3
3
|
import React__default, { useRef, useMemo } from 'react';
|
|
4
4
|
import { Item } from '@radix-ui/react-dropdown-menu';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
+
import { useFocusVisible } from '@react-aria/interactions';
|
|
6
7
|
import styles from './Menu2.js';
|
|
7
8
|
import { usePaneContext } from './MenuContext.js';
|
|
8
9
|
import '../../utils/index.js';
|
|
9
10
|
import { DATA_TESTID_SUFFIXES, KEYS } from './constants.js';
|
|
10
11
|
import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
|
|
11
|
-
import { getIsKeyboardUser } from '../../utils/keyboardUser/keyboardUser.js';
|
|
12
12
|
import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
|
|
13
13
|
|
|
14
14
|
const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
@@ -29,16 +29,24 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
29
29
|
isSearchFilteringDisabled,
|
|
30
30
|
isInteractive,
|
|
31
31
|
closeSubmenu,
|
|
32
|
-
flyoutRef
|
|
32
|
+
flyoutRef,
|
|
33
|
+
stickyBoxRef
|
|
33
34
|
} = usePaneContext(itemRef);
|
|
34
|
-
const
|
|
35
|
+
const {
|
|
36
|
+
isFocusVisible
|
|
37
|
+
} = useFocusVisible({
|
|
38
|
+
isTextInput: true
|
|
39
|
+
});
|
|
40
|
+
const dataTestId = getSubDataTestId(menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index));
|
|
35
41
|
const isVisible = useMemo(() => {
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
var _context;
|
|
43
|
+
const searchMatcher = label !== null && label !== void 0 ? label : typeof children === 'string' ? children : undefined;
|
|
44
|
+
return isSearchFilteringDisabled || !searchValue || (searchMatcher === null || searchMatcher === void 0 ? void 0 : _includesInstanceProperty(_context = searchMatcher.toLowerCase()).call(_context, searchValue.toLowerCase()));
|
|
38
45
|
}, [children, searchValue, label, isSearchFilteringDisabled]);
|
|
39
46
|
const handleFocus = () => {
|
|
40
|
-
if (itemRef.current && flyoutRef.current &&
|
|
41
|
-
|
|
47
|
+
if (itemRef.current && flyoutRef.current && isFocusVisible) {
|
|
48
|
+
var _stickyBoxRef$current, _stickyBoxRef$current2;
|
|
49
|
+
const stickyBoxHeight = (_stickyBoxRef$current = (_stickyBoxRef$current2 = stickyBoxRef.current) === null || _stickyBoxRef$current2 === void 0 ? void 0 : _stickyBoxRef$current2.clientHeight) !== null && _stickyBoxRef$current !== void 0 ? _stickyBoxRef$current : 0;
|
|
42
50
|
|
|
43
51
|
// if the top of the focused menu item is beneath the sticky box
|
|
44
52
|
if (itemRef.current.offsetTop < flyoutRef.current.scrollTop + stickyBoxHeight) {
|
|
@@ -56,20 +64,20 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
56
64
|
"data-testid": dataTestId,
|
|
57
65
|
ref: mergeRefs(ref, itemRef),
|
|
58
66
|
onKeyDown: e => {
|
|
59
|
-
var
|
|
67
|
+
var _context2;
|
|
60
68
|
if (!isInteractive) {
|
|
61
69
|
e.preventDefault();
|
|
62
70
|
return;
|
|
63
71
|
}
|
|
64
|
-
if (_includesInstanceProperty(
|
|
65
|
-
closeSubmenu
|
|
72
|
+
if (_includesInstanceProperty(_context2 = KEYS.CLOSE_SUBMENU).call(_context2, e.key)) {
|
|
73
|
+
closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
|
|
66
74
|
}
|
|
67
75
|
},
|
|
68
76
|
onFocus: handleFocus
|
|
69
77
|
// stop radix from closing the menu on selection of disabled item
|
|
70
78
|
// other pointer and keyboard events still work, even when disabled
|
|
71
79
|
,
|
|
72
|
-
onSelect: e => isDisabled ? e.preventDefault() : onSelect
|
|
80
|
+
onSelect: e => isDisabled ? e.preventDefault() : onSelect === null || onSelect === void 0 ? void 0 : onSelect()
|
|
73
81
|
}), (!children || typeof children === 'string') && label ? label : children) : null;
|
|
74
82
|
});
|
|
75
83
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
2
|
-
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
3
2
|
import React__default, { useState, useRef, useMemo } from 'react';
|
|
4
3
|
import { Portal, Content } from '@radix-ui/react-dropdown-menu';
|
|
5
4
|
import classNames from 'classnames';
|
|
@@ -7,17 +6,19 @@ import styles from './Menu2.js';
|
|
|
7
6
|
import { usePortalTarget } from '../../components/UIProvider/PortalTargetContext.js';
|
|
8
7
|
import { useMenuContext, PaneContextProvider } from './MenuContext.js';
|
|
9
8
|
import '../../utils/index.js';
|
|
10
|
-
import { DATA_TESTID_SUFFIXES
|
|
9
|
+
import { DATA_TESTID_SUFFIXES } from './constants.js';
|
|
11
10
|
import MenuSearch from './MenuSearch.js';
|
|
12
11
|
import usePaneSearch from './usePaneSearch.js';
|
|
13
12
|
import '../../hooks/index.js';
|
|
14
|
-
import
|
|
13
|
+
import useMutationObserver from './useMutationObserver.js';
|
|
14
|
+
import useOverlay from '../../hooks/useOverlay/useOverlay.js';
|
|
15
15
|
import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
16
|
+
import useId from '../../hooks/useId/useId.js';
|
|
17
|
+
import { useDidUpdate } from '../../hooks/useDidUpdate/useDidUpdate.js';
|
|
18
18
|
import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
|
|
19
19
|
|
|
20
20
|
const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
21
|
+
var _flyoutRef$current$pa, _flyoutRef$current2, _flyoutRef$current3;
|
|
21
22
|
let {
|
|
22
23
|
placement,
|
|
23
24
|
children,
|
|
@@ -31,31 +32,45 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
31
32
|
} = _ref;
|
|
32
33
|
const [items, setItems] = useState([]);
|
|
33
34
|
const flyoutRef = useRef(null);
|
|
34
|
-
const
|
|
35
|
-
internalSearchValue,
|
|
36
|
-
setSearchValue,
|
|
37
|
-
zeroSearchResults,
|
|
38
|
-
noMatchesText
|
|
39
|
-
} = usePaneSearch(externalSearchValue, onSearchValueChange, items);
|
|
35
|
+
const stickyBoxRef = useRef(null);
|
|
40
36
|
const portalTarget = usePortalTarget();
|
|
41
|
-
const [side, align] = useMemo(() =>
|
|
37
|
+
const [side, align] = useMemo(() => {
|
|
38
|
+
var _placement$split, _placement$split2;
|
|
39
|
+
return (_placement$split = placement === null || placement === void 0 ? void 0 : (_placement$split2 = placement.split) === null || _placement$split2 === void 0 ? void 0 : _placement$split2.call(placement, '-')) !== null && _placement$split !== void 0 ? _placement$split : [];
|
|
40
|
+
}, [placement]);
|
|
42
41
|
const {
|
|
43
42
|
dataTestId: rootDataTestId,
|
|
44
43
|
openPaneDepth,
|
|
45
44
|
setMaskHeight,
|
|
46
45
|
maskHeight,
|
|
47
46
|
open,
|
|
48
|
-
triggerRef
|
|
47
|
+
triggerRef,
|
|
48
|
+
searchBarConfigs
|
|
49
49
|
} = useMenuContext();
|
|
50
|
+
const thisPanesDepth = 1;
|
|
51
|
+
const maskContainerId = 'maskContainer';
|
|
52
|
+
useOverlay({
|
|
53
|
+
isVisible: open,
|
|
54
|
+
ignoreIds: [maskContainerId],
|
|
55
|
+
opacity: 0
|
|
56
|
+
});
|
|
57
|
+
const animatedLeft = useMemo(() => openPaneDepth > thisPanesDepth, [openPaneDepth]);
|
|
58
|
+
const dataTestId = getSubDataTestId(rootDataTestId, DATA_TESTID_SUFFIXES.MENU_PANE);
|
|
59
|
+
const {
|
|
60
|
+
internalSearchValue,
|
|
61
|
+
noSearchResultsNode,
|
|
62
|
+
onInteractOutside
|
|
63
|
+
} = usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, false, dataTestId, useId(), flyoutRef);
|
|
50
64
|
|
|
51
65
|
// In order to preseve the css animation for vertical resizing, we cannot set the height of this pane to `auto`. It must be a pixel value.
|
|
52
66
|
// We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
|
|
53
67
|
const initialHeightOfThisPane = useRef(null);
|
|
54
68
|
useDidUpdate(() => {
|
|
55
|
-
if (openPaneDepth ===
|
|
69
|
+
if (openPaneDepth === thisPanesDepth) {
|
|
56
70
|
if (initialHeightOfThisPane.current === null) {
|
|
57
71
|
window.requestAnimationFrame(() => {
|
|
58
|
-
|
|
72
|
+
var _flyoutRef$current$cl, _flyoutRef$current;
|
|
73
|
+
initialHeightOfThisPane.current = (_flyoutRef$current$cl = (_flyoutRef$current = flyoutRef.current) === null || _flyoutRef$current === void 0 ? void 0 : _flyoutRef$current.clientHeight) !== null && _flyoutRef$current$cl !== void 0 ? _flyoutRef$current$cl : null;
|
|
59
74
|
setMaskHeight(initialHeightOfThisPane.current);
|
|
60
75
|
});
|
|
61
76
|
} else {
|
|
@@ -63,19 +78,9 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
63
78
|
}
|
|
64
79
|
}
|
|
65
80
|
}, [openPaneDepth]);
|
|
66
|
-
const dataTestId = getSubDataTestId(rootDataTestId, DATA_TESTID_SUFFIXES.MENU_PANE);
|
|
67
|
-
const animatedLeft = useMemo(() => openPaneDepth > 1, [openPaneDepth]);
|
|
68
|
-
useEventListener(flyoutRef, 'keydown', e => {
|
|
69
|
-
var _context;
|
|
70
|
-
return _includesInstanceProperty(_context = Object.values(KEYS).flat()).call(_context, e.key) && setIsKeyboardUser(true);
|
|
71
|
-
}, {
|
|
72
|
-
additionalDependencies: [openPaneDepth]
|
|
73
|
-
});
|
|
74
|
-
useEventListener(flyoutRef, 'pointerenter', () => setIsKeyboardUser(false), {
|
|
75
|
-
additionalDependencies: [openPaneDepth]
|
|
76
|
-
});
|
|
77
81
|
const defaultSide = useMemo(() => {
|
|
78
|
-
|
|
82
|
+
var _triggerRef$current;
|
|
83
|
+
const rect = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getBoundingClientRect();
|
|
79
84
|
if (!rect) {
|
|
80
85
|
return 'bottom';
|
|
81
86
|
}
|
|
@@ -98,6 +103,15 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
98
103
|
}
|
|
99
104
|
return 'bottom';
|
|
100
105
|
}, [open, triggerRef]);
|
|
106
|
+
const [transform, setTransform] = useState('');
|
|
107
|
+
const target = (_flyoutRef$current$pa = (_flyoutRef$current2 = flyoutRef.current) === null || _flyoutRef$current2 === void 0 ? void 0 : _flyoutRef$current2.parentNode) !== null && _flyoutRef$current$pa !== void 0 ? _flyoutRef$current$pa : undefined;
|
|
108
|
+
useMutationObserver(target, {
|
|
109
|
+
attributes: true,
|
|
110
|
+
attributeFilter: ['style']
|
|
111
|
+
}, () => {
|
|
112
|
+
var _style$transform, _style;
|
|
113
|
+
return setTransform((_style$transform = target === null || target === void 0 ? void 0 : (_style = target.style) === null || _style === void 0 ? void 0 : _style.transform) !== null && _style$transform !== void 0 ? _style$transform : '');
|
|
114
|
+
});
|
|
101
115
|
return /*#__PURE__*/React__default.createElement(PaneContextProvider, {
|
|
102
116
|
items: items,
|
|
103
117
|
setItems: setItems,
|
|
@@ -106,35 +120,51 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
106
120
|
searchValue: internalSearchValue,
|
|
107
121
|
isSearchFilteringDisabled,
|
|
108
122
|
isInteractive: !animatedLeft,
|
|
109
|
-
flyoutRef
|
|
123
|
+
flyoutRef,
|
|
124
|
+
stickyBoxRef
|
|
110
125
|
}
|
|
111
126
|
}, /*#__PURE__*/React__default.createElement(Portal, {
|
|
112
127
|
container: portalTarget || undefined
|
|
113
128
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
114
|
-
className: styles.maskContainer
|
|
129
|
+
className: styles.maskContainer,
|
|
130
|
+
id: maskContainerId
|
|
115
131
|
}, /*#__PURE__*/React__default.createElement(Content, _extends({}, rest, {
|
|
132
|
+
onCloseAutoFocus: () => {
|
|
133
|
+
var _triggerRef$current2;
|
|
134
|
+
return triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : _triggerRef$current2.focus();
|
|
135
|
+
},
|
|
116
136
|
sideOffset: 6,
|
|
117
|
-
loop:
|
|
137
|
+
loop: !isSearchable,
|
|
118
138
|
side: side || defaultSide,
|
|
119
139
|
align: align || 'start',
|
|
120
140
|
ref: mergeRefs(ref, flyoutRef),
|
|
121
141
|
"data-testid": dataTestId,
|
|
122
142
|
className: classNames(className, {
|
|
123
|
-
[styles.animatedLeft]: animatedLeft
|
|
124
|
-
[styles.containsStickyBox]: isSearchable
|
|
143
|
+
[styles.animatedLeft]: animatedLeft
|
|
125
144
|
}, styles.flyout),
|
|
145
|
+
onInteractOutside: onInteractOutside,
|
|
126
146
|
style: {
|
|
127
147
|
...style,
|
|
128
|
-
height: internalSearchValue && openPaneDepth ===
|
|
148
|
+
height: internalSearchValue && openPaneDepth === thisPanesDepth ? undefined : maskHeight !== null && maskHeight !== void 0 ? maskHeight : undefined
|
|
129
149
|
}
|
|
130
150
|
}), isSearchable && /*#__PURE__*/React__default.createElement("div", {
|
|
131
|
-
className: styles.stickyBox
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
151
|
+
className: classNames(styles.stickyBox, styles.isSearchable),
|
|
152
|
+
ref: stickyBoxRef
|
|
153
|
+
}), noSearchResultsNode, children), /*#__PURE__*/React__default.createElement("div", {
|
|
154
|
+
className: styles.searchBoxesContainer,
|
|
155
|
+
style: {
|
|
156
|
+
transform,
|
|
157
|
+
width: (_flyoutRef$current3 = flyoutRef.current) === null || _flyoutRef$current3 === void 0 ? void 0 : _flyoutRef$current3.clientWidth
|
|
158
|
+
}
|
|
159
|
+
}, searchBarConfigs.length ? searchBarConfigs.map(_ref2 => {
|
|
160
|
+
let {
|
|
161
|
+
id,
|
|
162
|
+
...config
|
|
163
|
+
} = _ref2;
|
|
164
|
+
return /*#__PURE__*/React__default.createElement(MenuSearch, _extends({
|
|
165
|
+
key: id
|
|
166
|
+
}, config));
|
|
167
|
+
}) : null))));
|
|
138
168
|
});
|
|
139
169
|
|
|
140
170
|
export { MenuPane as default };
|
|
@@ -1,92 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React__default, { useRef, useEffect, useState } from 'react';
|
|
3
|
-
import { Item } from '@radix-ui/react-dropdown-menu';
|
|
1
|
+
import React__default from 'react';
|
|
4
2
|
import classNames from 'classnames';
|
|
5
3
|
import styles from './Menu2.js';
|
|
6
4
|
import '../Input/index.js';
|
|
7
5
|
import '../../icons/index.es.js';
|
|
8
|
-
import '../../utils/index.js';
|
|
9
|
-
import { usePaneContext } from './MenuContext.js';
|
|
10
|
-
import { DATA_TESTID_SUFFIXES, KEYS } from './constants.js';
|
|
11
|
-
import '../../hooks/index.js';
|
|
12
|
-
import useTranslation from '../../utils/Translation/useTranslation.js';
|
|
13
|
-
import useEventListener from '../../hooks/useEventListener/useEventListener.js';
|
|
14
|
-
import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
|
|
15
6
|
import Input from '../Input/Input.js';
|
|
16
7
|
import SearchIcon from '../../icons/components/SearchIcon.js';
|
|
17
8
|
|
|
18
9
|
const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
19
10
|
let {
|
|
20
|
-
setSearchValue
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const {
|
|
25
|
-
translate
|
|
26
|
-
} = useTranslation();
|
|
27
|
-
const searchText = translate('searchText');
|
|
28
|
-
const {
|
|
29
|
-
dataTestId: menuParentDataTestId,
|
|
11
|
+
setSearchValue,
|
|
12
|
+
animatedLeft,
|
|
13
|
+
animatedRight,
|
|
14
|
+
dataTestId,
|
|
30
15
|
searchValue = '',
|
|
31
|
-
isInteractive,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const dataTestId = menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH);
|
|
36
|
-
useEffect(() => () => setSearchValue(''), [setSearchValue]);
|
|
37
|
-
const [previouslyFocusedElement, setPreviouslyFocusedElement] = useState();
|
|
38
|
-
|
|
39
|
-
// hack to keep focus on search input on mouse leave
|
|
40
|
-
useEventListener(flyoutRef, 'focus', e => {
|
|
41
|
-
if (e.target === e.currentTarget && previouslyFocusedElement === itemRef.current && isInteractive) {
|
|
42
|
-
inputRef.current?.focus();
|
|
43
|
-
}
|
|
44
|
-
setPreviouslyFocusedElement(e.target);
|
|
45
|
-
}, {
|
|
46
|
-
isCaptureEvent: true
|
|
47
|
-
});
|
|
48
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Item, {
|
|
16
|
+
isInteractive = false,
|
|
17
|
+
searchPlaceholder
|
|
18
|
+
} = _ref;
|
|
19
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
49
20
|
className: classNames(styles.searchBox, {
|
|
50
|
-
[styles.unresponsive]: !isInteractive
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
,
|
|
54
|
-
|
|
55
|
-
onFocus: () => inputRef.current?.focus(),
|
|
56
|
-
role: undefined,
|
|
57
|
-
ref: mergeRefs(itemRef, ref)
|
|
21
|
+
[styles.unresponsive]: !isInteractive,
|
|
22
|
+
[styles.animatedLeft]: animatedLeft,
|
|
23
|
+
[styles.animatedRight]: animatedRight
|
|
24
|
+
}),
|
|
25
|
+
ref: ref
|
|
58
26
|
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
59
27
|
"data-testid": dataTestId,
|
|
60
28
|
role: "searchbox",
|
|
61
29
|
value: searchValue,
|
|
62
30
|
onChange: e => setSearchValue(e.target.value),
|
|
63
|
-
placeholder:
|
|
64
|
-
onKeyDown: e => {
|
|
65
|
-
var _context, _context2;
|
|
66
|
-
// stop propagation to prevent typeAhead
|
|
67
|
-
e.stopPropagation();
|
|
68
|
-
|
|
69
|
-
// allow caret movement through text entry, but close searchable submenu if on the very left
|
|
70
|
-
if (e.target?.selectionStart === 0 && _includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
|
|
71
|
-
closeSubmenu?.(e);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// forward keypress directly to `Item` to let Radix handle keyboard navigation
|
|
76
|
-
if (_includesInstanceProperty(_context2 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context2, e.key)) {
|
|
77
|
-
// `view` types are incompatible
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
|
-
const {
|
|
80
|
-
view,
|
|
81
|
-
...eventClone
|
|
82
|
-
} = e;
|
|
83
|
-
itemRef?.current?.dispatchEvent(new KeyboardEvent('keydown', eventClone));
|
|
84
|
-
}
|
|
85
|
-
},
|
|
31
|
+
placeholder: searchPlaceholder,
|
|
86
32
|
leftAddOn: /*#__PURE__*/React__default.createElement(SearchIcon, null),
|
|
87
|
-
ref: inputRef,
|
|
88
33
|
className: styles.searchInput
|
|
89
|
-
}))
|
|
34
|
+
}));
|
|
90
35
|
});
|
|
91
36
|
|
|
92
37
|
export { MenuSearch as default };
|