@homebound/beam 4.9.0 → 4.9.2

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
@@ -6479,7 +6479,6 @@ import { makeAutoObservable as makeAutoObservable3, observableRef as observableR
6479
6479
  // src/components/Table/components/CompanionRow.tsx
6480
6480
  import { observer } from "mobx-react";
6481
6481
  import { isValidElement } from "react";
6482
- import { trussProps as trussProps12, maybeCssVar as maybeCssVar12 } from "@homebound/truss/runtime";
6483
6482
 
6484
6483
  // src/layouts/DocumentScrollLayoutContext.tsx
6485
6484
  import { useResizeObserver } from "@react-aria/utils";
@@ -6665,6 +6664,7 @@ function headerContentPaddingX(compact = false) {
6665
6664
  }
6666
6665
 
6667
6666
  // src/components/Table/components/CompanionRow.tsx
6667
+ import { trussProps as trussProps12, maybeCssVar as maybeCssVar12 } from "@homebound/truss/runtime";
6668
6668
  import { jsx as jsx17 } from "react/jsx-runtime";
6669
6669
  var __maybeInc7 = (inc) => {
6670
6670
  return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
@@ -6680,7 +6680,9 @@ function CompanionRowImpl(props) {
6680
6680
  isLastBodyRow,
6681
6681
  companion,
6682
6682
  position = "trailing",
6683
- levelIndent
6683
+ levelIndent,
6684
+ rowCss,
6685
+ cellCss
6684
6686
  } = props;
6685
6687
  const RowTag = as === "table" ? "tr" : "div";
6686
6688
  const CellTag = as === "table" ? "td" : "div";
@@ -6711,7 +6713,8 @@ function CompanionRowImpl(props) {
6711
6713
  "--marginLeft": `${levelIndent}px`
6712
6714
  }]
6713
6715
  },
