@homebound/beam 3.63.0 → 3.63.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/dist/index.cjs CHANGED
@@ -11258,6 +11258,10 @@ function MenuItemImpl(props) {
11258
11258
  isHovered
11259
11259
  } = (0, import_react_aria17.useHover)({});
11260
11260
  const tid = useTestIds(props);
11261
+ const openInNewTabRef = (0, import_react41.useRef)(false);
11262
+ function captureModifiers(e) {
11263
+ openInNewTabRef.current = wantsNewTab(e);
11264
+ }
11261
11265
  const {
11262
11266
  menuItemProps
11263
11267
  } = (0, import_react_aria17.useMenuItem)({
@@ -11271,7 +11275,7 @@ function MenuItemImpl(props) {
11271
11275
  onClick
11272
11276
  } = menuItem;
11273
11277
  if (typeof onClick === "string") {
11274
- if (isAbsoluteUrl(onClick)) {
11278
+ if (isAbsoluteUrl(onClick) || openInNewTabRef.current) {
11275
11279
  window.open(onClick, "_blank").opener = null;
11276
11280
  return;
11277
11281
  }
@@ -11293,55 +11297,68 @@ function MenuItemImpl(props) {
11293
11297
  const isDisabled = Boolean(disabled);
11294
11298
  const isSelected = state.selectionManager.selectedKeys.has(label);
11295
11299
  const isFocused = state.selectionManager.focusedKey === item.key;
11296
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { ...menuItemProps, ...hoverProps, ref, ...(0, import_runtime30.trussProps)({
11297
- ...{
11298
- display: "df",
11299
- alignItems: "aic",
11300
- paddingTop: "pt1",
11301
- paddingBottom: "pb1",
11302
- paddingLeft: "pl2",
11303
- paddingRight: "pr2",
11304
- cursor: "cursorPointer",
11305
- outline: "outline0",
11306
- minHeight: "mh_42px",
11307
- fontWeight: "fw4",
11308
- fontSize: "fz_14px",
11309
- lineHeight: "lh_20px"
11310
- },
11311
- ...menuItem.hasDivider ? {
11312
- borderBottomStyle: "bbs_solid",
11313
- borderBottomWidth: "bbw_1px",
11314
- borderColor: "bcGray700"
11315
- } : {},
11316
- ...!isDisabled && isHovered ? {
11317
- backgroundColor: ["bgColor_var", {
11318
- "--backgroundColor": "var(--b-menu-item-bg-hover)"
11319
- }]
11320
- } : {},
11321
- ...isFocused ? {
11322
- boxShadow: ["boxShadow_var", {
11323
- "--boxShadow": (0, import_runtime30.maybeCssVar)(`inset 0 0 0 1px var(${"--b-focus-ring-inset" /* FocusRingInset */})`)
11324
- }]
11325
- } : {},
11326
- ...isDisabled ? {
11327
- color: ["color_var", {
11328
- "--color": "var(--b-text-disabled)"
11329
- }],
11330
- cursor: "cursorNotAllowed"
11331
- } : {},
11332
- ...destructive ? {
11333
- color: ["color_var", {
11334
- "--color": "var(--b-danger)"
11335
- }]
11336
- } : {},
11337
- ...isSelected ? {
11338
- fontWeight: "fw5"
11339
- } : {}
11340
- }), ...tid[defaultTestId(menuItem.label)], children: maybeTooltip({
11341
- title: resolveTooltip(disabled),
11342
- placement: "right",
11343
- children: renderMenuItem(menuItem, isSelected, isDisabled)
11344
- }) });
11300
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11301
+ "li",
11302
+ {
11303
+ ...menuItemProps,
11304
+ ...hoverProps,
11305
+ onPointerDownCapture: captureModifiers,
11306
+ onKeyDownCapture: captureModifiers,
11307
+ onClickCapture: captureModifiers,
11308
+ ref,
11309
+ ...(0, import_runtime30.trussProps)({
11310
+ ...{
11311
+ display: "df",
11312
+ alignItems: "aic",
11313
+ paddingTop: "pt1",
11314
+ paddingBottom: "pb1",
11315
+ paddingLeft: "pl2",
11316
+ paddingRight: "pr2",
11317
+ cursor: "cursorPointer",
11318
+ outline: "outline0",
11319
+ minHeight: "mh_42px",
11320
+ fontWeight: "fw4",
11321
+ fontSize: "fz_14px",
11322
+ lineHeight: "lh_20px"
11323
+ },
11324
+ ...menuItem.hasDivider ? {
11325
+ borderBottomStyle: "bbs_solid",
11326
+ borderBottomWidth: "bbw_1px",
11327
+ borderColor: "bcGray700"
11328
+ } : {},
11329
+ ...!isDisabled && isHovered ? {
11330
+ backgroundColor: ["bgColor_var", {
11331
+ "--backgroundColor": "var(--b-menu-item-bg-hover)"
11332
+ }]
11333
+ } : {},
11334
+ ...isFocused ? {
11335
+ boxShadow: ["boxShadow_var", {
11336
+ "--boxShadow": (0, import_runtime30.maybeCssVar)(`inset 0 0 0 1px var(${"--b-focus-ring-inset" /* FocusRingInset */})`)
11337
+ }]
11338
+ } : {},
11339
+ ...isDisabled ? {
11340
+ color: ["color_var", {
11341
+ "--color": "var(--b-text-disabled)"
11342
+ }],
11343
+ cursor: "cursorNotAllowed"
11344
+ } : {},
11345
+ ...destructive ? {
11346
+ color: ["color_var", {
11347
+ "--color": "var(--b-danger)"
11348
+ }]
11349
+ } : {},
11350
+ ...isSelected ? {
11351
+ fontWeight: "fw5"
11352
+ } : {}
11353
+ }),
11354
+ ...tid[defaultTestId(menuItem.label)],
11355
+ children: maybeTooltip({
11356
+ title: resolveTooltip(disabled),
11357
+ placement: "right",
11358
+ children: renderMenuItem(menuItem, isSelected, isDisabled)
11359
+ })
11360
+ }
11361
+ );
11345
11362
  }
11346
11363
  function renderMenuItem(menuItem, isSelected, isDisabled) {
11347
11364
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "df w100 aic jcsb gap2", children: [
@@ -11385,6 +11402,9 @@ function maybeWrapInLink(onClick, content, disabled) {
11385
11402
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "fs0 ml2", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { icon: "linkExternal" }) })
11386
11403
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_router_dom3.Link, { className: "navLink", to: onClick, children: content });
11387
11404
  }
11405
+ function wantsNewTab(e) {
11406
+ return e.metaKey || e.ctrlKey || e.shiftKey;
11407
+ }
11388
11408
  function isIconMenuItem(item) {
11389
11409
  return item && typeof item === "object" && "icon" in item;
11390
11410
  }