@homebound/beam 4.14.4 → 4.14.5

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
@@ -7139,6 +7139,10 @@ var pageContentPaddingX = {
7139
7139
  "--mdandup_paddingRight": maybeCssVar11(__maybeInc6(pageContentPaddingXValue))
7140
7140
  }]
7141
7141
  };
7142
+ var selfTopSpacedAttr = "data-self-top-spaced";
7143
+ var selfTopSpaced = {
7144
+ [selfTopSpacedAttr]: true
7145
+ };
7142
7146
  function headerContentPaddingX(compact = false) {
7143
7147
  return compact ? {
7144
7148
  paddingLeft: "pl1",
@@ -24014,7 +24018,9 @@ function useScrollPinnedViewportBounds(anchorRef, enabled, getPinTopPx) {
24014
24018
  const isPinned = rect.top <= pinTopPx + 1;
24015
24019
  const topPx = isPinned ? pinTopPx : Math.round(rect.top);
24016
24020
  const heightPx = Math.max(0, Math.round(window.innerHeight - topPx));
24017
- setBounds((prev) => prev?.topPx === topPx && prev?.heightPx === heightPx ? prev : { topPx, heightPx });
24021
+ setBounds(
24022
+ (prev) => prev?.topPx === topPx && prev?.heightPx === heightPx && prev?.isPinned === isPinned ? prev : { topPx, heightPx, isPinned }
24023
+ );
24018
24024
  }, [anchorRef]);
24019
24025
  useLayoutEffect6(() => {
24020
24026
  getPinTopPxRef.current = getPinTopPx;
@@ -24233,7 +24239,10 @@ function DocumentScrollRightPane({
24233
24239
  borderLeftWidth: "blw_1px",
24234
24240
  borderColor: ["bc_var", {
24235
24241
  "--borderColor": "var(--b-surface-separator)"
24236
- }]
24242
+ }],
24243
+ ...!!paneBounds?.isPinned ? {
24244
+ transition: "tsn_top_200ms_cubic_bezier_0_4_0_0_2_1_height_200ms_cubic_bezier_0_4_0_0_2_1"
24245
+ } : {}
24237
24246
  }),
24238
24247
  initial: {
24239
24248
  x: slideX
@@ -24697,6 +24706,7 @@ function GridTableLayoutActionsComponent(props) {
24697
24706
  display: "df",
24698
24707
  flexDirection: "fdc",
24699
24708
  gap: "g_1",
24709
+ paddingTop: "pt3",
24700
24710
  paddingBottom: "pb2",
24701
24711
  ...view === "card" ? {
24702
24712
  paddingBottom: "pb3"
@@ -24889,7 +24899,7 @@ function GridTableLayoutComponent(props) {
24889
24899
  } : {
24890
24900
  display: "df",
24891
24901
  flexDirection: "fdc"
24892
- }), ...tid.tableWrapper, children: tableScrollContent })
24902
+ }), ...showTableActions ? selfTopSpaced : {}, ...tid.tableWrapper, children: tableScrollContent })
24893
24903
  );
24894
24904
  }
24895
24905
  var GridTableLayout = React18.memo(GridTableLayoutComponent);
