@homebound/beam 3.101.1 → 3.102.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.cjs CHANGED
@@ -21981,9 +21981,20 @@ var import_jsx_runtime149 = require("react/jsx-runtime");
21981
21981
  function HeaderActions(props) {
21982
21982
  const {
21983
21983
  actions,
21984
+ collapseOnSm = false,
21984
21985
  ...otherProps
21985
21986
  } = props;
21986
21987
  const tid = useTestIds(otherProps, "headerActions");
21988
+ const {
21989
+ sm
21990
+ } = useBreakpoint();
21991
+ const collapse = collapseOnSm && sm && actions.length > 1;
21992
+ if (collapse) {
21993
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "df aic gap1 fs0", ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ButtonMenu, { trigger: {
21994
+ icon: "verticalDots",
21995
+ variant: "outline"
21996
+ }, items: toMenuItems(actions) }) });
21997
+ }
21987
21998
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "df aic gap1 fs0", ...tid, children: actions.map((action, i) => {
21988
21999
  const key = headerActionKey(action, i);
21989
22000
  if (action.kind === "icon") {
@@ -22003,7 +22014,38 @@ function HeaderActions(props) {
22003
22014
  function headerActionKey(action, index) {
22004
22015
  if (action.kind === "icon") return `${action.icon}-${index}`;
22005
22016
  if (action.kind === "menu") return `menu-${index}`;
22006
- return `${String(action.label)}-${index}`;
22017
+ return `${action.label}-${index}`;
22018
+ }
22019
+ function toMenuItems(actions) {
22020
+ return actions.flatMap((action) => {
22021
+ if (action.kind === "menu") return action.items;
22022
+ const {
22023
+ label,
22024
+ onClick,
22025
+ disabled
22026
+ } = action;
22027
+ const itemOnClick = typeof onClick === "string" ? onClick : () => void onClick({});
22028
+ if (action.kind === "icon") {
22029
+ return [{
22030
+ label,
22031
+ onClick: itemOnClick,
22032
+ disabled,
22033
+ icon: action.icon
22034
+ }];
22035
+ }
22036
+ return [{
22037
+ label,
22038
+ onClick: itemOnClick,
22039
+ disabled,
22040
+ // Buttons can opt out of their default icon with `icon: null`, which menu items can't render.
22041
+ ...action.icon ? {
22042
+ icon: action.icon
22043
+ } : {},
22044
+ ...action.variant === "danger" ? {
22045
+ destructive: true
22046
+ } : {}
22047
+ }];
22048
+ });
22007
22049
  }
22008
22050
 
22009
22051
  // src/components/Headers/ContentHeader.tsx
@@ -28674,10 +28716,15 @@ var import_jsx_runtime233 = require("react/jsx-runtime");
28674
28716
  function PageHeader2(props) {
28675
28717
  const {
28676
28718
  tabs,
28719
+ actions,
28720
+ rightSlot,
28677
28721
  ...otherProps
28678
28722
  } = props;
28679
28723
  const tid = useTestIds(otherProps, "header");
28680
- return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(BaseHeader, { ...otherProps, bottomSlot: tabs && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { ...(0, import_runtime150.trussProps)(pageContentPaddingX), children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Tabs, { ...tabs, ...tid.tabs }) }) });
28724
+ return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(BaseHeader, { ...otherProps, rightSlot: /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(import_jsx_runtime233.Fragment, { children: [
28725
+ rightSlot,
28726
+ actions && actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(HeaderActions, { actions, collapseOnSm: true })
28727
+ ] }), bottomSlot: tabs && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { ...(0, import_runtime150.trussProps)(pageContentPaddingX), children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Tabs, { ...tabs, ...tid.tabs }) }) });
28681
28728
  }
28682
28729
 
28683
28730
  // src/layouts/useBannerAndNavbarHeight.ts