@homebound/beam 3.71.0 → 3.72.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 +62 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +60 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26936,7 +26936,7 @@ function PageHeaderLayout(props) {
|
|
|
26936
26936
|
}
|
|
26937
26937
|
|
|
26938
26938
|
// src/layouts/WorkflowLayout/WorkflowLayout.tsx
|
|
26939
|
-
var
|
|
26939
|
+
var import_react156 = require("react");
|
|
26940
26940
|
|
|
26941
26941
|
// src/components/Headers/WorkflowHeader.tsx
|
|
26942
26942
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
@@ -26946,16 +26946,67 @@ function WorkflowHeader(props) {
|
|
|
26946
26946
|
return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(BaseHeader, { ...otherProps, bottomSlot: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(StepperTabs, { ...stepperTabs, ...tid.stepperTabs }) });
|
|
26947
26947
|
}
|
|
26948
26948
|
|
|
26949
|
-
// src/layouts/
|
|
26949
|
+
// src/layouts/useScrollCollapse.ts
|
|
26950
26950
|
var import_react154 = require("react");
|
|
26951
|
+
function useScrollCollapse(enabled, restingOffset) {
|
|
26952
|
+
const [collapsed, setCollapsed] = (0, import_react154.useState)(() => typeof window !== "undefined" && window.scrollY > 0);
|
|
26953
|
+
const collapsedRef = (0, import_react154.useRef)(collapsed);
|
|
26954
|
+
collapsedRef.current = collapsed;
|
|
26955
|
+
const restingOffsetRef = (0, import_react154.useRef)(restingOffset);
|
|
26956
|
+
restingOffsetRef.current = restingOffset;
|
|
26957
|
+
const lastScrollYRef = (0, import_react154.useRef)(Number.POSITIVE_INFINITY);
|
|
26958
|
+
const lastScrollHeightRef = (0, import_react154.useRef)(0);
|
|
26959
|
+
(0, import_react154.useLayoutEffect)(() => {
|
|
26960
|
+
lastScrollHeightRef.current = document.documentElement.scrollHeight;
|
|
26961
|
+
}, [restingOffset]);
|
|
26962
|
+
(0, import_react154.useLayoutEffect)(() => {
|
|
26963
|
+
if (!enabled) return;
|
|
26964
|
+
const commit = (next) => {
|
|
26965
|
+
if (next !== collapsedRef.current) {
|
|
26966
|
+
collapsedRef.current = next;
|
|
26967
|
+
setCollapsed(next);
|
|
26968
|
+
}
|
|
26969
|
+
};
|
|
26970
|
+
const updateCollapsed = () => {
|
|
26971
|
+
const doc = document.documentElement;
|
|
26972
|
+
const currentY = window.scrollY;
|
|
26973
|
+
if (currentY <= 0) {
|
|
26974
|
+
lastScrollYRef.current = 0;
|
|
26975
|
+
lastScrollHeightRef.current = doc.scrollHeight;
|
|
26976
|
+
commit(false);
|
|
26977
|
+
return;
|
|
26978
|
+
}
|
|
26979
|
+
const currentScrollHeight = doc.scrollHeight;
|
|
26980
|
+
const scrollHeightChanged = lastScrollHeightRef.current !== 0 && currentScrollHeight !== lastScrollHeightRef.current;
|
|
26981
|
+
const dy = currentY - lastScrollYRef.current;
|
|
26982
|
+
lastScrollYRef.current = currentY;
|
|
26983
|
+
lastScrollHeightRef.current = currentScrollHeight;
|
|
26984
|
+
if (currentY <= restingOffsetRef.current) return;
|
|
26985
|
+
if (scrollHeightChanged) {
|
|
26986
|
+
commit(true);
|
|
26987
|
+
return;
|
|
26988
|
+
}
|
|
26989
|
+
const atBottom = currentY >= doc.scrollHeight - doc.clientHeight;
|
|
26990
|
+
if (dy > 0) commit(true);
|
|
26991
|
+
else if (dy < 0 && !atBottom) commit(false);
|
|
26992
|
+
};
|
|
26993
|
+
updateCollapsed();
|
|
26994
|
+
window.addEventListener("scroll", updateCollapsed, { passive: true });
|
|
26995
|
+
return () => window.removeEventListener("scroll", updateCollapsed);
|
|
26996
|
+
}, [enabled]);
|
|
26997
|
+
return collapsed;
|
|
26998
|
+
}
|
|
26999
|
+
|
|
27000
|
+
// src/layouts/WorkflowLayout/useUnsavedChangesGuard.tsx
|
|
27001
|
+
var import_react155 = require("react");
|
|
26951
27002
|
var import_react_router_dom9 = require("react-router-dom");
|
|
26952
27003
|
var import_jsx_runtime216 = require("react/jsx-runtime");
|
|
26953
27004
|
function useUnsavedChangesGuard(options) {
|
|
26954
27005
|
const { isDirty, onCancel } = options;
|
|
26955
27006
|
const { openModal } = useModal();
|
|
26956
|
-
const isDirtyRef = (0,
|
|
27007
|
+
const isDirtyRef = (0, import_react155.useRef)(isDirty);
|
|
26957
27008
|
isDirtyRef.current = isDirty;
|
|
26958
|
-
(0,
|
|
27009
|
+
(0, import_react155.useEffect)(() => {
|
|
26959
27010
|
const onBeforeUnload = (e) => {
|
|
26960
27011
|
if (isDirtyRef.current?.()) {
|
|
26961
27012
|
e.preventDefault();
|
|
@@ -26981,7 +27032,7 @@ function useUnsavedChangesGuard(options) {
|
|
|
26981
27032
|
function UnsavedChangesNavigationModal(props) {
|
|
26982
27033
|
const { proceed, cancelNavigation } = props;
|
|
26983
27034
|
const { openModal, closeModal } = useModal();
|
|
26984
|
-
(0,
|
|
27035
|
+
(0, import_react155.useEffect)(() => {
|
|
26985
27036
|
openModal({
|
|
26986
27037
|
allowClosing: false,
|
|
26987
27038
|
content: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ConfirmCloseModal, { title: "Leave page?", onClose: proceed, onContinue: cancelNavigation })
|
|
@@ -27037,7 +27088,7 @@ function WorkflowLayout(props) {
|
|
|
27037
27088
|
...step,
|
|
27038
27089
|
value: defaultTestId(step.label)
|
|
27039
27090
|
}));
|
|
27040
|
-
const [currentStep, setCurrentStep] = (0,
|
|
27091
|
+
const [currentStep, setCurrentStep] = (0, import_react156.useState)(() => getInitialStep(tabSteps, defaultStep));
|
|
27041
27092
|
const tid = useTestIds(props, "workflowLayout");
|
|
27042
27093
|
const {
|
|
27043
27094
|
sm: isMobile
|
|
@@ -27049,9 +27100,11 @@ function WorkflowLayout(props) {
|
|
|
27049
27100
|
isDirty,
|
|
27050
27101
|
onCancel
|
|
27051
27102
|
});
|
|
27052
|
-
const
|
|
27103
|
+
const bannerAndNavbarHeight = useBannerAndNavbarHeight();
|
|
27104
|
+
const headerMetricsRef = (0, import_react156.useRef)(null);
|
|
27053
27105
|
const headerHeight = useMeasuredHeight(headerMetricsRef, true);
|
|
27054
|
-
const
|
|
27106
|
+
const scrollCollapsed = useScrollCollapse(!isMobile, bannerAndNavbarHeight + headerHeight);
|
|
27107
|
+
const collapsed = isMobile || scrollCollapsed;
|
|
27055
27108
|
const headerWidth = documentScrollChromeWidth();
|
|
27056
27109
|
const outerTop = bannerAndNavbarChromeTop();
|
|
27057
27110
|
const cssVars = headerHeight > 0 ? {
|
|
@@ -27070,7 +27123,7 @@ function WorkflowLayout(props) {
|
|
|
27070
27123
|
setCurrentStep(tabSteps[currentIndex + 1].value);
|
|
27071
27124
|
} });
|
|
27072
27125
|
const showFooter = isMobile;
|
|
27073
|
-
(0,
|
|
27126
|
+
(0, import_react156.useLayoutEffect)(() => {
|
|
27074
27127
|
const root = document.documentElement;
|
|
27075
27128
|
const previous = root.style.getPropertyValue(beamWorkflowLayoutFooterHeightVar);
|
|
27076
27129
|
root.style.setProperty(beamWorkflowLayoutFooterHeightVar, showFooter ? `${mobileFooterHeightPx}px` : "0px");
|