@@ -29205,49 +29215,41 @@ import { useLayoutEffect as useLayoutEffect14, useRef as useRef71, useState as u
29205
29215
  var THRESHOLD = 80;
29206
29216
  function getInitialAutoHideState() {
29207
29217
  if (typeof window === "undefined" || window.scrollY <= 0) {
29208
- return { state: "static", atTop: true };
29218
+ return "resting";
29209
29219
  }
29210
- return { state: "hidden", atTop: false };
29220
+ return "hidden";
29211
29221
  }
29212
29222
  function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
29213
29223
  const initial = getInitialAutoHideState();
29214
- const [state, setState] = useState62(initial.state);
29215
- const stateRef = useRef71(initial.state);
29216
- const [atTop, setAtTop] = useState62(initial.atTop);
29217
- const atTopRef = useRef71(initial.atTop);
29224
+ const [state, setState] = useState62(initial);
29225
+ const stateRef = useRef71(initial);
29218
29226
  const getTopOffsetRef = useRef71(getTopOffset);
29219
29227
  getTopOffsetRef.current = getTopOffset;
29220
29228
  const lastScrollY = useRef71(Number.POSITIVE_INFINITY);
29221
29229
  const lastScrollHeight = useRef71(0);
29222
29230
  useLayoutEffect14(() => {
29223
29231
  if (!enabled) {
29224
- stateRef.current = "static";
29225
- atTopRef.current = true;
29232
+ stateRef.current = "resting";
29226
29233
  lastScrollY.current = Number.POSITIVE_INFINITY;
29227
29234
  lastScrollHeight.current = 0;
29228
- setState("static");
29229
- setAtTop(true);
29235
+ setState("resting");
29230
29236
  return;
29231
29237
  }
29232
- const commit = (nextState, nextAtTop) => {
29238
+ const commit = (nextState) => {
29233
29239
  if (nextState !== stateRef.current) {
29234
29240
  stateRef.current = nextState;
29235
29241
  setState(nextState);
29236
29242
  }
29237
- if (nextAtTop !== atTopRef.current) {
29238
- atTopRef.current = nextAtTop;
29239
- setAtTop(nextAtTop);
29240
- }
29241
29243
  };
29242
29244
  const autoHideStateOnLayoutChange = (rect, topOffset) => {
29243
29245
  const nextAtTop = rect.top >= topOffset;
29244
29246
  let next = stateRef.current;
29245
29247
  if (nextAtTop) {
29246
- next = "static";
29248
+ next = "resting";
29247
29249
  } else if (rect.bottom < -THRESHOLD && next !== "revealed") {
29248
29250
  next = "hidden";
29249
29251
  }
29250
- return { next, nextAtTop };
29252
+ return next;
29251
29253
  };
29252
29254
  const updateAutoHideState = () => {
29253
29255
  const el = spacerRef.current;
@@ -29258,7 +29260,7 @@ function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
29258
29260
  lastScrollHeight.current = currentScrollHeight;
29259
29261
  if (window.scrollY <= 0) {
29260
29262
  lastScrollY.current = 0;
29261
- commit("static", true);
29263
+ commit("resting");
29262
29264
  return;
29263
29265
  }
29264
29266
  const currentY = window.scrollY;
@@ -29266,8 +29268,7 @@ function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
29266
29268
  const topOffset = getTopOffsetRef.current?.() ?? 0;
29267
29269
  if (scrollHeightChanged) {
29268
29270
  lastScrollY.current = currentY;
29269
- const { next: next2, nextAtTop: nextAtTop2 } = autoHideStateOnLayoutChange(rect, topOffset);
29270
- commit(next2, nextAtTop2);
29271
+ commit(autoHideStateOnLayoutChange(rect, topOffset));
29271
29272
  return;
29272
29273
  }
29273
29274
  const dy = currentY - lastScrollY.current;
@@ -29276,18 +29277,18 @@ function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
29276
29277
  const nextAtTop = rect.top >= topOffset;
29277
29278
  let next = stateRef.current;
29278
29279
  if (nextAtTop) {
29279
- next = "static";
29280
+ next = "resting";
29280
29281
  } else if (rect.bottom < -THRESHOLD) {
29281
29282
  if (dy < 0 && !atBottom) next = "revealed";
29282
29283
  else if (dy > 0) next = "hidden";
29283
29284
  }
29284
- commit(next, nextAtTop);
29285
+ commit(next);
29285
29286
  };
29286
29287
  updateAutoHideState();
29287
29288
  window.addEventListener("scroll", updateAutoHideState, { passive: true });
29288
29289
  return () => window.removeEventListener("scroll", updateAutoHideState);
29289
29290
  }, [enabled, spacerRef]);
29290
- return { state, atTop };
29291
+ return { state };
29291
29292
  }
29292
29293
 
29293
29294
  // src/layouts/useMeasuredHeight.ts
@@ -29307,6 +29308,19 @@ function useMeasuredHeight(ref, enabled) {
29307
29308
  return height;
29308
29309
  }
29309
29310
 
29311
+ // src/layouts/useTransitionAfterPaint.ts
29312
+ import { useLayoutEffect as useLayoutEffect16 } from "react";
29313
+ function useTransitionAfterPaint(ref, transition) {
29314
+ useLayoutEffect16(() => {
29315
+ const el = ref.current;
29316
+ if (!el) return;
29317
+ const id = requestAnimationFrame(() => {
29318
+ el.style.transition = transition;
29319
+ });
29320
+ return () => cancelAnimationFrame(id);
29321
+ }, [ref, transition]);
29322
+ }
29323
+
29310
29324
  // src/layouts/NavbarLayout/NavbarLayoutHeightContext.tsx
29311
29325
  import { createContext as createContext18, useContext as useContext29 } from "react";
29312
29326
  import { jsx as jsx232 } from "react/jsx-runtime";
@@ -29333,10 +29347,9 @@ function NavbarLayout(props) {
29333
29347
  const spacerRef = useRef72(null);
29334
29348
  const navHeight = useMeasuredHeight(navMetricsRef, true);
29335
29349
  const {
29336
- state: autoHideState,
29337
- atTop
29350
+ state: autoHideState
29338
29351
  } = useAutoHideOnScroll(spacerRef, true);
29339
- const navOccupiesViewportTop = autoHideState === "revealed" || atTop;
29352
+ const navOccupiesViewportTop = autoHideState !== "hidden";
29340
29353
  const navbarOffsetPx = navHeight > 0 && navOccupiesViewportTop ? navHeight : 0;
29341
29354
  const cssVars = navbarOffsetPx > 0 ? {
29342
29355
  [beamNavbarLayoutHeightVar]: `${navbarOffsetPx}px`
@@ -29350,9 +29363,9 @@ function NavbarLayout(props) {
29350
29363
  }],
29351
29364
  width: ["w_var", {
29352
29365
  "--width": maybeCssVar67(__maybeInc33(innerWidth))
29353
- }],
29354
- transition: "transitionTop"
29366
+ }]
29355
29367
  };
