@homebound/beam 3.75.1 → 3.75.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.cjs CHANGED
@@ -27225,7 +27225,7 @@ function PageHeaderLayout(props) {
27225
27225
  }
27226
27226
 
27227
27227
  // src/layouts/WorkflowLayout/WorkflowLayout.tsx
27228
- var import_react159 = require("react");
27228
+ var import_react158 = require("react");
27229
27229
 
27230
27230
  // src/components/Headers/WorkflowHeader.tsx
27231
27231
  var import_jsx_runtime218 = require("react/jsx-runtime");
@@ -27235,67 +27235,16 @@ function WorkflowHeader(props) {
27235
27235
  return /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(BaseHeader, { ...otherProps, bottomSlot: /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(StepperTabs, { ...stepperTabs, ...tid.stepperTabs }) });
27236
27236
  }
27237
27237
 
27238
- // src/layouts/useScrollCollapse.ts
27239
- var import_react157 = require("react");
27240
- function useScrollCollapse(enabled, restingOffset) {
27241
- const [collapsed, setCollapsed] = (0, import_react157.useState)(() => typeof window !== "undefined" && window.scrollY > 0);
27242
- const collapsedRef = (0, import_react157.useRef)(collapsed);
27243
- collapsedRef.current = collapsed;
27244
- const restingOffsetRef = (0, import_react157.useRef)(restingOffset);
27245
- restingOffsetRef.current = restingOffset;
27246
- const lastScrollYRef = (0, import_react157.useRef)(Number.POSITIVE_INFINITY);
27247
- const lastScrollHeightRef = (0, import_react157.useRef)(0);
27248
- (0, import_react157.useLayoutEffect)(() => {
27249
- lastScrollHeightRef.current = document.documentElement.scrollHeight;
27250
- }, [restingOffset]);
27251
- (0, import_react157.useLayoutEffect)(() => {
27252
- if (!enabled) return;
27253
- const commit = (next) => {
27254
- if (next !== collapsedRef.current) {
27255
- collapsedRef.current = next;
27256
- setCollapsed(next);
27257
- }
27258
- };
27259
- const updateCollapsed = () => {
27260
- const doc = document.documentElement;
27261
- const currentY = window.scrollY;
27262
- if (currentY <= 0) {
27263
- lastScrollYRef.current = 0;
27264
- lastScrollHeightRef.current = doc.scrollHeight;
27265
- commit(false);
27266
- return;
27267
- }
27268
- const currentScrollHeight = doc.scrollHeight;
27269
- const scrollHeightChanged = lastScrollHeightRef.current !== 0 && currentScrollHeight !== lastScrollHeightRef.current;
27270
- const dy = currentY - lastScrollYRef.current;
27271
- lastScrollYRef.current = currentY;
27272
- lastScrollHeightRef.current = currentScrollHeight;
27273
- if (currentY <= restingOffsetRef.current) return;
27274
- if (scrollHeightChanged) {
27275
- commit(true);
27276
- return;
27277
- }
27278
- const atBottom = currentY >= doc.scrollHeight - doc.clientHeight;
27279
- if (dy > 0) commit(true);
27280
- else if (dy < 0 && !atBottom) commit(false);
27281
- };
27282
- updateCollapsed();
27283
- window.addEventListener("scroll", updateCollapsed, { passive: true });
27284
- return () => window.removeEventListener("scroll", updateCollapsed);
27285
- }, [enabled]);
27286
- return collapsed;
27287
- }
27288
-
27289
27238
  // src/layouts/WorkflowLayout/useUnsavedChangesGuard.tsx
27290
- var import_react158 = require("react");
27239
+ var import_react157 = require("react");
27291
27240
  var import_react_router_dom9 = require("react-router-dom");
27292
27241
  var import_jsx_runtime219 = require("react/jsx-runtime");
