@qualtrics/ui-react 2.18.0 → 2.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/__shared/cjs/{index-00992312.js → index-384184bd.js} +994 -1872
- package/dist/__shared/cjs/{index-615ed9b2.js → index-4a5425cc.js} +10 -7
- package/dist/components/Accordion/Accordion.js +1 -5
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -8
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/BreakpointSwitch/Breakpoint.js +0 -2
- package/dist/components/BreakpointSwitch/BreakpointSwitch.js +0 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -7
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -2
- 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/VisualCheckbox.js +1 -1
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +9 -30
- package/dist/components/ColorPicker/ColorPicker.js +33 -42
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyout.js +2 -1
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +20 -23
- package/dist/components/ColorPicker/Hue.js +2 -19
- package/dist/components/ColorPicker/Palette.js +7 -27
- package/dist/components/ColorPicker/Saturation.js +8 -29
- package/dist/components/ColorPicker/utils/calculateTargetId.js +10 -20
- package/dist/components/ColorPicker/utils/getMousePosition.js +4 -3
- package/dist/components/ColorPicker/utils/hexToHsv.js +0 -5
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +2 -4
- package/dist/components/ColorPicker/utils/hsvToHex.js +0 -3
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +12 -19
- package/dist/components/Combobox/Combobox.js +57 -127
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +2 -4
- package/dist/components/Combobox/ComboboxInput.js +4 -5
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane.js +0 -7
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/index.js +0 -1
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +34 -30
- package/dist/components/Dropdown/Dropdown.js +17 -68
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -33
- package/dist/components/Dropdown/DropdownHeader.js +2 -1
- package/dist/components/Dropdown/DropdownList.js +8 -7
- package/dist/components/Dropdown/DropdownOption.js +3 -10
- package/dist/components/Dropdown/DropdownSearch.js +6 -24
- package/dist/components/FilePicker/FilePicker.js +15 -26
- 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 -6
- package/dist/components/FormField/ReadOnlyText.js +2 -1
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -11
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +3 -6
- package/dist/components/Icon/IconTypes.js +1 -0
- package/dist/components/IconButton/IconButton.js +1 -6
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +16 -33
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +3 -2
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -5
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/InputGroup/InputGroupProvider.js +0 -2
- 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/ConditionContainer.js +0 -2
- package/dist/components/LogicEditor/ConditionSet.js +8 -25
- package/dist/components/LogicEditor/Controls.js +2 -2
- package/dist/components/LogicEditor/LogicEditor.js +3 -12
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +9 -34
- package/dist/components/Modal/Modal.js +22 -35
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +43 -108
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -3
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +20 -32
- package/dist/components/NewMenu/parts/MenuItem.js +2 -3
- package/dist/components/NewMenu/parts/MenuSearchBox.js +2 -1
- package/dist/components/NumberStepper/NumberStepper.js +29 -44
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperIncrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperInput.js +10 -12
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +10 -6
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +8 -8
- package/dist/components/Pagination/PaginationPageInput.js +17 -22
- package/dist/components/Pagination/PaginationPreviousButton.js +8 -8
- package/dist/components/Popover/Popover.js +9 -18
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +3 -5
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +6 -23
- package/dist/components/Radio/Radio.js +11 -13
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +5 -11
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/ExpandCollapseButton.js +0 -2
- package/dist/components/SidebarNav/SidebarNav.js +5 -4
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -4
- package/dist/components/Slider/RangeSlider.js +8 -22
- package/dist/components/Slider/Slider.js +7 -26
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +7 -9
- 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/TabContextProvider.js +1 -1
- package/dist/components/Tabs/TabList.js +9 -17
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/TabPanels.js +0 -2
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +12 -41
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/PortalTargetContext.js +0 -1
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -11
- package/dist/components/deprecated_ColorPicker/Color.js +9 -66
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -8
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -7
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -10
- package/dist/components/deprecated_ColorPicker/Saturation.js +7 -14
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -6
- package/dist/components/deprecated_ColorPicker/useMouseDrag.js +0 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper.js +14 -20
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +16 -17
- package/dist/components/deprecated_Tabs/Tabs.js +9 -25
- 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 +3 -17
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +10 -26
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -18
- package/dist/hooks/useBreakpoints/useBreakpoints.js +3 -4
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -7
- package/dist/hooks/useClickOutsidePortals/useClickOutsidePortals.js +3 -6
- package/dist/hooks/useControllableState/useControllableState.js +5 -10
- package/dist/hooks/useDidUpdate/useDidUpdate.js +2 -4
- package/dist/hooks/useEventCallback/useEventCallback.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +1 -4
- package/dist/hooks/useFocusSequence/useFocusSequence.js +10 -17
- package/dist/hooks/useId/useId.js +1 -2
- package/dist/hooks/useIsFocused/useIsFocused.js +0 -1
- package/dist/hooks/useIsHovered/useIsHovered.js +0 -1
- package/dist/hooks/useIsTruncated/useIsTruncated.js +4 -3
- package/dist/hooks/useLatest/useLatest.js +0 -1
- package/dist/hooks/useMounted/useMounted.js +0 -1
- package/dist/hooks/useMouseDrag/useMouseDrag.js +0 -4
- package/dist/hooks/useOverlay/useOverlay.js +4 -10
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/usePrevious/usePrevious.js +0 -1
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +1 -4
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +11 -16
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/components/HeadsetIcon.js +6 -0
- package/dist/icons/components/PauseCircleIcon.js +1 -1
- package/dist/icons/createIconComponent.js +2 -3
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.es.js +1 -0
- package/dist/icons/index.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4 -3
- package/dist/index.js +6 -5
- package/dist/next/AdvancedTable/AdvancedTable.js +82 -188
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +4 -14
- package/dist/next/AdvancedTable/AdvancedTableCheckbox.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +11 -41
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +8 -14
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +4 -6
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -4
- package/dist/next/AdvancedTable/AdvancedTableRowExpandButton.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableTypes.js +1 -3
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +8 -13
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -20
- 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 +3 -3
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +7 -20
- package/dist/next/Combobox/ComboboxOption.js +5 -6
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +37 -54
- package/dist/next/Combobox/hooks/useComboboxLoadingState/useComboboxLoadingState.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +5 -3
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +10 -10
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +1 -6
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +6 -6
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +4 -6
- package/dist/next/Drawer/Drawer.js +5 -16
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +7 -5
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +5 -8
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +10 -23
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuContext.js +0 -2
- package/dist/next/Menu/MenuItem.js +11 -15
- package/dist/next/Menu/MenuPane.js +11 -25
- package/dist/next/Menu/MenuSearch.js +15 -22
- package/dist/next/Menu/SubMenu.js +10 -27
- package/dist/next/Menu/usePaneSearch.js +2 -1
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +12 -19
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +6 -12
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/Stack/HStack.js +11 -0
- package/dist/next/Stack/Stack.js +95 -0
- package/dist/next/Stack/StackItem.js +37 -0
- package/dist/next/Stack/VStack.js +11 -0
- package/dist/next/Stack/index.js +3 -0
- package/dist/next/TimePicker/TimeDropdown.js +4 -5
- package/dist/next/TimePicker/TimeInput.js +4 -5
- package/dist/next/TimePicker/TimePicker.js +12 -30
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +1 -3
- package/dist/next/TimePicker/utils.js +12 -52
- package/dist/next/ToggleButton/ToggleButton.js +0 -5
- package/dist/next/ToggleButton/ToggleButtonGroup.js +2 -1
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +82 -4
- package/dist/next/index.es.js +4 -0
- package/dist/next/index.js +514 -745
- package/dist/utils/Flyout/Flyout.js +4 -5
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +18 -25
- package/dist/utils/Portal/Portal.js +2 -1
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +4 -4
- package/dist/utils/Translation/Translate.js +0 -4
- package/dist/utils/Translation/TranslationProvider.js +0 -1
- package/dist/utils/Translation/containsComponentOrElement.js +1 -5
- package/dist/utils/Translation/insertPlaceholders.js +0 -1
- package/dist/utils/Translation/useTranslation.js +7 -14
- package/dist/utils/concatIds/concatIds.js +0 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/createContextUtilities/createContextUtilities.js +0 -4
- package/dist/utils/filterChildren/filterChildren.js +8 -17
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -2
- package/dist/utils/keyboardUser/keyboardUser.js +0 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -12
- package/dist/utils/mergeRefs/mergeRefs.js +1 -2
- package/dist/utils/wrapAround/wrapAround.js +1 -2
- package/dist/utils/wrapEvent/wrapEvent.js +2 -4
- package/icons/package.json +3 -2
- package/next/package.json +6 -2
- package/package.json +10 -5
|
@@ -22,7 +22,7 @@ const OverlayContainer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
22
22
|
} = _ref;
|
|
23
23
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
24
24
|
ref: ref
|
|
25
|
-
}), children, /*#__PURE__*/React__default.createElement("style", null,
|
|
25
|
+
}), children, /*#__PURE__*/React__default.createElement("style", null, `body { overflow: hidden; }`));
|
|
26
26
|
});
|
|
27
27
|
const Overlay = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
28
28
|
let {
|
|
@@ -43,35 +43,29 @@ const Overlay = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
|
43
43
|
onClose
|
|
44
44
|
} = useModalContext();
|
|
45
45
|
const mouseDownTarget = React__default.useRef();
|
|
46
|
-
|
|
47
46
|
const handleMouseDown = e => {
|
|
48
47
|
mouseDownTarget.current = e.target;
|
|
49
48
|
};
|
|
50
|
-
|
|
51
49
|
const handleClick = e => {
|
|
52
50
|
// Ensure that when a user clicks on the dialog and drags and lifts out on the overlay,
|
|
53
51
|
// the modal does not fire onDismiss.
|
|
54
52
|
if (e.target === mouseDownTarget.current && e.target === overlay.current) {
|
|
55
|
-
onDismiss
|
|
53
|
+
onDismiss?.(e);
|
|
56
54
|
}
|
|
57
55
|
};
|
|
58
|
-
|
|
59
56
|
const handleKeyDown = e => {
|
|
60
57
|
if (e.key === 'Escape') {
|
|
61
58
|
e.stopPropagation(); // prevent event from closing modals or popovers
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
59
|
+
onDismiss?.(e);
|
|
60
|
+
onClose?.(e);
|
|
65
61
|
}
|
|
66
62
|
};
|
|
67
|
-
|
|
68
63
|
const handleBodyKeyDown = e => {
|
|
69
64
|
// ignore bubbled events
|
|
70
65
|
if (e.target === e.currentTarget) {
|
|
71
66
|
handleKeyDown(e);
|
|
72
67
|
}
|
|
73
68
|
};
|
|
74
|
-
|
|
75
69
|
useEventListener(document.body, 'keydown', handleBodyKeyDown);
|
|
76
70
|
return /*#__PURE__*/React__default.createElement(ReactFocusLock, {
|
|
77
71
|
disabled: disabledFocusLock,
|
|
@@ -79,7 +73,8 @@ const Overlay = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
|
79
73
|
as: OverlayContainer,
|
|
80
74
|
className: classes,
|
|
81
75
|
ref: mergeRefs(ref, overlay),
|
|
82
|
-
lockProps: {
|
|
76
|
+
lockProps: {
|
|
77
|
+
...rest,
|
|
83
78
|
style: {
|
|
84
79
|
zIndex,
|
|
85
80
|
...style
|
|
@@ -100,32 +95,24 @@ const Dialog = /*#__PURE__*/React__default.forwardRef((_ref3, ref) => {
|
|
|
100
95
|
className,
|
|
101
96
|
...rest
|
|
102
97
|
} = _ref3;
|
|
103
|
-
|
|
104
98
|
const getMaxSizeStyles = () => {
|
|
105
99
|
if (maxSize) {
|
|
106
100
|
const prefix = 'dialog';
|
|
107
|
-
|
|
108
101
|
switch (maxSize) {
|
|
109
102
|
case 'small':
|
|
110
|
-
return
|
|
111
|
-
|
|
103
|
+
return `${prefix}Small`;
|
|
112
104
|
case 'medium':
|
|
113
|
-
return
|
|
114
|
-
|
|
105
|
+
return `${prefix}Medium`;
|
|
115
106
|
case 'large':
|
|
116
|
-
return
|
|
117
|
-
|
|
107
|
+
return `${prefix}Large`;
|
|
118
108
|
case 'xl':
|
|
119
|
-
return
|
|
120
|
-
|
|
109
|
+
return `${prefix}ExtraLarge`;
|
|
121
110
|
default:
|
|
122
111
|
return '';
|
|
123
112
|
}
|
|
124
113
|
}
|
|
125
|
-
|
|
126
114
|
return '';
|
|
127
115
|
};
|
|
128
|
-
|
|
129
116
|
const {
|
|
130
117
|
isHeightExpandedToMaxSize
|
|
131
118
|
} = useModalContext();
|
|
@@ -147,9 +134,10 @@ const Dialog = /*#__PURE__*/React__default.forwardRef((_ref3, ref) => {
|
|
|
147
134
|
onClick: onClick
|
|
148
135
|
}), children)
|
|
149
136
|
);
|
|
150
|
-
});
|
|
151
|
-
// Eventually all Modals should be responsive without a static width option
|
|
137
|
+
});
|
|
152
138
|
|
|
139
|
+
// v3 TODO: deprecate the `isResponsive` prop and set to true by default
|
|
140
|
+
// Eventually all Modals should be responsive without a static width option
|
|
153
141
|
const Modal = /*#__PURE__*/React__default.forwardRef((_ref4, ref) => {
|
|
154
142
|
let {
|
|
155
143
|
unstable_maxSize,
|
|
@@ -177,29 +165,28 @@ const Modal = /*#__PURE__*/React__default.forwardRef((_ref4, ref) => {
|
|
|
177
165
|
setIsInDOM(true);
|
|
178
166
|
setElementUsedToOpenModal(document.activeElement);
|
|
179
167
|
}
|
|
180
|
-
}, [open]);
|
|
168
|
+
}, [open]);
|
|
181
169
|
|
|
170
|
+
// This effect should only run when the Modal is added or removed from the DOM
|
|
182
171
|
useDidUpdate(() => {
|
|
183
172
|
if (isInDOM) {
|
|
184
|
-
if (elementRefToFocusOnOpen
|
|
173
|
+
if (elementRefToFocusOnOpen?.current) {
|
|
185
174
|
elementRefToFocusOnOpen.current.focus();
|
|
186
175
|
} else if (typeof onClose === 'function' && closeIconButtonRef.current) {
|
|
187
176
|
closeIconButtonRef.current.focus();
|
|
188
177
|
} else {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
(_dialogRef$current = dialogRef.current) === null || _dialogRef$current === void 0 ? void 0 : _dialogRef$current.focus();
|
|
178
|
+
dialogRef.current?.focus();
|
|
192
179
|
}
|
|
193
|
-
} else if (elementRefToFocusOnClose
|
|
180
|
+
} else if (elementRefToFocusOnClose?.current) {
|
|
194
181
|
elementRefToFocusOnClose.current.focus();
|
|
195
182
|
} else {
|
|
196
183
|
/*
|
|
197
184
|
* This replaces the `returnFocus` prop of `react-focus-lock`.
|
|
198
185
|
* The logic is done in this effect instead because `elementRefToFocusOnClose.current` is not available until after the `Overlay` is unmounted.
|
|
199
186
|
*/
|
|
200
|
-
elementUsedToOpenModal
|
|
201
|
-
}
|
|
202
|
-
|
|
187
|
+
elementUsedToOpenModal?.focus();
|
|
188
|
+
}
|
|
189
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
203
190
|
}, [isInDOM]);
|
|
204
191
|
const context = useMemo(() => ({
|
|
205
192
|
onClose,
|
|
@@ -217,7 +204,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef((_ref4, ref) => {
|
|
|
217
204
|
onDismiss: onDismiss
|
|
218
205
|
}, /*#__PURE__*/React__default.createElement(Dialog, _extends({}, rest, {
|
|
219
206
|
onAnimationEnd: e => {
|
|
220
|
-
externalOnAnimationEnd
|
|
207
|
+
externalOnAnimationEnd?.(e);
|
|
221
208
|
if (!open) setIsInDOM(false);
|
|
222
209
|
},
|
|
223
210
|
maxSize: maxSize,
|
|
@@ -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 = {"backdrop":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._MaEPG{position:fixed;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,.3);align-items:flex-start}._MaEPG,._N-Sr1{display:flex;overflow:auto}._N-Sr1{flex-direction:column;box-shadow:0 12px 35px -8px rgba(0,0,0,.12);border-radius:8px;background-color:#fff;min-width:450px;min-height:198px;max-width:85%;max-height:85%;margin:auto;outline:none}:not(._TIeEZ)._DxP3O{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._DxP3O{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}:not(._TIeEZ)._ThM7X{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._ThM7X{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}@media screen and (min-width:768px){:not(._TIeEZ)._ThM7X{max-width:700px}}:not(._TIeEZ)._WKOE4{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._WKOE4{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}@media screen and (min-width:768px){:not(._TIeEZ)._WKOE4{max-width:700px}}@media screen and (min-width:1024px){:not(._TIeEZ)._WKOE4{max-width:1000px}}:not(._TIeEZ)._ame9k{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._ame9k{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}@media screen and (min-width:768px){:not(._TIeEZ)._ame9k{max-width:700px}}@media screen and (min-width:1024px){:not(._TIeEZ)._ame9k{max-width:1000px}}@media screen and (min-width:1632px){:not(._TIeEZ)._ame9k{max-width:1600px;max-height:calc(100vh - 32px)}}._TIeEZ{min-width:200px;width:calc(100% - 48px)}._TIeEZ,._TIeEZ._DxP3O{max-height:calc(100vh - 80px)}._TIeEZ._DxP3O{max-width:480px;border-radius:8px}._TIeEZ._ThM7X{max-width:700px}._TIeEZ._WKOE4{max-width:1000px}._TIeEZ._ame9k{max-width:1600px;max-height:calc(100vh - 32px)}._w9LPr{height:calc(100vh - 80px)}@media screen and (max-width:479px){._w9LPr{height:100vh}}@media screen and (min-width:1632px){._w9LPr{height:calc(100vh - 32px)}}._CER6e{position:relative;display:flex;flex-direction:row;flex-shrink:0;min-height:65px;padding:20px 24px;align-items:center;font-size:18px;font-weight:400;line-height:24px;color:#32363a;border-bottom:1px solid #eee}._2aFD-{padding-right:64px}._FC3-W{position:absolute;top:14px;right:14px}._6320i{flex-grow:1;font-size:14px;overflow:auto;color:#32363a}._6320i,._S4q2g{padding:20px 24px}._S4q2g{display:flex;flex-direction:row;flex-shrink:0;align-items:center;justify-content:flex-end;border-top:1px solid #eee}._S4q2g>*{margin:0 4px}._S4q2g>:first-child{margin-left:0}._S4q2g>:last-child{margin-right:0}@keyframes _LnFdz{0%{opacity:0}}._LnFdz{animation:_LnFdz ease-in both;animation-duration:.2s}@keyframes _eOSQ8{to{opacity:0}}._eOSQ8{animation:_eOSQ8 ease-out both;animation-duration:.2s}@keyframes _vb8s6{0%{transform:scale3d(.7,.7,.7);opacity:0}}._vb8s6{animation:_vb8s6 both;animation-duration:.2s}@keyframes _wOj2e{to{transform:scale3d(.7,.7,.7);opacity:0}}._wOj2e{animation:_wOj2e both;animation-duration:.2s}";
|
|
4
|
+
var styles = {"backdrop":"_MaEPG","modal":"_N-Sr1","responsive":"_TIeEZ","dialogSmall":"_DxP3O","dialogMedium":"_ThM7X","dialogLarge":"_WKOE4","dialogExtraLarge":"_ame9k","growToMaxHeight":"_w9LPr","modalHeader":"_CER6e","modalHeaderWithCloseButton":"_2aFD-","modalHeaderCloseButton":"_FC3-W","modalBody":"_6320i","modalFooter":"_S4q2g","fadeEnter":"_LnFdz","fadeLeave":"_eOSQ8","zoomEnter":"_vb8s6","zoomLeave":"_wOj2e"};
|
|
5
|
+
var stylesheet="._MaEPG{position:fixed;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,.3);align-items:flex-start}._MaEPG,._N-Sr1{display:flex;overflow:auto}._N-Sr1{flex-direction:column;box-shadow:0 12px 35px -8px rgba(0,0,0,.12);border-radius:8px;background-color:#fff;min-width:450px;min-height:198px;max-width:85%;max-height:85%;margin:auto;outline:none}:not(._TIeEZ)._DxP3O{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._DxP3O{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}:not(._TIeEZ)._ThM7X{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._ThM7X{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}@media screen and (min-width:768px){:not(._TIeEZ)._ThM7X{max-width:700px}}:not(._TIeEZ)._WKOE4{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._WKOE4{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}@media screen and (min-width:768px){:not(._TIeEZ)._WKOE4{max-width:700px}}@media screen and (min-width:1024px){:not(._TIeEZ)._WKOE4{max-width:1000px}}:not(._TIeEZ)._ame9k{width:100vw;min-width:200px;max-width:none;max-height:100vh;border-radius:0}@media screen and (min-width:480px){:not(._TIeEZ)._ame9k{max-width:480px;max-height:calc(100vh - 80px);border-radius:8px}}@media screen and (min-width:768px){:not(._TIeEZ)._ame9k{max-width:700px}}@media screen and (min-width:1024px){:not(._TIeEZ)._ame9k{max-width:1000px}}@media screen and (min-width:1632px){:not(._TIeEZ)._ame9k{max-width:1600px;max-height:calc(100vh - 32px)}}._TIeEZ{min-width:200px;width:calc(100% - 48px)}._TIeEZ,._TIeEZ._DxP3O{max-height:calc(100vh - 80px)}._TIeEZ._DxP3O{max-width:480px;border-radius:8px}._TIeEZ._ThM7X{max-width:700px}._TIeEZ._WKOE4{max-width:1000px}._TIeEZ._ame9k{max-width:1600px;max-height:calc(100vh - 32px)}._w9LPr{height:calc(100vh - 80px)}@media screen and (max-width:479px){._w9LPr{height:100vh}}@media screen and (min-width:1632px){._w9LPr{height:calc(100vh - 32px)}}._CER6e{position:relative;display:flex;flex-direction:row;flex-shrink:0;min-height:65px;padding:20px 24px;align-items:center;font-size:18px;font-weight:400;line-height:24px;color:#32363a;border-bottom:1px solid #eee}._2aFD-{padding-right:64px}._FC3-W{position:absolute;top:14px;right:14px}._6320i{flex-grow:1;font-size:14px;overflow:auto;color:#32363a}._6320i,._S4q2g{padding:20px 24px}._S4q2g{display:flex;flex-direction:row;flex-shrink:0;align-items:center;justify-content:flex-end;border-top:1px solid #eee}._S4q2g>*{margin:0 4px}._S4q2g>:first-child{margin-left:0}._S4q2g>:last-child{margin-right:0}@keyframes _LnFdz{0%{opacity:0}}._LnFdz{animation:_LnFdz ease-in both;animation-duration:.2s}@keyframes _eOSQ8{to{opacity:0}}._eOSQ8{animation:_eOSQ8 ease-out both;animation-duration:.2s}@keyframes _vb8s6{0%{transform:scale3d(.7,.7,.7);opacity:0}}._vb8s6{animation:_vb8s6 both;animation-duration:.2s}@keyframes _wOj2e{to{transform:scale3d(.7,.7,.7);opacity:0}}._wOj2e{animation:_wOj2e both;animation-duration:.2s}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -26,8 +26,6 @@ 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;
|
|
30
|
-
|
|
31
29
|
let {
|
|
32
30
|
anchor: externalAnchor,
|
|
33
31
|
'aria-label': externalAriaLabel,
|
|
@@ -68,9 +66,9 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
68
66
|
private_isFirstElementHighlightedOnUserActivatedOpen = true,
|
|
69
67
|
...rest
|
|
70
68
|
} = _ref;
|
|
71
|
-
const anchorId = useId(
|
|
72
|
-
const arrowNavId =
|
|
73
|
-
const parentCloseAndFocusAnchor =
|
|
69
|
+
const anchorId = useId(externalAnchor?.props?.id ?? externalId);
|
|
70
|
+
const arrowNavId = `${anchorId}-menu`;
|
|
71
|
+
const parentCloseAndFocusAnchor = useMenuContext()?.closeAndFocusAnchor;
|
|
74
72
|
const isSubmenu = Boolean(parentCloseAndFocusAnchor);
|
|
75
73
|
const {
|
|
76
74
|
translate
|
|
@@ -81,38 +79,32 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
81
79
|
const [highlightedIndex, setHighlightedIndex] = useControllableState(-1, onHighlightedIndexChange, externalHighlightedIndex);
|
|
82
80
|
const [selectedValue, setSelectedValue] = useControllableState(defaultValue, onSelectedValueChange, externalSelectedValue);
|
|
83
81
|
const [searchTerm, setSearchTerm] = useControllableState('', externalOnSearchValueChange, externalSearchValue);
|
|
84
|
-
const [submenuHighlightedIndex, setSubmenuHighlightedIndex] = useState(-1);
|
|
82
|
+
const [submenuHighlightedIndex, setSubmenuHighlightedIndex] = useState(-1);
|
|
85
83
|
|
|
84
|
+
// These effects are needed for onIsOpenChange to work for submenus since the isOpen state is always controlled by the parent menu
|
|
86
85
|
const onIsOpenChangeRef = useLatest(onIsOpenChange);
|
|
87
|
-
const externalIsOpenRef = useLatest(externalIsOpen);
|
|
88
|
-
|
|
86
|
+
const externalIsOpenRef = useLatest(externalIsOpen);
|
|
87
|
+
// Call onIsOpenChange whenever externalIsOpen changes
|
|
89
88
|
useDidUpdate(() => {
|
|
90
89
|
if (isSubmenu) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
(_onIsOpenChangeRef$cu = onIsOpenChangeRef.current) === null || _onIsOpenChangeRef$cu === void 0 ? void 0 : _onIsOpenChangeRef$cu.call(onIsOpenChangeRef, externalIsOpen);
|
|
90
|
+
onIsOpenChangeRef.current?.(externalIsOpen);
|
|
94
91
|
}
|
|
95
|
-
}, [externalIsOpen, onIsOpenChangeRef, isSubmenu]);
|
|
96
|
-
|
|
92
|
+
}, [externalIsOpen, onIsOpenChangeRef, isSubmenu]);
|
|
93
|
+
// Call onIsOpenChange if open on mount or on unmount
|
|
97
94
|
useEffect(() => {
|
|
98
95
|
if (isSubmenu) {
|
|
99
96
|
if (externalIsOpenRef.current) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(_onIsOpenChangeRef$cu2 = onIsOpenChangeRef.current) === null || _onIsOpenChangeRef$cu2 === void 0 ? void 0 : _onIsOpenChangeRef$cu2.call(onIsOpenChangeRef, true);
|
|
97
|
+
onIsOpenChangeRef.current?.(true);
|
|
103
98
|
}
|
|
104
|
-
|
|
105
99
|
return () => {
|
|
106
100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
101
|
if (externalIsOpenRef.current) {
|
|
108
|
-
var _onIsOpenChangeRef$cu3;
|
|
109
|
-
|
|
110
102
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
-
|
|
103
|
+
onIsOpenChangeRef.current?.(false);
|
|
112
104
|
}
|
|
113
105
|
};
|
|
114
|
-
}
|
|
115
|
-
|
|
106
|
+
}
|
|
107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
108
|
}, []);
|
|
117
109
|
const closeMenu = useCallback(() => {
|
|
118
110
|
setIsOpen(false);
|
|
@@ -120,66 +112,45 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
120
112
|
setSubmenuHighlightedIndex(-1);
|
|
121
113
|
setSearchTerm('');
|
|
122
114
|
}, [setHighlightedIndex, setIsOpen, setSearchTerm]);
|
|
123
|
-
|
|
124
115
|
const handleMultiSelectChange = item => {
|
|
125
116
|
let arr = selectedValue || selectedValue === 0 ? [].concat(selectedValue) : [];
|
|
126
|
-
const i = arr.findIndex(v =>
|
|
127
|
-
var _item$props;
|
|
128
|
-
|
|
129
|
-
return v === (item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.value);
|
|
130
|
-
});
|
|
131
|
-
|
|
117
|
+
const i = arr.findIndex(v => v === item?.props?.value);
|
|
132
118
|
if (i !== -1) {
|
|
133
119
|
arr.splice(i, 1);
|
|
134
120
|
} else {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
arr = union(arr, item === null || item === void 0 ? void 0 : (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.value);
|
|
121
|
+
arr = union(arr, item?.props?.value);
|
|
138
122
|
}
|
|
139
|
-
|
|
140
123
|
setSelectedValue(arr, getLabelFromValue(children, arr), item);
|
|
141
124
|
};
|
|
142
|
-
|
|
143
125
|
const handleSubmenuOnSelectedValueChange = (value, label, item) => {
|
|
144
126
|
if (!selectable) return;
|
|
145
|
-
|
|
146
127
|
if (isMultiSelect) {
|
|
147
128
|
handleMultiSelectChange(item);
|
|
148
129
|
return;
|
|
149
130
|
}
|
|
150
|
-
|
|
151
131
|
setSelectedValue(value, getLabelFromValue(children, value), item);
|
|
152
132
|
};
|
|
153
|
-
|
|
154
133
|
const handleItemSelected = item => {
|
|
155
|
-
var _item$props3;
|
|
156
|
-
|
|
157
134
|
if (!selectable) {
|
|
158
135
|
closeAndFocusAnchor();
|
|
159
136
|
return;
|
|
160
137
|
}
|
|
161
|
-
|
|
162
|
-
const value = item === null || item === void 0 ? void 0 : (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.value;
|
|
163
|
-
|
|
138
|
+
const value = item?.props?.value;
|
|
164
139
|
if (!value && value !== 0) {
|
|
165
140
|
// eslint-disable-next-line no-console
|
|
166
141
|
console.warn('<MenuItem> should have a "value" prop when used in a <SelectMenu>', item);
|
|
167
142
|
}
|
|
168
|
-
|
|
169
143
|
if (isMultiSelect) {
|
|
170
144
|
handleMultiSelectChange(item);
|
|
171
145
|
return;
|
|
172
146
|
}
|
|
173
|
-
|
|
174
147
|
setSelectedValue(value, getLabelFromValue(children, value), item);
|
|
175
148
|
closeAndFocusAnchor();
|
|
176
149
|
};
|
|
177
|
-
|
|
178
150
|
const handleClickAway = useCallback(wrapEvent(onClickAway, closeMenu), []);
|
|
179
151
|
const preventClickOutside = useClickOutsidePortals(handleClickAway, {
|
|
180
152
|
disabled: isSubmenu
|
|
181
153
|
});
|
|
182
|
-
|
|
183
154
|
const handleAnchorClick = () => {
|
|
184
155
|
if (isOpen) {
|
|
185
156
|
setIsOpen(false);
|
|
@@ -188,16 +159,13 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
188
159
|
setHighlightedIndex(private_isFirstElementHighlightedOnUserActivatedOpen ? 0 : -1);
|
|
189
160
|
}
|
|
190
161
|
};
|
|
191
|
-
|
|
192
162
|
const handleAnchorKeyDown = e => {
|
|
193
163
|
if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {
|
|
194
164
|
e.preventDefault(); // prevent scroll
|
|
195
|
-
|
|
196
165
|
setIsOpen(true);
|
|
197
166
|
setHighlightedIndex(private_isFirstElementHighlightedOnUserActivatedOpen ? 0 : -1);
|
|
198
167
|
} else if (e.key === 'ArrowUp') {
|
|
199
168
|
e.preventDefault(); // prevent scroll
|
|
200
|
-
|
|
201
169
|
const lastIndex = React__default.Children.count(children) - (searchable ? 0 : 1);
|
|
202
170
|
setIsOpen(true);
|
|
203
171
|
setHighlightedIndex(lastIndex);
|
|
@@ -205,12 +173,9 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
205
173
|
closeMenu();
|
|
206
174
|
}
|
|
207
175
|
};
|
|
208
|
-
|
|
209
176
|
let menuItemIndex = searchable ? 1 : 0;
|
|
210
|
-
|
|
211
177
|
const generateMenuItems = () => React__default.Children.map(filterItems(isSearchFilteringDisabled ? null : searchTerm, React__default.Children.toArray(children)), child => {
|
|
212
178
|
const actualIndex = menuItemIndex;
|
|
213
|
-
|
|
214
179
|
if (isType(child, menuType)) {
|
|
215
180
|
menuItemIndex += 1;
|
|
216
181
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
@@ -224,6 +189,7 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
224
189
|
e.preventDefault(); // prevent scroll
|
|
225
190
|
}
|
|
226
191
|
},
|
|
192
|
+
|
|
227
193
|
onClick: () => {
|
|
228
194
|
setSubmenuHighlightedIndex(0);
|
|
229
195
|
},
|
|
@@ -235,14 +201,12 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
235
201
|
onSelectedValueChange: handleSubmenuOnSelectedValueChange
|
|
236
202
|
});
|
|
237
203
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
var _context, _child$props, _child$props2;
|
|
241
|
-
|
|
204
|
+
if (child?.type === MenuItem) {
|
|
205
|
+
var _context;
|
|
242
206
|
menuItemIndex += 1;
|
|
243
207
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
244
208
|
isHighlighted: actualIndex === highlightedIndex,
|
|
245
|
-
isSelected: selectable && typeof selectedValue !== 'undefined' && Array.isArray(selectedValue) ? _includesInstanceProperty(_context = selectedValue).call(_context, child
|
|
209
|
+
isSelected: selectable && typeof selectedValue !== 'undefined' && Array.isArray(selectedValue) ? _includesInstanceProperty(_context = selectedValue).call(_context, child?.props?.value) : child?.props?.value === selectedValue,
|
|
246
210
|
onSelect: wrapEvent(child.props.onSelect, () => {
|
|
247
211
|
handleItemSelected(child);
|
|
248
212
|
}),
|
|
@@ -250,25 +214,23 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
250
214
|
isSelectable: selectable
|
|
251
215
|
});
|
|
252
216
|
}
|
|
253
|
-
|
|
254
217
|
return child;
|
|
255
218
|
});
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
const menuAnchorLabel = anchorLabel !== null && anchorLabel !== void 0 ? anchorLabel : defaultLabel;
|
|
219
|
+
const anchorLabel = label ?? getLabelFromValue(children, selectedValue);
|
|
220
|
+
const menuAnchorLabel = anchorLabel ?? defaultLabel;
|
|
259
221
|
const announceToScreenReader = useScreenReaderAnnouncement('assertive');
|
|
260
|
-
const ariaLabelledBy =
|
|
261
|
-
const ariaLabel =
|
|
262
|
-
const ariaExpanded =
|
|
222
|
+
const ariaLabelledBy = externalAnchor?.props?.['aria-labelledby'] ?? (externalAriaLabelledBy ? `${externalAriaLabelledBy} ${anchorId}` : undefined);
|
|
223
|
+
const ariaLabel = externalAnchor?.props?.['aria-label'] ?? (externalAriaLabel && typeof menuAnchorLabel === 'string' ? `${externalAriaLabel} ${menuAnchorLabel}` : externalAriaLabel);
|
|
224
|
+
const ariaExpanded = externalAnchor?.props['aria-expanded'] !== undefined ? externalAnchor.props['aria-expanded'] : isOpen ? true : undefined;
|
|
263
225
|
const actualAnchor = externalAnchor !== undefined ? /*#__PURE__*/React__default.cloneElement(externalAnchor, {
|
|
264
226
|
ref: mergeRefs(ref, anchorRef, externalAnchor.ref),
|
|
265
|
-
tabIndex:
|
|
266
|
-
role:
|
|
227
|
+
tabIndex: externalAnchor.props.tabIndex ?? 0,
|
|
228
|
+
role: externalAnchor.props.role ?? 'button',
|
|
267
229
|
id: anchorId,
|
|
268
230
|
'aria-controls': isOpen ? arrowNavId : undefined,
|
|
269
231
|
'aria-expanded': ariaExpanded,
|
|
270
232
|
'aria-haspopup': 'menu',
|
|
271
|
-
'aria-disabled':
|
|
233
|
+
'aria-disabled': externalAnchor.props['aria-disabled'] ?? disabled,
|
|
272
234
|
'aria-labelledby': ariaLabelledBy,
|
|
273
235
|
'aria-label': ariaLabel,
|
|
274
236
|
onMouseDown: preventClickOutside,
|
|
@@ -312,7 +274,6 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
312
274
|
let noResults = false;
|
|
313
275
|
const listItems = menuItems || [];
|
|
314
276
|
const popperIsOpen = !disabled && isOpen;
|
|
315
|
-
|
|
316
277
|
if (!listItems.length) {
|
|
317
278
|
noResults = true;
|
|
318
279
|
listItems.push( /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -320,7 +281,6 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
320
281
|
className: classNames(styles.menuItem, styles.noMenuItems)
|
|
321
282
|
}, noMenuItemsToDisplayText));
|
|
322
283
|
}
|
|
323
|
-
|
|
324
284
|
useDidUpdate(() => {
|
|
325
285
|
if (popperIsOpen && noResults) {
|
|
326
286
|
announceToScreenReader(noMenuItemsToDisplayText);
|
|
@@ -351,17 +311,17 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
351
311
|
id: arrowNavId,
|
|
352
312
|
role: "menu",
|
|
353
313
|
"aria-labelledby": anchorId,
|
|
354
|
-
isNavItem: child =>
|
|
314
|
+
isNavItem: child => child?.type === MenuItem || child?.type === MenuSearchBox || isType(child, menuType),
|
|
355
315
|
style: {
|
|
356
316
|
zIndex,
|
|
357
|
-
maxWidth: maxFlyoutWidth
|
|
358
|
-
width: maxFlyoutWidth
|
|
317
|
+
maxWidth: maxFlyoutWidth ?? undefined,
|
|
318
|
+
width: maxFlyoutWidth ?? undefined
|
|
359
319
|
},
|
|
360
320
|
onMouseDown: preventClickOutside,
|
|
361
321
|
className: classNames(styles.contentPane, flyoutClassName),
|
|
362
322
|
highlightedIndex: highlightedIndex,
|
|
363
323
|
maxHeight: maxHeight,
|
|
364
|
-
minWidth: isSubmenu ? undefined : Math.min(350, Math.max(160, anchorRef
|
|
324
|
+
minWidth: isSubmenu ? undefined : Math.min(350, Math.max(160, anchorRef?.current?.offsetWidth)),
|
|
365
325
|
searchable: searchable,
|
|
366
326
|
onHighlightedIndexChange: i => setHighlightedIndex(i),
|
|
367
327
|
searchTerm: searchTerm,
|
|
@@ -369,7 +329,6 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
369
329
|
onKeyDown: e => {
|
|
370
330
|
if (e.key === 'Escape') {
|
|
371
331
|
e.stopPropagation(); // Prevent Escape key event from bubbling up
|
|
372
|
-
|
|
373
332
|
if (isSubmenu) {
|
|
374
333
|
// Only update the highlighted index for the current menu
|
|
375
334
|
setHighlightedIndex(-1);
|
|
@@ -381,10 +340,8 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
381
340
|
// (not menu container) so we focus anchor before browser moves focus
|
|
382
341
|
closeAndFocusAnchor();
|
|
383
342
|
} else if (e.key === 'ArrowLeft' && isSubmenu) {
|
|
384
|
-
var _arrowNavRef$current;
|
|
385
|
-
|
|
386
343
|
// 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)
|
|
387
|
-
if (
|
|
344
|
+
if (arrowNavRef.current?.contains(e.target) && e.target !== searchBoxRef.current) {
|
|
388
345
|
setHighlightedIndex(-1);
|
|
389
346
|
}
|
|
390
347
|
}
|
|
@@ -396,88 +353,66 @@ const BaseMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
396
353
|
}, listItems)
|
|
397
354
|
}));
|
|
398
355
|
});
|
|
399
|
-
|
|
400
356
|
function filterItems(valueToFilterBy, items) {
|
|
401
357
|
if (!valueToFilterBy) {
|
|
402
358
|
return items;
|
|
403
359
|
}
|
|
404
|
-
|
|
405
360
|
const result = items.filter(item => {
|
|
406
361
|
const searchTermLowerCase = valueToFilterBy.toLowerCase();
|
|
407
|
-
|
|
408
362
|
if (typeof item.props.label === 'string') {
|
|
409
363
|
var _context2;
|
|
410
|
-
|
|
411
364
|
return _includesInstanceProperty(_context2 = item.props.label.toLowerCase()).call(_context2, searchTermLowerCase);
|
|
412
365
|
}
|
|
413
|
-
|
|
414
366
|
if (typeof item.props.children === 'string') {
|
|
415
367
|
var _context3;
|
|
416
|
-
|
|
417
368
|
return _includesInstanceProperty(_context3 = item.props.children.toLowerCase()).call(_context3, searchTermLowerCase);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
369
|
+
}
|
|
370
|
+
// eslint-disable-next-line no-console
|
|
371
|
+
console.warn(`<MenuItem> not included in search results!
|
|
372
|
+
Ensure prop "children" is of type "string" or provide a "label" prop!`, item);
|
|
422
373
|
return false;
|
|
423
374
|
});
|
|
424
375
|
return result;
|
|
425
376
|
}
|
|
426
|
-
|
|
427
377
|
function getLabelFromValue(children, value) {
|
|
428
378
|
if (!value && value !== 0) return undefined;
|
|
429
|
-
|
|
430
379
|
if (Array.isArray(value)) {
|
|
431
380
|
if (value.length === 0) return undefined;
|
|
432
381
|
return [].concat(value).map(v => getLabel(getDescendent(children, v))).filter(label => label || label === 0).join(', ');
|
|
433
382
|
}
|
|
434
|
-
|
|
435
383
|
return getLabel(getDescendent(children, value));
|
|
436
|
-
}
|
|
437
|
-
|
|
384
|
+
}
|
|
438
385
|
|
|
386
|
+
// Mega-hack to make nested defaultValue prop work
|
|
439
387
|
function getDescendent(children, value) {
|
|
440
388
|
if (value === undefined) return null;
|
|
441
389
|
const childArray = React__default.Children.toArray(children);
|
|
442
|
-
|
|
443
390
|
for (let i = 0; i < childArray.length; i += 1) {
|
|
444
|
-
var _child$props3, _child$props4;
|
|
445
|
-
|
|
446
391
|
const child = childArray[i];
|
|
447
|
-
|
|
448
|
-
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) {
|
|
392
|
+
if (child?.type === MenuItem && child?.props?.value === value) {
|
|
449
393
|
return child;
|
|
450
394
|
}
|
|
451
|
-
|
|
452
|
-
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) {
|
|
395
|
+
if (child?.type !== MenuItem && child?.props?.children) {
|
|
453
396
|
const descendent = getDescendent(child.props.children, value);
|
|
454
|
-
|
|
455
397
|
if (descendent) {
|
|
456
398
|
return descendent;
|
|
457
399
|
}
|
|
458
400
|
}
|
|
459
401
|
}
|
|
460
|
-
|
|
461
402
|
return null;
|
|
462
403
|
}
|
|
463
|
-
|
|
464
404
|
function getLabel(menuOptionNode) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
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);
|
|
405
|
+
if ( /*#__PURE__*/isValidElement(menuOptionNode)) return getLabel(menuOptionNode?.props?.children);
|
|
468
406
|
return menuOptionNode;
|
|
469
407
|
}
|
|
470
|
-
|
|
471
408
|
function union(arr1, arr2) {
|
|
472
409
|
return [].concat(arr1).concat(arr2).reduce((result, current) => {
|
|
473
410
|
if (!_includesInstanceProperty(result).call(result, current)) {
|
|
474
411
|
result.push(current);
|
|
475
412
|
}
|
|
476
|
-
|
|
477
413
|
return result;
|
|
478
414
|
}, []);
|
|
479
415
|
}
|
|
480
|
-
|
|
481
416
|
function isType(element, type) {
|
|
482
417
|
return element && element.type && element.type.render === type;
|
|
483
418
|
}
|
|
@@ -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 = "._arAV1._arAV1{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}._arAV1._arAV1,._arAV1._arAV1 ._SVScW{display:inline-flex;align-items:center}._arAV1._arAV1 ._SVScW{overflow:hidden;text-overflow:ellipsis}._arAV1._arAV1._-ol1F{min-height:26px;height:26px}._arAV1._arAV1._SrYtI{color:#32363a}._arAV1._arAV1:hover:not([aria-disabled=true]){background-color:#f5f5f5}._arAV1._arAV1:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._arAV1._arAV1[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._arAV1._arAV1[aria-disabled=true]>svg{fill:#515559;opacity:.4}._arAV1._arAV1[aria-disabled=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._arAV1._arAV1._DflBK{padding-left:0}._arAV1._arAV1._3yycy{margin-top:4px}._arAV1._arAV1 ._4EOAS{fill:#515559}._arAV1._arAV1 ._4EOAS._-ol1F{top:0}._arAV1._arAV1 ._4EOAS._054so{transform:rotate(-180deg)}._lT-TW{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}._lT-TW::-webkit-scrollbar,._lT-TW::-webkit-scrollbar-thumb{visibility:hidden;width:8px;border-radius:4px}._lT-TW::-webkit-scrollbar{background-color:rgba(0,0,0,.06)}._lT-TW::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.4)}._lT-TW:hover::-webkit-scrollbar,._lT-TW:hover::-webkit-scrollbar-thumb,._lT-TW[focus-within]::-webkit-scrollbar,._lT-TW[focus-within]::-webkit-scrollbar-thumb{visibility:visible}._lT-TW:focus-within::-webkit-scrollbar,._lT-TW:focus-within::-webkit-scrollbar-thumb,._lT-TW:hover::-webkit-scrollbar,._lT-TW:hover::-webkit-scrollbar-thumb{visibility:visible}._Kimti{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word}._Kimti[aria-disabled=true]{cursor:not-allowed;color:rgba(50,54,58,.65);fill:rgba(50,54,58,.65)}._Kimti._FPVYc{background-color:#efefef}._Kimti._9832w{box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._Kimti._SrYtI{background-color:#ebf3fb;font-weight:500;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif}._Kimti._SrYtI._FPVYc{background-color:#e4effa}._Kimti._8Hede{cursor:default}._Kimti:active:not(._TZQMs):not(._SrYtI):not([aria-disabled=true]):not(._8Hede){background-color:#e8e9e9}._TZQMs{padding-right:32px}._TZQMs ._4EOAS{position:absolute;top:8px;right:3px;fill:#515559}._g1usC{padding:8px;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0;position:sticky;top:0;z-index:20;background-color:#fff}._P5QKk{position:absolute;top:13px;left:13px}._v-Oz5._v-Oz5{padding-left:32px}._nXuFH{margin:2px 12px 2px 0;flex-shrink:0}._nXuFH._s5VUF>svg{border-color:#0b6ed0}._QNW-y{display:flex;justify-self:center;margin:8px}";
|
|
4
|
+
var styles = {"menuBtn":"_arAV1","menuBtnLabel":"_SVScW","small":"_-ol1F","selected":"_SrYtI","unlabelledButton":"_DflBK","formLabelled":"_3yycy","rightIcon":"_4EOAS","open":"_054so","contentPane":"_lT-TW","menuItem":"_Kimti","active":"_FPVYc","focus":"_9832w","noMenuItems":"_8Hede","subMenu":"_TZQMs","searchBox":"_g1usC","searchBoxIcon":"_P5QKk","searchBoxInput":"_v-Oz5","checkbox":"_nXuFH","highlighted":"_s5VUF","menuSpinner":"_QNW-y"};
|
|
5
|
+
var stylesheet="._arAV1._arAV1{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}._arAV1._arAV1,._arAV1._arAV1 ._SVScW{display:inline-flex;align-items:center}._arAV1._arAV1 ._SVScW{overflow:hidden;text-overflow:ellipsis}._arAV1._arAV1._-ol1F{min-height:26px;height:26px}._arAV1._arAV1._SrYtI{color:#32363a}._arAV1._arAV1:hover:not([aria-disabled=true]){background-color:#f5f5f5}._arAV1._arAV1:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._arAV1._arAV1[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._arAV1._arAV1[aria-disabled=true]>svg{fill:#515559;opacity:.4}._arAV1._arAV1[aria-disabled=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._arAV1._arAV1._DflBK{padding-left:0}._arAV1._arAV1._3yycy{margin-top:4px}._arAV1._arAV1 ._4EOAS{fill:#515559}._arAV1._arAV1 ._4EOAS._-ol1F{top:0}._arAV1._arAV1 ._4EOAS._054so{transform:rotate(-180deg)}._lT-TW{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}._lT-TW::-webkit-scrollbar,._lT-TW::-webkit-scrollbar-thumb{visibility:hidden;width:8px;border-radius:4px}._lT-TW::-webkit-scrollbar{background-color:rgba(0,0,0,.06)}._lT-TW::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.4)}._lT-TW:hover::-webkit-scrollbar,._lT-TW:hover::-webkit-scrollbar-thumb,._lT-TW[focus-within]::-webkit-scrollbar,._lT-TW[focus-within]::-webkit-scrollbar-thumb{visibility:visible}._lT-TW:focus-within::-webkit-scrollbar,._lT-TW:focus-within::-webkit-scrollbar-thumb,._lT-TW:hover::-webkit-scrollbar,._lT-TW:hover::-webkit-scrollbar-thumb{visibility:visible}._Kimti{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word}._Kimti[aria-disabled=true]{cursor:not-allowed;color:rgba(50,54,58,.65);fill:rgba(50,54,58,.65)}._Kimti._FPVYc{background-color:#efefef}._Kimti._9832w{box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._Kimti._SrYtI{background-color:#ebf3fb;font-weight:500;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif}._Kimti._SrYtI._FPVYc{background-color:#e4effa}._Kimti._8Hede{cursor:default}._Kimti:active:not(._TZQMs):not(._SrYtI):not([aria-disabled=true]):not(._8Hede){background-color:#e8e9e9}._TZQMs{padding-right:32px}._TZQMs ._4EOAS{position:absolute;top:8px;right:3px;fill:#515559}._g1usC{padding:8px;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0;position:sticky;top:0;z-index:20;background-color:#fff}._P5QKk{position:absolute;top:13px;left:13px}._v-Oz5._v-Oz5{padding-left:32px}._nXuFH{margin:2px 12px 2px 0;flex-shrink:0}._nXuFH._s5VUF>svg{border-color:#0b6ed0}._QNW-y{display:flex;justify-self:center;margin:8px}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|