@homebound/beam 3.8.0 → 3.9.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
@@ -9149,7 +9149,6 @@ function Menu(props) {
9149
9149
  // src/components/internal/MenuItem.tsx
9150
9150
  var import_react35 = require("react");
9151
9151
  var import_react_aria16 = require("react-aria");
9152
- var import_react_router = require("react-router");
9153
9152
  var import_react_router_dom3 = require("react-router-dom");
9154
9153
 
9155
9154
  // src/components/Avatar/Avatar.tsx
@@ -10185,20 +10184,8 @@ function MenuItemImpl(props) {
10185
10184
  onClose
10186
10185
  } = props;
10187
10186
  const menuItem = item.value;
10188
- if (!menuItem) {
10189
- return null;
10190
- }
10191
- const {
10192
- disabled,
10193
- onClick,
10194
- label,
10195
- destructive
10196
- } = menuItem;
10197
- const isDisabled = Boolean(disabled);
10198
- const isSelected = state.selectionManager.selectedKeys.has(label);
10199
- const isFocused = state.selectionManager.focusedKey === item.key;
10200
10187
  const ref = (0, import_react35.useRef)(null);
10201
- const history = (0, import_react_router.useHistory)();
10188
+ const navigate = (0, import_react_router_dom3.useNavigate)();
10202
10189
  const {
10203
10190
  hoverProps,
10204
10191
  isHovered
@@ -10208,20 +10195,37 @@ function MenuItemImpl(props) {
10208
10195
  menuItemProps
10209
10196
  } = (0, import_react_aria16.useMenuItem)({
10210
10197
  key: item.key,
10211
- isDisabled,
10198
+ isDisabled: Boolean(menuItem?.disabled),
10212
10199
  onAction: () => {
10200
+ if (!menuItem) {
10201
+ return;
10202
+ }
10203
+ const {
10204
+ onClick
10205
+ } = menuItem;
10213
10206
  if (typeof onClick === "string") {
10214
10207
  if (isAbsoluteUrl(onClick)) {
10215
10208
  window.open(onClick, "_blank").opener = null;
10216
10209
  return;
10217
10210
  }
10218
- history.push(onClick);
10211
+ navigate(onClick);
10219
10212
  return;
10220
10213
  }
10221
10214
  onClick && onClick();
10222
10215
  },
10223
10216
  onClose
10224
10217
  }, state, ref);
10218
+ if (!menuItem) {
10219
+ return null;
10220
+ }
10221
+ const {
10222
+ disabled,
10223
+ label,
10224
+ destructive
10225
+ } = menuItem;
10226
+ const isDisabled = Boolean(disabled);
10227
+ const isSelected = state.selectionManager.selectedKeys.has(label);
10228
+ const isFocused = state.selectionManager.focusedKey === item.key;
10225
10229
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("li", { ...menuItemProps, ...hoverProps, ref, ...(0, import_runtime30.trussProps)({
10226
10230
  ...{
10227
10231
  display: "df",
@@ -22032,7 +22036,7 @@ function visit(rows, fn) {
22032
22036
  var import_change_case7 = require("change-case");
22033
22037
  var import_react123 = require("react");
22034
22038
  var import_react_aria53 = require("react-aria");
22035
- var import_react_router2 = require("react-router");
22039
+ var import_react_router = require("react-router");
22036
22040
  var import_react_router_dom5 = require("react-router-dom");
22037
22041
  var import_runtime93 = require("@homebound/truss/runtime");
22038
22042
  var import_jsx_runtime171 = require("react/jsx-runtime");
@@ -22058,16 +22062,16 @@ function TabContent(props) {
22058
22062
  const location = (0, import_react_router_dom5.useLocation)();
22059
22063
  const selectedTab = isRouteTabs(props) ? props.tabs.find((t) => {
22060
22064
  const paths = Array.isArray(t.path) ? t.path : [t.path];
22061
- return paths.some((p) => !!(0, import_react_router2.matchPath)(location.pathname, {
22065
+ return paths.some((p) => !!(0, import_react_router.matchPath)({
22062
22066
  path: p,
22063
- exact: true
22064
- }));
22067
+ end: true
22068
+ }, location.pathname));
22065
22069
  }) || tabs[0] : props.tabs.find((tab) => tab.value === props.selected) || tabs[0];
22066
22070
  const uniqueValue = uniqueTabValue(selectedTab);
22067
22071
  return (
22068
22072
  // Using FullBleed to allow the tab's bgColor to extend to the edges of the <ScrollableContent /> element.
22069
22073
  // Omit the padding from `FullBleed` if the caller passes in the `paddingLeft/Right` styles.
22070
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(FullBleed, { omitPadding: omitFullBleedPadding, children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0, ...tid.panel, ...(0, import_runtime93.trussProps)(contentXss), children: isRouteTab(selectedTab) ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_react_router2.Route, { path: selectedTab.path, render: selectedTab.render }) : selectedTab.render() }) })
22074
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(FullBleed, { omitPadding: omitFullBleedPadding, children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0, ...tid.panel, ...(0, import_runtime93.trussProps)(contentXss), children: selectedTab.render() }) })
22071
22075
  );
22072
22076
  }
22073
22077
  function Tabs(props) {
@@ -22079,10 +22083,13 @@ function Tabs(props) {
22079
22083
  ...others
22080
22084
  } = props;
22081
22085
  const location = (0, import_react_router_dom5.useLocation)();
22082
- const selected = isRouteTabs(props) ? uniqueTabValue(props.tabs.find((t) => !!(0, import_react_router2.matchPath)(location.pathname, {
22083
- path: t.path,
22084
- exact: true
22085
- })) || props.tabs[0]) : props.selected;
22086
+ const selected = isRouteTabs(props) ? uniqueTabValue(props.tabs.find((t) => {
22087
+ const paths = Array.isArray(t.path) ? t.path : [t.path];
22088
+ return paths.some((p) => !!(0, import_react_router.matchPath)({
22089
+ path: p,
22090
+ end: true
22091
+ }, location.pathname));
22092
+ }) || props.tabs[0]) : props.selected;
22086
22093
  const {
22087
22094
  isFocusVisible,
22088
22095
  focusProps