27293
27242
  function useUnsavedChangesGuard(options) {
27294
27243
  const { isDirty, onCancel } = options;
27295
27244
  const { openModal } = useModal();
27296
- const isDirtyRef = (0, import_react158.useRef)(isDirty);
27245
+ const isDirtyRef = (0, import_react157.useRef)(isDirty);
27297
27246
  isDirtyRef.current = isDirty;
27298
- (0, import_react158.useEffect)(() => {
27247
+ (0, import_react157.useEffect)(() => {
27299
27248
  const onBeforeUnload = (e) => {
27300
27249
  if (isDirtyRef.current?.()) {
27301
27250
  e.preventDefault();
@@ -27321,7 +27270,7 @@ function useUnsavedChangesGuard(options) {
27321
27270
  function UnsavedChangesNavigationModal(props) {
27322
27271
  const { proceed, cancelNavigation } = props;
27323
27272
  const { openModal, closeModal } = useModal();
27324
- (0, import_react158.useEffect)(() => {
27273
+ (0, import_react157.useEffect)(() => {
27325
27274
  openModal({
27326
27275
  allowClosing: false,
27327
27276
  content: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(ConfirmCloseModal, { title: "Leave page?", onClose: proceed, onContinue: cancelNavigation })
@@ -27377,7 +27326,7 @@ function WorkflowLayout(props) {
27377
27326
  ...step,
27378
27327
  value: defaultTestId(step.label)
27379
27328
  }));
27380
- const [currentStep, setCurrentStep] = (0, import_react159.useState)(() => getInitialStep(stepTabs, defaultStep));
27329
+ const [currentStep, setCurrentStep] = (0, import_react158.useState)(() => getInitialStep(stepTabs, defaultStep));
27381
27330
  const tid = useTestIds(props, "workflowLayout");
27382
27331
  const {
27383
27332
  sm: isMobile
@@ -27389,11 +27338,8 @@ function WorkflowLayout(props) {
27389
27338
  isDirty,
27390
27339
  onCancel
27391
27340
  });
27392
- const bannerAndNavbarHeight = useBannerAndNavbarHeight();
27393
- const headerMetricsRef = (0, import_react159.useRef)(null);
27341
+ const headerMetricsRef = (0, import_react158.useRef)(null);
27394
27342
  const headerHeight = useMeasuredHeight(headerMetricsRef, true);
27395
- const scrollCollapsed = useScrollCollapse(!isMobile, bannerAndNavbarHeight + headerHeight);
27396
- const collapsed = isMobile || scrollCollapsed;
27397
27343
  const headerWidth = documentScrollChromeWidth();
27398
27344
  const outerTop = bannerAndNavbarChromeTop();
27399
27345
  const cssVars = headerHeight > 0 ? {
@@ -27412,7 +27358,7 @@ function WorkflowLayout(props) {
27412
27358
  setCurrentStep(stepTabs[currentIndex + 1].value);
27413
27359
  } });
27414
27360
  const showFooter = isMobile;
27415
- (0, import_react159.useLayoutEffect)(() => {
27361
+ (0, import_react158.useLayoutEffect)(() => {
27416
27362
  const root = document.documentElement;
27417
27363
  const previous = root.style.getPropertyValue(beamWorkflowLayoutFooterHeightVar);
27418
27364
  root.style.setProperty(beamWorkflowLayoutFooterHeightVar, showFooter ? `${mobileFooterHeightPx}px` : "0px");
@@ -27424,12 +27370,19 @@ function WorkflowLayout(props) {
27424
27370
  }
27425
27371
  };
27426
27372
  }, [showFooter]);
27427
- const headerEl = /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(WorkflowHeader, { ...headerProps, rightSlot: isMobile ? void 0 : buttons, stepperTabs: {
27428
- steps: stepTabs,
27429
- currentStep,
27430
- onChange: setCurrentStep,
27431
- collapsed
27432
- } });
27373
+ const headerEl = /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
27374
+ WorkflowHeader,
27375
+ {
27376
+ ...headerProps,
27377
+ rightSlot: isMobile ? void 0 : buttons,
27378
+ stepperTabs: {
27379
+ steps: stepTabs,
27380
+ currentStep,
27381
+ onChange: setCurrentStep,
27382
+ collapsed: isMobile
27383
+ }
27384
+ }
27385
+ );
27433
27386
  return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(DocumentScrollLayoutProvider, { children: [
27434
27387
  /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)("div", { ...(0, import_runtime138.mergeProps)(void 0, cssVars, {
27435
27388
  display: "df",