29368
+ useTransitionAfterPaint(navMetricsRef, "top 200ms cubic-bezier(0.4, 0, 0.2, 1)");
29356
29369
  const bannerTop = `var(${beamEnvironmentBannerLayoutHeightVar}, 0px)`;
29357
29370
  const innerStyle = {
29358
29371
  top: autoHideState === "hidden" ? `calc(${bannerTop} - ${navHeight}px)` : bannerTop
@@ -29378,11 +29391,11 @@ function NavbarLayout(props) {
29378
29391
  import { useCallback as useCallback43, useMemo as useMemo58, useRef as useRef73 } from "react";
29379
29392
 
29380
29393
  // src/hooks/useDocumentTitle.tsx
29381
- import { useLayoutEffect as useLayoutEffect16 } from "react";
29394
+ import { useLayoutEffect as useLayoutEffect17 } from "react";
29382
29395
  function useDocumentTitle(...titleSegments) {
29383
29396
  const config = useDocumentTitleConfig();
29384
29397
  const pageTitle = joinDocumentTitleSegments(...titleSegments);
29385
- useLayoutEffect16(() => {
29398
+ useLayoutEffect17(() => {
29386
29399
  if (!config || !pageTitle || typeof document === "undefined") {
29387
29400
  return;
29388
29401
  }
@@ -29512,10 +29525,9 @@ function PageHeaderLayout(props) {
29512
29525
  const spacerRef = useRef73(null);
29513
29526
  const headerHeight = useMeasuredHeight(headerMetricsRef, true);
29514
29527
  const {
29515
- state: autoHideState,
29516
- atTop
29528
+ state: autoHideState
29517
29529
  } = useAutoHideOnScroll(spacerRef, true, getBannerAndNavbarHeight);
29518
- const headerOccupiesPosition = autoHideState === "revealed" || atTop;
29530
+ const headerOccupiesPosition = autoHideState !== "hidden";
29519
29531
  const cssVars = headerHeight > 0 && headerOccupiesPosition ? {
29520
29532
  [beamPageHeaderLayoutHeightVar]: `${headerHeight}px`
29521
29533
  } : void 0;
@@ -29532,9 +29544,9 @@ function PageHeaderLayout(props) {
29532
29544
  }],
29533
29545
  zIndex: ["z_var", {
29534
29546
  "--zIndex": maybeCssVar68(zIndices.pageStickyHeader)
29535
- }],
29536
- transition: "transitionAll"
29547
+ }]
29537
29548
  };
29549
+ useTransitionAfterPaint(headerMetricsRef, "all 200ms cubic-bezier(0.4, 0, 0.2, 1)");
29538
29550
  const innerStyle = {
29539
29551
  top: autoHideState === "hidden" ? `calc(${outerTop} - ${headerHeight}px)` : outerTop
29540
29552
  };
@@ -29550,12 +29562,12 @@ function PageHeaderLayout(props) {
29550
29562
  flexShrink: "fs0",
29551
29563
  width: "w100"
29552
29564
  }), children: /* @__PURE__ */ jsx236("div", { ref: headerMetricsRef, ...mergeProps42(void 0, innerStyle, innerCss), ...tid.pageHeader, children: pageHeaderEl }) }),
29553
- /* @__PURE__ */ jsx236("div", { className: "df fdc fg1 mh0 w100 mt3", ...tid.body, children })
29565
+ /* @__PURE__ */ jsx236("div", { className: "df fdc fg1 mh0 w100 first_child_n_data_self_top_spaced_mt3", ...tid.body, children })
29554
29566
  ] }) });
29555
29567
  }
29556
29568
 
29557
29569
  // src/layouts/Workflow/WorkflowPageLayout.tsx
29558
- import { useLayoutEffect as useLayoutEffect17, useRef as useRef75 } from "react";
29570
+ import { useLayoutEffect as useLayoutEffect18, useRef as useRef75 } from "react";
29559
29571
 
29560
29572
  // src/components/Headers/WorkflowHeader.tsx
29561
29573
  import { jsx as jsx237 } from "react/jsx-runtime";
@@ -29768,7 +29780,7 @@ function WorkflowPageLayout(props) {
29768
29780
  [beamPageHeaderLayoutHeightVar]: `${headerHeight}px`
29769
29781
  } : void 0;
29770
29782
  const showFooter = isMobile;
29771
- useLayoutEffect17(() => {
29783
+ useLayoutEffect18(() => {
29772
29784
  const root = document.documentElement;
29773
29785
  const previous = root.style.getPropertyValue(beamWorkflowLayoutFooterHeightVar);
29774
29786
  root.style.setProperty(beamWorkflowLayoutFooterHeightVar, showFooter ? `${mobileFooterHeightPx}px` : "0px");