@homebound/beam 2.276.1 → 2.277.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.
|
@@ -5,13 +5,16 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_aria_1 = require("react-aria");
|
|
7
7
|
const react_router_1 = require("react-router");
|
|
8
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
9
8
|
const Avatar_1 = require("../Avatar");
|
|
10
9
|
const Icon_1 = require("../Icon");
|
|
11
10
|
const Tooltip_1 = require("../Tooltip");
|
|
12
11
|
const Css_1 = require("../../Css");
|
|
13
12
|
const utils_1 = require("../../utils");
|
|
14
13
|
const defaultTestId_1 = require("../../utils/defaultTestId");
|
|
14
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
15
|
+
// Note: Respect Ctrl-clicking pop-up elements to open a link in a new tab on a menu item
|
|
16
|
+
// See https://github.com/adobe/react-spectrum/issues/1244#issuecomment-1125813249
|
|
17
|
+
const noopWorkaround = () => { };
|
|
15
18
|
function MenuItemImpl(props) {
|
|
16
19
|
const { item, state, onClose, contrast } = props;
|
|
17
20
|
const menuItem = item.value;
|
|
@@ -57,7 +60,7 @@ function MenuItemImpl(props) {
|
|
|
57
60
|
...(isDisabled ? Css_1.Css.gray500.cursorNotAllowed.$ : {}),
|
|
58
61
|
...(destructive ? Css_1.Css.red600.$ : {}),
|
|
59
62
|
...(isSelected ? Css_1.Css.fw5.$ : {}),
|
|
60
|
-
}, ...tid[(0, defaultTestId_1.defaultTestId)(menuItem.label)], children: (0, Tooltip_1.maybeTooltip)({
|
|
63
|
+
}, ...tid[(0, defaultTestId_1.defaultTestId)(menuItem.label)], onPointerUp: noopWorkaround, onKeyDown: noopWorkaround, children: (0, Tooltip_1.maybeTooltip)({
|
|
61
64
|
title: (0, Tooltip_1.resolveTooltip)(disabled),
|
|
62
65
|
placement: "right",
|
|
63
66
|
children: renderMenuItem(menuItem, isSelected, isDisabled, contrast),
|
|
@@ -85,7 +88,7 @@ function maybeWrapInLink(onClick, content, disabled) {
|
|
|
85
88
|
if (disabled || typeof onClick !== "string") {
|
|
86
89
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: content });
|
|
87
90
|
}
|
|
88
|
-
return (0, utils_1.isAbsoluteUrl)(onClick) ? ((0, jsx_runtime_1.jsxs)("a", { href: onClick, target: "_blank", rel: "noopener noreferrer", className: "navLink", css: Css_1.Css.df.aic.jcsb.w100.$, children: [content, (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.ml2.$, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "linkExternal" }) })] })) : ((0, jsx_runtime_1.jsx)(react_router_dom_1.
|
|
91
|
+
return (0, utils_1.isAbsoluteUrl)(onClick) ? ((0, jsx_runtime_1.jsxs)("a", { href: onClick, target: "_blank", rel: "noopener noreferrer", className: "navLink", css: Css_1.Css.df.aic.jcsb.w100.$, children: [content, (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.ml2.$, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "linkExternal" }) })] })) : ((0, jsx_runtime_1.jsx)(react_router_dom_1.Link, { className: "navLink", to: onClick, onPointerUp: noopWorkaround, onKeyDown: noopWorkaround, children: content }));
|
|
89
92
|
}
|
|
90
93
|
function isIconMenuItem(item) {
|
|
91
94
|
return item && typeof item === "object" && "icon" in item;
|