@homebound/beam 3.51.0 → 3.53.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
@@ -312,6 +312,7 @@ __export(index_exports, {
312
312
  px: () => px,
313
313
  recursivelyGetContainingRow: () => recursivelyGetContainingRow,
314
314
  reservedRowKinds: () => reservedRowKinds,
315
+ resolveGridTableLayoutStyle: () => resolveGridTableLayoutStyle,
315
316
  resolveTableContentWidth: () => resolveTableContentWidth,
316
317
  resolveTooltip: () => resolveTooltip,
317
318
  rowClickRenderFn: () => rowClickRenderFn,
@@ -9066,23 +9067,26 @@ var cardStyle = {
9066
9067
  rowIndent: level > 0 ? 24 * level : void 0
9067
9068
  })
9068
9069
  };
9069
- function resolveStyles(style) {
9070
- const defKeysRecord = {
9071
- inlineEditing: true,
9072
- grouped: true,
9073
- rowHeight: true,
9074
- cellHighlight: true,
9075
- allWhite: true,
9076
- bordered: true,
9077
- rowHover: true,
9078
- vAlign: true,
9079
- cellTypography: true,
9080
- highlightOnHover: true,
9081
- roundedHeader: true
9082
- };
9070
+ var gridStyleDefKeysRecord = {
9071
+ inlineEditing: true,
9072
+ grouped: true,
9073
+ rowHeight: true,
9074
+ cellHighlight: true,
9075
+ allWhite: true,
9076
+ bordered: true,
9077
+ rowHover: true,
9078
+ vAlign: true,
9079
+ cellTypography: true,
9080
+ highlightOnHover: true,
9081
+ roundedHeader: true
9082
+ };
9083
+ function isGridStyleDef(style) {
9083
9084
  const keys = safeKeys(style);
9084
- const defKeys = safeKeys(defKeysRecord);
9085
- if (keys.length === 0 || keys.some((k) => defKeys.includes(k))) {
9085
+ const defKeys = safeKeys(gridStyleDefKeysRecord);
9086
+ return keys.length === 0 || keys.some((k) => defKeys.includes(k));
9087
+ }
9088
+ function resolveStyles(style) {
9089
+ if (isGridStyleDef(style)) {
9086
9090
  return getTableStyles(style);
9087
9091
  }
9088
9092
  return style;
@@ -17041,7 +17045,7 @@ function GridTableEmptyState(props) {
17041
17045
  actions
17042
17046
  } = props;
17043
17047
  const tid = useTestIds(props, "gridTableEmptyState");
17044
- return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "df fdc aic pt8 pb8 gap2", ...tid, children: [
17048
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "df fdc aic pt_12 pb_12 gap2", ...tid, children: [
17045
17049
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fw6 fz_20px lh_28px", ...tid.title, children: title }),
17046
17050
  description && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fw4 fz_14px lh_20px gray700", ...tid.description, children: description }),
17047
17051
  actions && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { ...tid.actions, children: actions })
@@ -20411,6 +20415,27 @@ function invertSpacing(value) {
20411
20415
  var import_utils131 = require("@react-aria/utils");
20412
20416
  var import_react113 = __toESM(require("react"), 1);
20413
20417
 
20418
+ // src/components/Filters/utils.tsx
20419
+ function getActiveFilterCount(filter) {
20420
+ return safeKeys(filter).filter((key) => isDefined(filter[key])).length;
20421
+ }
20422
+ function updateFilter(currentFilter, key, value) {
20423
+ if (value === void 0) {
20424
+ return omitKey(key, currentFilter);
20425
+ } else {
20426
+ return { ...currentFilter, [key]: value };
20427
+ }
20428
+ }
20429
+ var filterTestIdPrefix = "filter";
20430
+
20431
+ // src/components/Layout/layoutTypes.ts
20432
+ function isGridTableProps(props) {
20433
+ return "rows" in props;
20434
+ }
20435
+
20436
+ // src/components/Layout/GridTableLayout/GridTableLayoutActions.tsx
20437
+ var import_react110 = require("react");
20438
+
20414
20439
  // src/components/ButtonMenu.tsx
20415
20440
  var import_react105 = require("react");
20416
20441
  var import_react_aria51 = require("react-aria");
@@ -20448,27 +20473,6 @@ function isSelectionButtonMenuProps(props) {
20448
20473
  return typeof props === "object" && "selectedItem" in props && "onChange" in props;
20449
20474
  }
20450
20475
 
20451
- // src/components/Filters/utils.tsx
20452
- function getActiveFilterCount(filter) {
20453
- return safeKeys(filter).filter((key) => isDefined(filter[key])).length;
20454
- }
20455
- function updateFilter(currentFilter, key, value) {
20456
- if (value === void 0) {
20457
- return omitKey(key, currentFilter);
20458
- } else {
20459
- return { ...currentFilter, [key]: value };
20460
- }
20461
- }
20462
- var filterTestIdPrefix = "filter";
20463
-
20464
- // src/components/Layout/layoutTypes.ts
20465
- function isGridTableProps(props) {
20466
- return "rows" in props;
20467
- }
20468
-
20469
- // src/components/Layout/GridTableLayout/GridTableLayoutActions.tsx
20470
- var import_react110 = require("react");
20471
-
20472
20476
  // src/components/CountBadge.tsx
20473
20477
  var import_runtime81 = require("@homebound/truss/runtime");
20474
20478
  var import_jsx_runtime140 = require("react/jsx-runtime");
@@ -21338,7 +21342,8 @@ function GridTableLayoutActionsComponent(props) {
21338
21342
  view,
21339
21343
  setView,
21340
21344
  clearFilters,
21341
- searchApi
21345
+ searchApi,
21346
+ actionMenu
21342
21347
  } = props;
21343
21348
  const testId = useTestIds(props, "gridTableLayoutActions");
21344
21349
  const {
@@ -21408,9 +21413,12 @@ function GridTableLayoutActionsComponent(props) {
21408
21413
  /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(Icon, { icon: showFilters ? "chevronUp" : "chevronDown" })
21409
21414
  ] }), variant: "secondaryBlack", onClick: () => setShowFilters(!showFilters), active: showFilters, ...testId.filterButton })
21410
21415
  ] }),
