@sentry/scraps 0.5.0 → 0.6.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/README.md +68 -3
- package/dist/badge/tag.js +4 -2
- package/dist/button/button.js +1 -0
- package/dist/button/linkButton.js +1 -0
- package/dist/button/styles.js +157 -152
- package/dist/codeBlock/codeBlock.js +1 -0
- package/dist/compactSelect/control.js +3 -2
- package/dist/compactSelect/utils.js +2 -6
- package/dist/dateTime/config.d.ts +23 -0
- package/dist/dateTime/config.js +50 -0
- package/dist/dateTime/context.d.ts +18 -0
- package/dist/dateTime/context.js +46 -0
- package/dist/dateTime/dateTime.d.ts +6 -0
- package/dist/dateTime/dateTime.js +30 -0
- package/dist/dateTime/format.d.ts +24 -0
- package/dist/dateTime/format.js +45 -0
- package/dist/dateTime/index.d.ts +6 -0
- package/dist/dateTime/index.js +6 -0
- package/dist/dateTime/intlFormatter.d.ts +9 -0
- package/dist/dateTime/intlFormatter.js +16 -0
- package/dist/dateTime/parseDate.d.ts +3 -0
- package/dist/dateTime/parseDate.js +12 -0
- package/dist/dropdownMenu/context.d.ts +28 -13
- package/dist/dropdownMenu/dropdownMenu.d.ts +2 -2
- package/dist/dropdownMenu/dropdownMenu.js +9 -3
- package/dist/dropdownMenu/item.d.ts +6 -2
- package/dist/dropdownMenu/item.js +31 -71
- package/dist/dropdownMenu/list.d.ts +31 -5
- package/dist/dropdownMenu/list.js +143 -124
- package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +5 -241
- package/dist/dropdownMenu/useDropdownMenuKeyboard.js +5 -29
- package/dist/dropdownMenu/useDropdownRootMenuState.d.ts +13 -0
- package/dist/dropdownMenu/useDropdownRootMenuState.js +30 -0
- package/dist/dropdownMenu/useDropdownSubmenuState.d.ts +19 -0
- package/dist/dropdownMenu/useDropdownSubmenuState.js +25 -0
- package/dist/dropdownMenu/utils.js +5 -7
- package/dist/duration/formatElapsedDuration.d.ts +4 -0
- package/dist/duration/formatElapsedDuration.js +10 -0
- package/dist/duration/getDuration.d.ts +68 -0
- package/dist/duration/getDuration.js +80 -0
- package/dist/duration/index.d.ts +2 -0
- package/dist/duration/index.js +2 -0
- package/dist/{compactSelect/fzf.d.ts → fzf.d.ts} +1 -0
- package/dist/{compactSelect/fzf.js → fzf.js} +5 -1
- package/dist/layout/container.d.ts +8 -2
- package/dist/layout/container.js +2 -2
- package/dist/layout/styles.d.ts +2 -1
- package/dist/layout/styles.js +11 -5
- package/dist/legacyDatetime.d.ts +21 -0
- package/dist/legacyDatetime.js +13 -0
- package/dist/link/index.d.ts +1 -1
- package/dist/link/index.js +1 -1
- package/dist/link/linkBehaviorContext.d.ts +9 -0
- package/dist/link/linkBehaviorContext.js +37 -7
- package/dist/menu/menu.d.ts +1 -3
- package/dist/menu/menu.js +4 -5
- package/dist/relativeTime/getRelativeDate.d.ts +14 -0
- package/dist/relativeTime/getRelativeDate.js +107 -0
- package/dist/relativeTime/index.d.ts +3 -0
- package/dist/relativeTime/index.js +3 -0
- package/dist/relativeTime/relativeTime.d.ts +55 -0
- package/dist/relativeTime/relativeTime.js +102 -0
- package/dist/relativeTime/useRelativeTimeFormatter.d.ts +2 -0
- package/dist/relativeTime/useRelativeTimeFormatter.js +10 -0
- package/dist/tabs/context.d.ts +9 -0
- package/dist/tabs/context.js +9 -0
- package/dist/tabs/index.d.ts +2 -4
- package/dist/tabs/index.js +1 -3
- package/dist/tabs/item.d.ts +16 -5
- package/dist/tabs/tab.js +6 -3
- package/dist/tabs/tabList.d.ts +5 -5
- package/dist/tabs/tabList.js +8 -6
- package/dist/tabs/tabPanels.d.ts +2 -3
- package/dist/tabs/tabPanels.js +1 -1
- package/dist/tabs/tabs.d.ts +46 -31
- package/dist/tabs/tabs.js +38 -35
- package/dist/text/prose.d.ts +2 -2
- package/dist/theme/theme.d.ts +34 -34
- package/dist/theme/theme.js +9 -0
- package/dist/theme/types.d.ts +20 -2
- package/dist/translation/index.d.ts +1 -0
- package/dist/translation/index.js +1 -0
- package/dist/translation/translate.d.ts +9 -0
- package/dist/translation/translate.js +5 -0
- package/dist/translation/translationContext.d.ts +2 -1
- package/dist/translation/translationContext.js +2 -1
- package/fonts/OFL.txt +94 -0
- package/fonts/roboto-mono-variable-cyrillic-ext.woff2 +0 -0
- package/fonts/roboto-mono-variable-cyrillic.woff2 +0 -0
- package/fonts/roboto-mono-variable-greek.woff2 +0 -0
- package/fonts/roboto-mono-variable-latin-ext.woff2 +0 -0
- package/fonts/roboto-mono-variable-vietnamese.woff2 +0 -0
- package/fonts/roboto-mono-variable.woff2 +0 -0
- package/fonts/rubik-variable-cyrillic-ext.woff2 +0 -0
- package/fonts/rubik-variable-cyrillic.woff2 +0 -0
- package/fonts/rubik-variable-latin-ext.woff2 +0 -0
- package/fonts/rubik-variable.woff2 +0 -0
- package/fonts.css +211 -0
- package/package.json +30 -12
- package/dist/datetime.d.ts +0 -39
- package/dist/datetime.js +0 -20
- package/dist/dropdownMenu/useSafetyTriangle.d.ts +0 -12
- package/dist/dropdownMenu/useSafetyTriangle.js +0 -119
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { createElement, css, useTheme } from "@emotion/react";
|
|
3
|
-
import { memo,
|
|
3
|
+
import { memo, useContext, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
4
5
|
import styled from "@emotion/styled";
|
|
5
6
|
import { FocusScope } from "@react-aria/focus";
|
|
6
|
-
import { useMenu,
|
|
7
|
+
import { useMenu, useSubmenuTrigger } from "@react-aria/menu";
|
|
7
8
|
import { useSeparator } from "@react-aria/separator";
|
|
8
9
|
import { Item, Section } from "@react-stately/collections";
|
|
9
10
|
import { useTreeState } from "@react-stately/tree";
|
|
@@ -22,7 +23,7 @@ import { DropdownMenuSection } from "./section.js";
|
|
|
22
23
|
import { DropdownMenuSeparator } from "./separator.js";
|
|
23
24
|
import { useDropdownMenuKeyboard } from "./useDropdownMenuKeyboard.js";
|
|
24
25
|
import { useDropdownMenuRowLayout } from "./useDropdownMenuRowLayout.js";
|
|
25
|
-
import {
|
|
26
|
+
import { useDropdownSubmenuState } from "./useDropdownSubmenuState.js";
|
|
26
27
|
import { countMenuItems, filterMenuItems, getDisabledKeys, isMenuSection, removeHiddenItemsAndSetHref } from "./utils.js";
|
|
27
28
|
const list_DropdownMenuCollectionItem = /*#__PURE__*/ memo(function({ node, isVirtualized, rowIndex, rowRef, closeOnSelect, disableTextSelection, onClose, size, state }) {
|
|
28
29
|
const rowProps = void 0 === rowIndex || void 0 === rowRef ? void 0 : {
|
|
@@ -97,11 +98,13 @@ function DropdownMenuRows({ collection, separatorProps, isWidthLocked, menuRef,
|
|
|
97
98
|
})
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
|
-
function DropdownMenuList({ closeOnSelect = true, onClose, size, menuTitle, emptyMessage, maxHeight, maxWidth, menuFooter, searchState, disableTextSelection,
|
|
101
|
+
function DropdownMenuList({ closeOnSelect = true, onClose, size, menuTitle, emptyMessage, maxHeight, maxWidth, menuFooter, searchState, disableTextSelection, overlayPositionProps, zIndex, isVirtualized: virtualized = false, isDismissable, virtualizeThreshold, menuLevel, autoFocus, ...props }) {
|
|
101
102
|
const { t } = useTranslation();
|
|
102
103
|
const theme = useTheme();
|
|
103
|
-
const
|
|
104
|
-
const
|
|
104
|
+
const context = useContext(DropdownMenuContext);
|
|
105
|
+
const isRootMenu = 'root' === menuLevel.type;
|
|
106
|
+
const rootMenuState = isRootMenu ? menuLevel.state : context.rootMenuState;
|
|
107
|
+
const submenuLevel = isRootMenu ? 0 : menuLevel.level + 1;
|
|
105
108
|
const state = useTreeState({
|
|
106
109
|
...props,
|
|
107
110
|
selectionMode: 'single'
|
|
@@ -122,10 +125,12 @@ function DropdownMenuList({ closeOnSelect = true, onClose, size, menuTitle, empt
|
|
|
122
125
|
state.disabledKeys
|
|
123
126
|
]);
|
|
124
127
|
const hasLeadingItems = items.some((node)=>node.value?.leadingItems || node.value?.isSelected !== void 0);
|
|
125
|
-
const
|
|
128
|
+
const ownMenuRef = useRef(null);
|
|
129
|
+
const menuRef = isRootMenu ? ownMenuRef : menuLevel.ref;
|
|
126
130
|
const searchRef = useRef(null);
|
|
127
131
|
const { menuProps } = useMenu({
|
|
128
132
|
...props,
|
|
133
|
+
autoFocus: searchState ? false : autoFocus,
|
|
129
134
|
selectionMode: 'single'
|
|
130
135
|
}, state, menuRef);
|
|
131
136
|
const { separatorProps } = useSeparator({
|
|
@@ -136,25 +141,28 @@ function DropdownMenuList({ closeOnSelect = true, onClose, size, menuTitle, empt
|
|
|
136
141
|
virtualized
|
|
137
142
|
]);
|
|
138
143
|
const [lockedWidth, setLockedWidth] = useState();
|
|
139
|
-
const { focusItem,
|
|
144
|
+
const { focusItem, menuProps: keyboardMenuProps } = useDropdownMenuKeyboard({
|
|
140
145
|
focusableKeys,
|
|
141
146
|
menuProps,
|
|
142
147
|
menuRef,
|
|
143
|
-
parentMenuState,
|
|
144
148
|
searchRef,
|
|
145
|
-
state
|
|
146
|
-
stateCollection
|
|
149
|
+
state
|
|
147
150
|
});
|
|
151
|
+
const [ownPortalContainer, setOwnPortalContainer] = useState(null);
|
|
152
|
+
const portalContainer = isRootMenu ? ownPortalContainer : context.portalContainer;
|
|
148
153
|
const contextValue = useMemo(()=>({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
rootMenuState,
|
|
155
|
+
parentMenuRef: menuRef,
|
|
156
|
+
portalContainer,
|
|
157
|
+
submenuLevel,
|
|
158
|
+
isDismissable,
|
|
152
159
|
virtualizeThreshold
|
|
153
160
|
}), [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
rootMenuState,
|
|
162
|
+
menuRef,
|
|
163
|
+
portalContainer,
|
|
164
|
+
submenuLevel,
|
|
165
|
+
isDismissable,
|
|
158
166
|
virtualizeThreshold
|
|
159
167
|
]);
|
|
160
168
|
const searchInput = searchState && /*#__PURE__*/ jsx(DropdownMenuSearch, {
|
|
@@ -176,7 +184,7 @@ function DropdownMenuList({ closeOnSelect = true, onClose, size, menuTitle, empt
|
|
|
176
184
|
const positionedMaxWidth = void 0 === maxWidth ? overlayPositionProps.style?.maxWidth : `min(${'number' == typeof maxWidth ? `${maxWidth}px` : maxWidth}, ${availableMaxWidth})`;
|
|
177
185
|
return /*#__PURE__*/ jsx(FocusScope, {
|
|
178
186
|
restoreFocus: true,
|
|
179
|
-
autoFocus:
|
|
187
|
+
autoFocus: isRootMenu || Boolean(autoFocus) || Boolean(searchState),
|
|
180
188
|
children: /*#__PURE__*/ jsx(PositionWrapper, {
|
|
181
189
|
zIndex: void 0 === zIndex ? theme.zIndex.dropdown : Number(zIndex),
|
|
182
190
|
...overlayPositionProps,
|
|
@@ -184,86 +192,92 @@ function DropdownMenuList({ closeOnSelect = true, onClose, size, menuTitle, empt
|
|
|
184
192
|
...overlayPositionProps.style,
|
|
185
193
|
maxWidth: positionedMaxWidth
|
|
186
194
|
},
|
|
187
|
-
children: /*#__PURE__*/
|
|
195
|
+
children: /*#__PURE__*/ jsxs(DropdownMenuContext, {
|
|
188
196
|
value: contextValue,
|
|
189
|
-
children:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
event.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
197
|
+
children: [
|
|
198
|
+
/*#__PURE__*/ jsx(Stack, {
|
|
199
|
+
children: (stackProps)=>/*#__PURE__*/ jsxs(Overlay, {
|
|
200
|
+
...stackProps,
|
|
201
|
+
onKeyDownCapture: (event)=>{
|
|
202
|
+
if ('Escape' === event.key && 'submenu' === menuLevel.type && event.currentTarget.contains(event.target)) {
|
|
203
|
+
event.stopPropagation();
|
|
204
|
+
if (event.nativeEvent.isComposing) return;
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
menuLevel.close();
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
style: {
|
|
210
|
+
maxHeight: calculateMenuMinHeight(maxHeight, overlayPositionProps.style?.maxHeight),
|
|
211
|
+
maxWidth: void 0 === maxWidth ? '100%' : `min(${'number' == typeof maxWidth ? `${maxWidth}px` : maxWidth}, 100%)`
|
|
212
|
+
},
|
|
213
|
+
children: [
|
|
214
|
+
menuTitle && /*#__PURE__*/ jsxs(Header, {
|
|
215
|
+
padding: searchState ? 'xs' : 'sm lg',
|
|
216
|
+
children: [
|
|
217
|
+
/*#__PURE__*/ jsx(Title, {
|
|
218
|
+
padding: searchState ? 'sm lg' : void 0,
|
|
219
|
+
children: menuTitle
|
|
220
|
+
}),
|
|
221
|
+
searchInput
|
|
222
|
+
]
|
|
223
|
+
}),
|
|
224
|
+
!menuTitle && searchInput,
|
|
225
|
+
/*#__PURE__*/ jsxs(DropdownMenuListWrap, {
|
|
226
|
+
as: "ul",
|
|
227
|
+
ref: menuRef,
|
|
228
|
+
disableTextSelection: disableTextSelection,
|
|
229
|
+
flexGrow: showEmptyMessage ? 1 : void 0,
|
|
230
|
+
width: void 0 === lockedWidth ? void 0 : `${lockedWidth}px`,
|
|
231
|
+
maxWidth: void 0 === lockedWidth ? void 0 : '100%',
|
|
232
|
+
...keyboardMenuProps,
|
|
233
|
+
children: [
|
|
234
|
+
/*#__PURE__*/ jsx(ReserveLeadingSlot, {
|
|
235
|
+
reserve: hasLeadingItems,
|
|
236
|
+
children: /*#__PURE__*/ jsx(DropdownMenuRows, {
|
|
237
|
+
collection: stateCollection,
|
|
238
|
+
isWidthLocked: void 0 !== lockedWidth,
|
|
239
|
+
menuRef: menuRef,
|
|
240
|
+
onLockWidth: setLockedWidth,
|
|
241
|
+
virtualized: virtualized,
|
|
242
|
+
widestKey: widestKey,
|
|
243
|
+
closeOnSelect: closeOnSelect,
|
|
244
|
+
disableTextSelection: disableTextSelection,
|
|
245
|
+
onClose: onClose,
|
|
246
|
+
separatorProps: separatorProps,
|
|
247
|
+
size: size,
|
|
248
|
+
state: state
|
|
249
|
+
})
|
|
250
|
+
}),
|
|
251
|
+
showEmptyMessage && /*#__PURE__*/ jsx(Stack, {
|
|
252
|
+
as: "li",
|
|
253
|
+
role: "presentation",
|
|
254
|
+
align: "center",
|
|
255
|
+
justify: "center",
|
|
256
|
+
flexGrow: 1,
|
|
257
|
+
padding: "md lg",
|
|
258
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
259
|
+
variant: "muted",
|
|
260
|
+
children: emptyMessage ?? t('No results found')
|
|
261
|
+
})
|
|
252
262
|
})
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
263
|
+
]
|
|
264
|
+
}),
|
|
265
|
+
menuFooter
|
|
266
|
+
]
|
|
267
|
+
})
|
|
268
|
+
}),
|
|
269
|
+
isRootMenu && /*#__PURE__*/ jsx(Container, {
|
|
270
|
+
display: "contents",
|
|
271
|
+
ref: setOwnPortalContainer
|
|
272
|
+
})
|
|
273
|
+
]
|
|
260
274
|
})
|
|
261
275
|
})
|
|
262
276
|
});
|
|
263
277
|
}
|
|
264
|
-
function DropdownMenuContent({ items, disabledKeys, size, search, virtualizeThreshold, ...props }) {
|
|
278
|
+
function DropdownMenuContent({ items, disabledKeys, size, search, isDismissable, virtualizeThreshold, ...props }) {
|
|
265
279
|
const [searchValue, setSearchValue] = useState('');
|
|
266
|
-
const { virtualizeThreshold: inheritedVirtualizeThreshold } = useContext(DropdownMenuContext);
|
|
280
|
+
const { isDismissable: inheritedIsDismissable, virtualizeThreshold: inheritedVirtualizeThreshold } = useContext(DropdownMenuContext);
|
|
267
281
|
const resolveHref = useResolveLinkHref();
|
|
268
282
|
const activeItems = useMemo(()=>removeHiddenItemsAndSetHref(items, resolveHref), [
|
|
269
283
|
items,
|
|
@@ -288,6 +302,7 @@ function DropdownMenuContent({ items, disabledKeys, size, search, virtualizeThre
|
|
|
288
302
|
disabledKeys: disabledKeys ?? defaultDisabledKeys,
|
|
289
303
|
items: visibleItems,
|
|
290
304
|
isVirtualized: isVirtualized,
|
|
305
|
+
isDismissable: isDismissable ?? inheritedIsDismissable,
|
|
291
306
|
virtualizeThreshold: resolvedVirtualizeThreshold,
|
|
292
307
|
searchState: search ? {
|
|
293
308
|
...search,
|
|
@@ -317,14 +332,24 @@ function DropdownMenuContent({ items, disabledKeys, size, search, virtualizeThre
|
|
|
317
332
|
});
|
|
318
333
|
}
|
|
319
334
|
function DropdownSubmenu({ items, node, isVirtualized, rowProps, state, closeOnSelect, disableTextSelection, onClose, size }) {
|
|
320
|
-
const {
|
|
335
|
+
const { rootMenuState, parentMenuRef, portalContainer, submenuLevel, isDismissable } = useContext(DropdownMenuContext);
|
|
336
|
+
if (!rootMenuState || !parentMenuRef || void 0 === submenuLevel) throw new Error('DropdownSubmenu must be rendered inside a DropdownMenu');
|
|
321
337
|
const submenu = node.value?.submenu;
|
|
322
338
|
const options = 'object' == typeof submenu ? submenu : {};
|
|
323
|
-
const isDisabled = state.disabledKeys.has(node.key)
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
339
|
+
const isDisabled = state.disabledKeys.has(node.key);
|
|
340
|
+
const submenuState = useDropdownSubmenuState({
|
|
341
|
+
level: submenuLevel,
|
|
342
|
+
rootMenuState,
|
|
343
|
+
triggerKey: node.key
|
|
344
|
+
});
|
|
345
|
+
const submenuRef = useRef(null);
|
|
346
|
+
const { isOpen, triggerRef, triggerProps: { ref: setTriggerElement }, overlayProps } = useOverlay({
|
|
347
|
+
isOpen: submenuState.isOpen,
|
|
348
|
+
onClose: rootMenuState.close,
|
|
349
|
+
isDismissable,
|
|
327
350
|
disableTrigger: isDisabled,
|
|
351
|
+
isKeyboardDismissDisabled: true,
|
|
352
|
+
shouldCloseOnInteractOutside: (target)=>!portalContainer?.parentElement?.contains(target),
|
|
328
353
|
position: options.position ?? 'right-start',
|
|
329
354
|
offset: -4,
|
|
330
355
|
preventOverflowOptions: {
|
|
@@ -332,34 +357,21 @@ function DropdownSubmenu({ items, node, isVirtualized, rowProps, state, closeOnS
|
|
|
332
357
|
crossAxis: true
|
|
333
358
|
}
|
|
334
359
|
});
|
|
335
|
-
const {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const isFocused = state.selectionManager.focusedKey === node.key;
|
|
360
|
+
const { submenuTriggerProps, submenuProps } = useSubmenuTrigger({
|
|
361
|
+
parentMenuRef,
|
|
362
|
+
submenuRef,
|
|
363
|
+
isDisabled,
|
|
364
|
+
type: 'menu'
|
|
365
|
+
}, submenuState, triggerRef);
|
|
366
|
+
const { submenuLevel: _submenuLevel, onClose: _closeAll, ...submenuMenuProps } = submenuProps;
|
|
343
367
|
return /*#__PURE__*/ jsxs(Container, {
|
|
344
368
|
as: "li",
|
|
345
369
|
display: "contents",
|
|
346
370
|
role: "presentation",
|
|
347
371
|
children: [
|
|
348
372
|
/*#__PURE__*/ jsx(DropdownMenuItem, {
|
|
349
|
-
menuItemRef:
|
|
350
|
-
|
|
351
|
-
if (element && !isOpen && isFocused && rootOverlayState?.isOpen) element.focus();
|
|
352
|
-
}, [
|
|
353
|
-
isOpen,
|
|
354
|
-
isFocused,
|
|
355
|
-
rootOverlayState,
|
|
356
|
-
setTriggerElement
|
|
357
|
-
]),
|
|
358
|
-
id: menuTriggerProps.id,
|
|
359
|
-
"aria-haspopup": menuTriggerProps['aria-haspopup'],
|
|
360
|
-
"aria-expanded": isOpen,
|
|
361
|
-
"aria-controls": menuTriggerProps['aria-controls'],
|
|
362
|
-
submenuRef: isOpen ? overlayRef : void 0,
|
|
373
|
+
menuItemRef: setTriggerElement,
|
|
374
|
+
submenuTriggerProps: submenuTriggerProps,
|
|
363
375
|
renderAs: "div",
|
|
364
376
|
node: node,
|
|
365
377
|
isVirtualized: isVirtualized,
|
|
@@ -367,7 +379,7 @@ function DropdownSubmenu({ items, node, isVirtualized, rowProps, state, closeOnS
|
|
|
367
379
|
state: state,
|
|
368
380
|
closeOnSelect: false
|
|
369
381
|
}),
|
|
370
|
-
isOpen && /*#__PURE__*/ jsx(DropdownMenuContent, {
|
|
382
|
+
isOpen && portalContainer && /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(DropdownMenuContent, {
|
|
371
383
|
onClose: onClose,
|
|
372
384
|
closeOnSelect: closeOnSelect,
|
|
373
385
|
disableTextSelection: disableTextSelection,
|
|
@@ -377,12 +389,19 @@ function DropdownSubmenu({ items, node, isVirtualized, rowProps, state, closeOnS
|
|
|
377
389
|
maxWidth: options.maxWidth,
|
|
378
390
|
search: options.search,
|
|
379
391
|
size: size,
|
|
380
|
-
...
|
|
392
|
+
...submenuMenuProps,
|
|
393
|
+
menuLevel: {
|
|
394
|
+
type: 'submenu',
|
|
395
|
+
level: submenuLevel,
|
|
396
|
+
ref: submenuRef,
|
|
397
|
+
close: ()=>{
|
|
398
|
+
submenuState.close();
|
|
399
|
+
triggerRef.current?.focus();
|
|
400
|
+
}
|
|
401
|
+
},
|
|
381
402
|
items: items,
|
|
382
|
-
autoFocus: false,
|
|
383
|
-
overlayState: overlayState,
|
|
384
403
|
overlayPositionProps: overlayProps
|
|
385
|
-
})
|
|
404
|
+
}), portalContainer)
|
|
386
405
|
]
|
|
387
406
|
});
|
|
388
407
|
}
|