@homebound/beam 2.234.0 → 2.235.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.
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from "react";
1
2
  import { IconProps } from "./Icon";
2
3
  import { OverlayTriggerProps } from "./internal/OverlayTrigger";
3
4
  interface ButtonMenuProps extends Pick<OverlayTriggerProps, "trigger" | "placement" | "disabled" | "tooltip" | "showActiveBorder"> {
@@ -9,8 +10,10 @@ interface ButtonMenuProps extends Pick<OverlayTriggerProps, "trigger" | "placeme
9
10
  export declare function ButtonMenu(props: ButtonMenuProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
11
  type MenuItemBase = {
11
12
  label: string;
13
+ /** If the `onClick` property is set as a string, then the menu item will be rendered as a link with the `onClick` value being the href */
12
14
  onClick: string | VoidFunction;
13
- disabled?: boolean;
15
+ /** Whether the interactive element is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
16
+ disabled?: boolean | ReactNode;
14
17
  destructive?: boolean;
15
18
  };
16
19
  export type IconMenuItemType = MenuItemBase & {
@@ -181,12 +181,14 @@ class TableState {
181
181
  this.rows = rows;
182
182
  }
183
183
  setColumns(columns, visibleColumnsStorageKey) {
184
+ const isInitial = !this.columns || this.columns.length === 0;
184
185
  if (columns !== this.columns) {
185
186
  this.columns = columns;
186
187
  this.visibleColumnsStorageKey = visibleColumnsStorageKey !== null && visibleColumnsStorageKey !== void 0 ? visibleColumnsStorageKey : (0, change_case_1.camelCase)(columns.map((c) => c.id).join());
187
188
  this.visibleColumns.replace(readOrSetLocalVisibleColumnState(columns, this.visibleColumnsStorageKey));
188
189
  const expandedColumnIds = columns.filter((c) => c.initExpanded).map((c) => c.id);
189
- this.expandedColumns.replace(expandedColumnIds);
190
+ if (isInitial)
191
+ this.expandedColumns.replace(expandedColumnIds);
190
192
  }
191
193
  }
192
194
  // load and trigger column to be expanded
@@ -8,13 +8,15 @@ const react_router_1 = require("react-router");
8
8
  const react_router_dom_1 = require("react-router-dom");
9
9
  const Avatar_1 = require("../Avatar");
10
10
  const Icon_1 = require("../Icon");
11
+ const Tooltip_1 = require("../Tooltip");
11
12
  const Css_1 = require("../../Css");
12
13
  const utils_1 = require("../../utils");
13
14
  const defaultTestId_1 = require("../../utils/defaultTestId");
14
15
  function MenuItemImpl(props) {
15
16
  const { item, state, onClose } = props;
16
17
  const menuItem = item.value;
17
- const { disabled: isDisabled, onClick, label, destructive } = menuItem;
18
+ const { disabled, onClick, label, destructive } = menuItem;
19
+ const isDisabled = Boolean(disabled);
18
20
  const isFocused = state.selectionManager.focusedKey === item.key;
19
21
  const ref = (0, react_1.useRef)(null);
20
22
  const history = (0, react_router_1.useHistory)();
@@ -50,7 +52,11 @@ function MenuItemImpl(props) {
50
52
  ...(isFocused ? Css_1.Css.add("boxShadow", `inset 0 0 0 1px ${Css_1.Palette.LightBlue700}`).$ : {}),
51
53
  ...(isDisabled ? Css_1.Css.gray500.cursorNotAllowed.$ : {}),
52
54
  ...(destructive ? Css_1.Css.red600.$ : {}),
53
- }, ...tid[(0, defaultTestId_1.defaultTestId)(menuItem.label)], children: maybeWrapInLink(onClick, isIconMenuItem(menuItem) ? ((0, jsx_runtime_1.jsx)(IconMenuItem, { ...menuItem })) : isImageMenuItem(menuItem) ? ((0, jsx_runtime_1.jsx)(ImageMenuItem, { ...menuItem })) : (label), isDisabled) }));
55
+ }, ...tid[(0, defaultTestId_1.defaultTestId)(menuItem.label)], children: (0, Tooltip_1.maybeTooltip)({
56
+ title: (0, Tooltip_1.resolveTooltip)(disabled),
57
+ placement: "right",
58
+ children: maybeWrapInLink(onClick, isIconMenuItem(menuItem) ? ((0, jsx_runtime_1.jsx)(IconMenuItem, { ...menuItem })) : isImageMenuItem(menuItem) ? ((0, jsx_runtime_1.jsx)(ImageMenuItem, { ...menuItem })) : (label), isDisabled),
59
+ }) }));
54
60
  }
55
61
  exports.MenuItemImpl = MenuItemImpl;
56
62
  function ImageMenuItem(item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.234.0",
3
+ "version": "2.235.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",