21411
- (hasHideableColumns || withCardView) && /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "df gap_12px", children: [
21416
+ (hasHideableColumns || withCardView || actionMenu) && /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "df aic gap_12px", children: [
21412
21417
  hasHideableColumns && view === "list" && columns && api && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(EditColumnsButton, { columns, api, tooltip: "Display columns" }),
21413
- withCardView && view !== void 0 && setView && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(ViewToggleButton, { view, onChange: setView })
21418
+ withCardView && view !== void 0 && setView && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(ViewToggleButton, { view, onChange: setView }),
21419
+ actionMenu && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(ButtonMenu, { ...actionMenu, trigger: {
21420
+ icon: "verticalDots"
21421
+ } })
21414
21422
  ] })
21415
21423
  ] }),
21416
21424
  sm && showSearch && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "pl3 pr3", children: searchTextField }),
@@ -21539,13 +21547,8 @@ var __maybeInc15 = (inc) => {
21539
21547
  };
21540
21548
  function GridTableLayoutComponent(props) {
21541
21549
  const {
21542
- pageTitle,
21543
- breadCrumb,
21544
21550
  tableProps,
21545
21551
  layoutState,
21546
- primaryAction,
21547
- secondaryAction,
21548
- tertiaryAction,
21549
21552
  actionMenu,
21550
21553
  hideEditColumns = false,
21551
21554
  withCardView,
@@ -21562,7 +21565,7 @@ function GridTableLayoutComponent(props) {
21562
21565
  const api = (0, import_react113.useMemo)(() => tableProps.api ?? new GridTableApiImpl(), [tableProps.api]);
21563
21566
  const [view, setView] = usePersistedTableView(defaultView, !!withCardView);
21564
21567
  const clientSearch = layoutState?.search === "client" ? layoutState.searchString : void 0;
21565
- const showTableActions = !!(layoutState?.filterDefs || layoutState?.search || hasHideableColumns || withCardView);
21568
+ const showTableActions = !!(layoutState?.filterDefs || layoutState?.search || hasHideableColumns || withCardView || actionMenu);
21566
21569
  const isVirtualized = tableProps.as === "virtual" || !!withCardView && view === "card";
21567
21570
  const inDocumentScrollLayout = useDocumentScrollLayout();
21568
21571
  const tableActionsRef = (0, import_react113.useRef)(null);
@@ -21584,19 +21587,14 @@ function GridTableLayoutComponent(props) {
21584
21587
  searchApiRef.current?.clear();
21585
21588
  }, [layoutState]);
21586
21589
  const emptyState = (0, import_react113.useMemo)(() => composeEmptyState(tableProps, layoutState, layoutEmptyFallback, clearFilters), [layoutEmptyFallback, layoutState, tableProps, clearFilters]);
21587
- const tableActionsEl = /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(_GridTableLayoutActions, { filterDefs: layoutState?.filterDefs, filter: layoutState?.filter, setFilter: layoutState?.setFilter, groupBy: layoutState?.groupBy, searchProps: filterSearchProps, hasHideableColumns, columns, api, withCardView, view, setView, clearFilters, searchApi: searchApiRef });
21590
+ const tableActionsEl = /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(_GridTableLayoutActions, { filterDefs: layoutState?.filterDefs, filter: layoutState?.filter, setFilter: layoutState?.setFilter, groupBy: layoutState?.groupBy, searchProps: filterSearchProps, hasHideableColumns, columns, api, withCardView, view, setView, clearFilters, searchApi: searchApiRef, actionMenu });
21588
21591
  const cardAs = withCardView && view === "card" ? "card" : void 0;
21592
+ const tableStyle = resolveGridTableLayoutStyle(tableProps.style, inDocumentScrollLayout);
21589
21593
  const tableBody = /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(import_jsx_runtime159.Fragment, { children: isGridTableProps(tableProps) ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(GridTable, { ...tableProps, ...cardAs ? {
21590
21594
  as: cardAs
21591
- } : {}, api, emptyState, filter: clientSearch, style: {
21592
- allWhite: true,
21593
- roundedHeader: !inDocumentScrollLayout
21594
- }, stickyHeader: true, disableColumnResizing: false, visibleColumnsStorageKey, columnGutter: inDocumentScrollLayout }) : /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(QueryTable, { ...tableProps, ...cardAs ? {
21595
+ } : {}, api, emptyState, filter: clientSearch, style: tableStyle, stickyHeader: true, disableColumnResizing: false, visibleColumnsStorageKey, columnGutter: inDocumentScrollLayout }) : /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(QueryTable, { ...tableProps, ...cardAs ? {
21595
21596
  as: cardAs
21596
- } : {}, api, emptyState, filter: clientSearch, style: {
21597
- allWhite: true,
21598
- roundedHeader: !inDocumentScrollLayout
21599
- }, stickyHeader: true, disableColumnResizing: false, visibleColumnsStorageKey, columnGutter: inDocumentScrollLayout }) });
21597
+ } : {}, api, emptyState, filter: clientSearch, style: tableStyle, stickyHeader: true, disableColumnResizing: false, visibleColumnsStorageKey, columnGutter: inDocumentScrollLayout }) });
21600
21598
  const tableScrollContent = /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(import_jsx_runtime159.Fragment, { children: [
21601
21599
  showTableActions && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { ref: tableActionsRef, ...(0, import_runtime88.trussProps)({
21602
21600
  ...inDocumentScrollLayout ? {
@@ -21621,10 +21619,10 @@ function GridTableLayoutComponent(props) {
21621
21619
  }), ...tid.stickyContent, children: tableActionsEl }),
21622
21620
  inDocumentScrollLayout ? tableBody : /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(ScrollableContent, { virtualized: isVirtualized, children: tableBody })
21623
21621
  ] });
21624
- return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(import_jsx_runtime159.Fragment, { children: [
21625
- pageTitle && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(Header2, { pageTitle, breadCrumb, primaryAction, secondaryAction, tertiaryAction, actionMenu }),
21622
+ return (
21623
+ /* Wrapper sets --beam-table-actions-height so GridTable's sticky header can read it. */
21626
21624
  /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { ref: tableWrapperRef, className: "display_contents", ...tid.tableWrapper, children: tableScrollContent })
21627
- ] });
21625
+ );
21628
21626
  }
