@homebound/beam 3.8.0 → 3.9.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/dist/index.js CHANGED
@@ -8735,8 +8735,7 @@ function Menu(props) {
8735
8735
  // src/components/internal/MenuItem.tsx
8736
8736
  import { useRef as useRef14 } from "react";
8737
8737
  import { useHover as useHover7, useMenuItem } from "react-aria";
8738
- import { useHistory } from "react-router";
8739
- import { Link as Link3 } from "react-router-dom";
8738
+ import { Link as Link3, useNavigate } from "react-router-dom";
8740
8739
 
8741
8740
  // src/components/Avatar/Avatar.tsx
8742
8741
  import { useState as useState12 } from "react";
@@ -9771,20 +9770,8 @@ function MenuItemImpl(props) {
9771
9770
  onClose
9772
9771
  } = props;
9773
9772
  const menuItem = item.value;
9774
- if (!menuItem) {
9775
- return null;
9776
- }
9777
- const {
9778
- disabled,
9779
- onClick,
9780
- label,
9781
- destructive
9782
- } = menuItem;
9783
- const isDisabled = Boolean(disabled);
9784
- const isSelected = state.selectionManager.selectedKeys.has(label);
9785
- const isFocused = state.selectionManager.focusedKey === item.key;
9786
9773
  const ref = useRef14(null);
9787
- const history = useHistory();
9774
+ const navigate = useNavigate();
9788
9775
  const {
9789
9776
  hoverProps,
9790
9777
  isHovered
@@ -9794,20 +9781,37 @@ function MenuItemImpl(props) {
9794
9781
  menuItemProps
9795
9782
  } = useMenuItem({
9796
9783
  key: item.key,
9797
- isDisabled,
9784
+ isDisabled: Boolean(menuItem?.disabled),
9798
9785
  onAction: () => {
9786
+ if (!menuItem) {
9787
+ return;
9788
+ }
9789
+ const {
9790
+ onClick
9791
+ } = menuItem;
9799
9792
  if (typeof onClick === "string") {
9800
9793
  if (isAbsoluteUrl(onClick)) {
9801
9794
  window.open(onClick, "_blank").opener = null;
9802
9795
  return;
9803
9796
  }
9804
- history.push(onClick);
9797
+ navigate(onClick);
9805
9798
  return;
9806
9799
  }
9807
9800
  onClick && onClick();
9808
9801
  },
9809
9802
  onClose
9810
9803
  }, state, ref);
9804
+ if (!menuItem) {
9805
+ return null;
9806
+ }
9807
+ const {
9808
+ disabled,
9809
+ label,
9810
+ destructive
9811
+ } = menuItem;
9812
+ const isDisabled = Boolean(disabled);
9813
+ const isSelected = state.selectionManager.selectedKeys.has(label);
9814
+ const isFocused = state.selectionManager.focusedKey === item.key;
9811
9815
  return /* @__PURE__ */ jsx41("li", { ...menuItemProps, ...hoverProps, ref, ...trussProps27({
9812
9816
  ...{
9813
9817
  display: "df",
@@ -21618,7 +21622,7 @@ function visit(rows, fn) {
21618
21622
  import { camelCase as camelCase5 } from "change-case";
21619
21623
  import { useEffect as useEffect33, useMemo as useMemo49, useRef as useRef54, useState as useState48 } from "react";
21620
21624
  import { mergeProps as mergeProps26, useFocusRing as useFocusRing15, useHover as useHover19 } from "react-aria";
21621
- import { matchPath, Route } from "react-router";
21625
+ import { matchPath, Route, Routes } from "react-router";
21622
21626
  import { Link as Link5, useLocation } from "react-router-dom";
21623
21627
  import { trussProps as trussProps85, maybeCssVar as maybeCssVar44 } from "@homebound/truss/runtime";
21624
21628
  import { Fragment as Fragment40, jsx as jsx171, jsxs as jsxs90 } from "react/jsx-runtime";
@@ -21644,16 +21648,16 @@ function TabContent(props) {
21644
21648
  const location = useLocation();
21645
21649
  const selectedTab = isRouteTabs(props) ? props.tabs.find((t) => {
21646
21650
  const paths = Array.isArray(t.path) ? t.path : [t.path];
21647
- return paths.some((p) => !!matchPath(location.pathname, {
21651
+ return paths.some((p) => !!matchPath({
21648
21652
  path: p,
21649
- exact: true
21650
- }));
21653
+ end: true
21654
+ }, location.pathname));
21651
21655
  }) || tabs[0] : props.tabs.find((tab) => tab.value === props.selected) || tabs[0];
21652
21656
  const uniqueValue = uniqueTabValue(selectedTab);
21653
21657
  return (
21654
21658
  // Using FullBleed to allow the tab's bgColor to extend to the edges of the <ScrollableContent /> element.
21655
21659
  // Omit the padding from `FullBleed` if the caller passes in the `paddingLeft/Right` styles.
21656
- /* @__PURE__ */ jsx171(FullBleed, { omitPadding: omitFullBleedPadding, children: /* @__PURE__ */ jsx171("div", { "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0, ...tid.panel, ...trussProps85(contentXss), children: isRouteTab(selectedTab) ? /* @__PURE__ */ jsx171(Route, { path: selectedTab.path, render: selectedTab.render }) : selectedTab.render() }) })
21660
+ /* @__PURE__ */ jsx171(FullBleed, { omitPadding: omitFullBleedPadding, children: /* @__PURE__ */ jsx171("div", { "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0, ...tid.panel, ...trussProps85(contentXss), children: isRouteTab(selectedTab) ? /* @__PURE__ */ jsx171(Routes, { children: (Array.isArray(selectedTab.path) ? selectedTab.path : [selectedTab.path]).map((p) => /* @__PURE__ */ jsx171(Route, { path: p, element: selectedTab.render() }, p)) }) : selectedTab.render() }) })
21657
21661
  );
21658
21662
  }
21659
21663
  function Tabs(props) {
@@ -21665,10 +21669,13 @@ function Tabs(props) {
21665
21669
  ...others
21666
21670
  } = props;
21667
21671
  const location = useLocation();
21668
- const selected = isRouteTabs(props) ? uniqueTabValue(props.tabs.find((t) => !!matchPath(location.pathname, {
21669
- path: t.path,
21670
- exact: true
21671
- })) || props.tabs[0]) : props.selected;
21672
+ const selected = isRouteTabs(props) ? uniqueTabValue(props.tabs.find((t) => {
21673
+ const paths = Array.isArray(t.path) ? t.path : [t.path];
21674
+ return paths.some((p) => !!matchPath({
21675
+ path: p,
21676
+ end: true
21677
+ }, location.pathname));
21678
+ }) || props.tabs[0]) : props.selected;
21672
21679
  const {
21673
21680
  isFocusVisible,
21674
21681
  focusProps