6714
- ...isLastBodyRow && style.lastRowCss
6716
+ ...isLastBodyRow && style.lastRowCss,
6717
+ ...rowCss
6715
6718
  }), "data-gridrow": true, ...tid[rowId], children: /* @__PURE__ */ jsx17(CellTag, { ...trussProps12({
6716
6719
  ...style.cellCss,
6717
6720
  ...style.betweenRowsCss,
@@ -6722,6 +6725,7 @@ function CompanionRowImpl(props) {
6722
6725
  ...isLastBodyRow && style.lastRowCellCss,
6723
6726
  ...isLastBodyRow && style.lastRowFirstCellCss,
6724
6727
  ...isLastBodyRow && style.lastRowLastCellCss,
6728
+ ...cellCss,
6725
6729
  // Companion content is arbitrary — allow wrapping and grow with content.
6726
6730
  ...{
6727
6731
  height: "h_auto",
@@ -9256,6 +9260,11 @@ function resolveStyles(style) {
9256
9260
  return style;
9257
9261
  }
9258
9262
 
9263
+ // src/components/Table/utils/maybeApplyFunction.ts
9264
+ function maybeApplyFunction(row, maybeFn) {
9265
+ return typeof maybeFn === "function" ? maybeFn(row) : maybeFn;
9266
+ }
9267
+
9259
9268
  // src/hooks/useRenderCount.ts
9260
9269
  import { useCallback as useCallback7, useRef as useRef10 } from "react";
9261
9270
  function useRenderCount() {
@@ -9642,7 +9651,7 @@ var __typography2 = {
9642
9651
  lineHeight: "lh_32px"
9643
9652
  }
9644
9653
  };
9645
- function maybeApplyFunction(row, maybeFn) {
9654
+ function maybeApplyFunction2(row, maybeFn) {
9646
9655
  return typeof maybeFn === "function" ? maybeFn(row) : maybeFn;
9647
9656
  }
9648
9657
  function RowImpl(props) {
@@ -9698,7 +9707,7 @@ function RowImpl(props) {
9698
9707
  const RowTag = as === "table" ? "tr" : "div";
9699
9708
  const sortOn = tableState.sortConfig?.on;
9700
9709
  const showRowHoverColor = !reservedRowKinds.includes(row.kind) && !omitRowHover && style.rowHoverColor !== "none";
9701
- const rowStyleCellCss = maybeApplyFunction(row, rowStyle?.cellCss);
9710
+ const rowStyleCellCss = maybeApplyFunction2(row, rowStyle?.cellCss);
9702
9711
  const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(level) : style.levels[level]);
9703
9712
  const levelIndent = levelStyle?.rowIndent;
9704
9713
  const containerCss = {
@@ -9735,7 +9744,7 @@ function RowImpl(props) {
9735
9744
  ...(rowStyle?.rowLink || rowStyle?.onClick) && {
9736
9745
  cursor: "h_cursorPointer"
9737
9746
  },
9738
- ...maybeApplyFunction(row, rowStyle?.rowCss),
9747
+ ...maybeApplyFunction2(row, rowStyle?.rowCss),
9739
9748
  // Row hover paints cells via Row.css.ts (`.beam-row-hover:hover > *`); set the var via Css.style
9740
9749
  // (React CSSProperties rejects custom props without a cast).
9741
9750
  ...showRowHoverColor && {
@@ -13295,7 +13304,8 @@ function GridTable(props) {
13295
13304
  } }, rs.key);
13296
13305
  const makeCompanionRow = (rs, resolved, isFirstBodyRow, isLastBodyRow) => {
13297
13306
  const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(rs.level) : style.levels[rs.level]);
13298
- return /* @__PURE__ */ jsx51(CompanionRow, { as, style, columnSizes, rowId: rs.row.id, colSpan: columns.length, isFirstBodyRow, isLastBodyRow, position: resolved.position, companion: resolved.content, levelIndent: levelStyle?.rowIndent }, `${rs.key}-companion`);
13307
+ const rowStyle = rowStyles?.[rs.row.kind];
13308
+ return /* @__PURE__ */ jsx51(CompanionRow, { as, style, columnSizes, rowId: rs.row.id, colSpan: columns.length, isFirstBodyRow, isLastBodyRow, position: resolved.position, companion: resolved.content, levelIndent: levelStyle?.rowIndent, rowCss: maybeApplyFunction(rs.row, rowStyle?.rowCss), cellCss: maybeApplyFunction(rs.row, rowStyle?.cellCss) }, `${rs.key}-companion`);
13299
13309
  };
13300
13310
  const makeRowGroup = (rs, isFirstBodyRow, isLastBodyRow, inHead) => {
13301
13311
  const resolved = rs.companion;
@@ -28936,6 +28946,7 @@ function useUnsavedChangesGuard(options) {
28936
28946
  isDirtyRef.current = isDirty;
28937
28947
  const allowNavigationRef = useRef74(allowNavigation);
28938
28948
  allowNavigationRef.current = allowNavigation;
28949
+ const allowCancelNavigationRef = useRef74(false);
28939
28950
  useEffect40(() => {
28940
28951
  const onBeforeUnload = (e) => {
28941
28952
  if (isDirtyRef.current?.()) {
@@ -28946,8 +28957,16 @@ function useUnsavedChangesGuard(options) {
28946
28957
  return () => window.removeEventListener("beforeunload", onBeforeUnload);
28947
28958
  }, []);
28948
28959
  const blocker = useBlocker((args) => {
28960
+ if (allowCancelNavigationRef.current) {
28961
+ return false;
28962
+ }
28949
28963
  return !!isDirtyRef.current?.() && !allowNavigationRef.current?.(args);
28950
28964
  });
28965
+ const confirmCancel = (e) => {
28966
+ allowCancelNavigationRef.current = true;
28967
+ onCancel(e);
28968
+ allowCancelNavigationRef.current = false;
28969
+ };
28951
28970
  const onCancelClick = (e) => {
28952
28971
  if (!isDirty?.()) {
28953
28972
  onCancel(e);
@@ -28955,7 +28974,7 @@ function useUnsavedChangesGuard(options) {
28955
28974
  }
28956
28975
  openModal({
28957
28976
  allowClosing: false,
28958
- content: /* @__PURE__ */ jsx237(ConfirmCloseModal, { onClose: () => onCancel(e) })
28977
+ content: /* @__PURE__ */ jsx237(ConfirmCloseModal, { onClose: () => confirmCancel(e) })
28959
28978
  });
28960
28979
  };
28961
28980
  const navigationBlocker = blocker.state === "blocked" ? { proceed: () => blocker.proceed?.(), cancelNavigation: () => blocker.reset?.() } : void 0;