21629
21627
  var GridTableLayout = import_react113.default.memo(GridTableLayoutComponent);
21630
21628
  function validateColumns(columns) {
@@ -21712,42 +21710,21 @@ function useSetTableActionsHeight(tableWrapperRef, tableActionsRef, enabled) {
21712
21710
  };
21713
21711
  }, [tableWrapperRef, syncHeightVar]);
21714
21712
  }
21715
- function Header2(props) {
21716
- const {
21717
- pageTitle,
21718
- breadCrumb,
21719
- primaryAction,
21720
- secondaryAction,
21721
- tertiaryAction,
21722
- actionMenu
21723
- } = props;
21724
- const tids = useTestIds(props);
21725
- return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(FullBleed, { children: /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("header", { ...(0, import_runtime88.trussProps)({
21726
- ...{
21727
- paddingTop: "pt3",
21728
- paddingBottom: "pb3",
21729
- paddingRight: "pr3",
21730
- paddingLeft: "pl3",
21731
- minHeight: "mh_50px",
21732
- backgroundColor: "bgWhite",
21733
- display: "df",
21734
- justifyContent: "jcsb",
21735
- alignItems: "aic"
21736
- }
21737
- }), ...tids.header, children: [
21738
- /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { children: [
21739
- breadCrumb && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(PageHeaderBreadcrumbs, { breadcrumb: breadCrumb }),
21740
- /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("h1", { className: "fw6 fz_30px lh_36px mt1", ...tids.pageTitle, children: pageTitle })
21741
- ] }),
21742
- /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { className: "df fwr jcfe gap1 aic", children: [
21743
- tertiaryAction && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(Button, { ...tertiaryAction, variant: "tertiary" }),
21744
- secondaryAction && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(Button, { ...secondaryAction, variant: "secondary" }),
21745
- primaryAction && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(Button, { ...primaryAction }),
21746
- actionMenu && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(ButtonMenu, { ...actionMenu, trigger: {
21747
- icon: "verticalDots"
21748
- } })
21749
- ] })
21750
- ] }) });
21713
+ function resolveGridTableLayoutStyle(userStyle, inDocumentScrollLayout) {
21714
+ const layoutDefaults = {
21715
+ allWhite: true,
21716
+ roundedHeader: !inDocumentScrollLayout
21717
+ };
21718
+ if (userStyle === void 0) {
21719
+ return layoutDefaults;
21720
+ }
21721
+ if (isGridStyleDef(userStyle)) {
21722
+ return {
21723
+ ...layoutDefaults,
21724
+ ...userStyle
21725
+ };
21726
+ }
21727
+ return userStyle;
21751
21728
  }
21752
21729
 
21753
21730
  // src/components/Layout/PreventBrowserScroll.tsx
@@ -26213,6 +26190,7 @@ function PageHeaderLayout(props) {
26213
26190
  px,
26214
26191
  recursivelyGetContainingRow,
26215
26192
  reservedRowKinds,
26193
+ resolveGridTableLayoutStyle,
26216
26194
  resolveTableContentWidth,
26217
26195
  resolveTooltip,
26218
26196
  rowClickRenderFn,