@homebound/beam 3.71.0 → 3.72.1

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
@@ -25662,65 +25662,86 @@ function StepperTab(props) {
25662
25662
  ...stepperTabStyles.baseStyles,
25663
25663
  ...getStateStyles(active, completed),
25664
25664
  ...isHovered && !disabled ? stepperTabStyles.hoverStyles : {},
25665
- ...collapsed ? getCollapsedStyles(active, completed) : {},
25665
+ ...collapsed ? stepperTabStyles.collapsedStyles : {},
25666
25666
  ...disabled ? stepperTabStyles.disabledStyles : {},
25667
25667
  ...isFocusVisible ? stepperTabStyles.focusRingStyles : {}
25668
25668
  }), ...tid[defaultTestId(value)], children: [
25669
- /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { className: "oh d_negwebkit_box wbo_vertical to_ellipsis wlc_1", children: label }),
25670
- completed && /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { className: "fs0 ml1", children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(Icon, { icon: "check", inc: 2.5, ...tid.check }) }),
25669
+ !collapsed && /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(import_jsx_runtime200.Fragment, { children: [
25670
+ /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)("span", { className: "dg jic mw0", children: [
25671
+ /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { className: "fw6 fz_14px lh_20px visibility_hidden gridArea_1_1 oh d_negwebkit_box wbo_vertical to_ellipsis wlc_1 wordBreak_break_all", "aria-hidden": true, children: label }),
25672
+ /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { ...(0, import_runtime123.trussProps)({
25673
+ gridArea: "gridArea_1_1",
25674
+ overflow: "oh",
25675
+ display: "d_negwebkit_box",
25676
+ WebkitBoxOrient: "wbo_vertical",
25677
+ textOverflow: "to_ellipsis",
25678
+ WebkitLineClamp: "wlc_1",
25679
+ wordBreak: "wordBreak_break_all",
25680
+ ...active ? {
25681
+ fontWeight: "fw6",
25682
+ fontSize: "fz_14px",
25683
+ lineHeight: "lh_20px"
25684
+ } : {}
25685
+ }), children: label })
25686
+ ] }),
25687
+ /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { ...(0, import_runtime123.trussProps)({
25688
+ flexShrink: "fs0",
25689
+ marginLeft: "ml1",
25690
+ transition: "transitionAll",
25691
+ opacity: "o0",
25692
+ transform: "transform_scale_0_75_translateY_100",
25693
+ ...completed ? {
25694
+ opacity: "o100",
25695
+ transform: "transform_scale_1_translateY_0"
25696
+ } : {}
25697
+ }), children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(Icon, { icon: "check", inc: 2.5, ...tid.check }) })
25698
+ ] }),
25699
+ /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { "aria-hidden": true, ...(0, import_runtime123.trussProps)(getIndicatorStyles(active, completed, disabled)), ...tid.indicator }),
25671
25700
  /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(import_react_aria63.VisuallyHidden, { children: completed ? "Complete" : "Not Complete" })
25672
25701
  ] });
25673
25702
  }
25674
- function withBorderBottom(color) {
25703
+ function getStateStyles(active, completed) {
25675
25704
  return {
25676
- ...{
25677
- borderBottomStyle: "bbs_solid",
25678
- borderBottomWidth: ["borderBottomWidth_var", {
25679
- "--borderBottomWidth": (0, import_runtime123.maybeCssVar)(`3px`)
25705
+ color: ["color_var", {
25706
+ "--color": "var(--b-on-surface-muted)"
25707
+ }],
25708
+ ...active || completed ? {
25709
+ color: ["color_var", {
25710
+ "--color": "var(--b-choice-selected)"
25680
25711
  }]
25681
- },
25682
- ...color
25712
+ } : {}
25683
25713
  };
25684
25714
  }
25685
- function getStateStyles(active, completed) {
25715
+ function getIndicatorStyles(active, completed, disabled) {
25686
25716
  return {
25687
25717
  ...{
25688
- color: "gray400",
25689
- ...active || completed ? {
25690
- color: "blue700"
25691
- } : {},
25692
- ...active ? {
25693
- fontWeight: "fw6",
25694
- fontSize: "fz_14px",
25695
- lineHeight: "lh_20px"
25718
+ position: "absolute",
25719
+ left: "left0",
25720
+ right: "right0",
25721
+ bottom: "bottom0",
25722
+ height: ["h_var", {
25723
+ "--height": `${active ? activeIndicatorHeightPx : inactiveIndicatorHeightPx}px`
25724
+ }],
25725
+ backgroundColor: ["bgColor_var", {
25726
+ "--backgroundColor": "var(--b-field-border-default)"
25727
+ }],
25728
+ ...(active || completed) && !disabled ? {
25729
+ backgroundColor: ["bgColor_var", {
25730
+ "--backgroundColor": "var(--b-primary)"
25731
+ }]
25696
25732
  } : {}
25697
- },
25698
- ...withBorderBottom(active || completed ? {
25699
- borderColor: "bcBlue600"
25700
- } : {
25701
- borderColor: "bcGray300"
25702
- })
25703
- };
25704
- }
25705
- function getCollapsedStyles(active, completed) {
25706
- return {
25707
- ...{
25708
- cursor: "cursor_default",
25709
- height: "h_0px",
25710
- paddingTop: "pt0",
25711
- paddingBottom: "pb0"
25712
- },
25713
- ...active || completed ? {
25714
- borderColor: "bcBlue600"
25715
- } : {
25716
- borderColor: "bcGray300"
25717
25733
  }
25718
25734
  };
25719
25735
  }
25736
+ var activeIndicatorHeightPx = 3;
25737
+ var inactiveIndicatorHeightPx = 2;
25720
25738
  var stepperTabStyles = {
25739
+ // No overflow:hidden — collapsed indicators are absolute and must paint outside the 0-height box.
25721
25740
  baseStyles: {
25741
+ position: "relative",
25722
25742
  display: "df",
25723
25743
  alignItems: "aic",
25744
+ justifyContent: "jcfs",
25724
25745
  flexGrow: "fg1",
25725
25746
  paddingTop: "pt1",
25726
25747
  paddingBottom: "pb1",
@@ -25729,10 +25750,11 @@ var stepperTabStyles = {
25729
25750
  fontWeight: "fw4",
25730
25751
  fontSize: "fz_14px",
25731
25752
  lineHeight: "lh_20px",
25732
- overflow: "oh",
25753
+ color: ["color_var", {
25754
+ "--color": "var(--b-on-surface-muted)"
25755
+ }],
25733
25756
  textAlign: "tal",
25734
- height: "h_48px",
25735
- transition: "transitionAll"
25757
+ height: "h_40px"
25736
25758
  },
25737
25759
  hoverStyles: {
25738
25760
  backgroundColor: "bgGray100"
@@ -25741,11 +25763,17 @@ var stepperTabStyles = {
25741
25763
  boxShadow: "bshFocus",
25742
25764
  outline: "outline0"
25743
25765
  },
25744
- // Disabled always wins over both the state's and the collapsed border color.
25766
+ collapsedStyles: {
25767
+ cursor: "cursor_default",
25768
+ height: "h_0px",
25769
+ paddingTop: "pt0",
25770
+ paddingBottom: "pb0"
25771
+ },
25745
25772
  disabledStyles: {
25746
- color: "gray400",
25747
- cursor: "cursorNotAllowed",
25748
- borderColor: "bcGray300"
25773
+ color: ["color_var", {
25774
+ "--color": "var(--b-text-disabled)"
25775
+ }],
25776
+ cursor: "cursorNotAllowed"
25749
25777
  }
25750
25778
  };
25751
25779
 
@@ -25766,6 +25794,7 @@ function StepperTabs(props) {
25766
25794
  } = useBreakpoint();
25767
25795
  const collapsed = isMobile || !!forceCollapsed;
25768
25796
  const capWidth = steps.length <= 3;
25797
+ const currentStepIndex = Math.max(0, steps.findIndex((step) => step.value === currentStep));
25769
25798
  return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("nav", { "aria-label": "steps", className: "w100", ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("ol", { ...(0, import_runtime124.trussProps)({
25770
25799
  padding: "p_0",
25771
25800
  margin: "m_0",
@@ -25778,8 +25807,9 @@ function StepperTabs(props) {
25778
25807
  borderBottomStyle: "bbs_solid",
25779
25808
  borderBottomWidth: "bbw_1px",
25780
25809
  borderColor: "bcGray400"
25781
- }), children: steps.map((step) => {
25782
- const isCurrent = step.value === currentStep;
25810
+ }), children: steps.map((step, idx) => {
25811
+ const isCurrent = idx === currentStepIndex;
25812
+ const isCompleted = idx < currentStepIndex;
25783
25813
  return /* @__PURE__ */ (0, import_react145.createElement)("li", { ...(0, import_runtime124.trussProps)({
25784
25814
  display: "df",
25785
25815
  flexGrow: "fg1",
@@ -25792,7 +25822,7 @@ function StepperTabs(props) {
25792
25822
  "--maxWidth": `${maxStepWidthPx}px`
25793
25823
  }]
25794
25824
  } : {}
25795
- }), key: step.value, "aria-current": isCurrent, ...tid.step }, /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(StepperTab, { label: step.label, value: step.value, active: isCurrent, completed: step.completed, disabled: step.disabled, collapsed, onClick: onChange, ...tid.tab }));
25825
+ }), key: step.value, "aria-current": isCurrent, ...tid.step }, /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(StepperTab, { label: step.label, value: step.value, active: isCurrent, completed: isCompleted, disabled: step.disabled, collapsed, onClick: onChange, ...tid.tab }));
25796
25826
  }) }) });
25797
25827
  }
25798
25828
  var maxStepWidthPx = 280;
@@ -26936,7 +26966,7 @@ function PageHeaderLayout(props) {
26936
26966
  }
26937
26967
 
26938
26968
  // src/layouts/WorkflowLayout/WorkflowLayout.tsx
26939
- var import_react155 = require("react");
26969
+ var import_react156 = require("react");
26940
26970
 
26941
26971
  // src/components/Headers/WorkflowHeader.tsx
26942
26972
  var import_jsx_runtime215 = require("react/jsx-runtime");
@@ -26946,16 +26976,67 @@ function WorkflowHeader(props) {
26946
26976
  return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(BaseHeader, { ...otherProps, bottomSlot: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(StepperTabs, { ...stepperTabs, ...tid.stepperTabs }) });
26947
26977
  }
26948
26978
 
26949
- // src/layouts/WorkflowLayout/useUnsavedChangesGuard.tsx
26979
+ // src/layouts/useScrollCollapse.ts
26950
26980
  var import_react154 = require("react");
26981
+ function useScrollCollapse(enabled, restingOffset) {
26982
+ const [collapsed, setCollapsed] = (0, import_react154.useState)(() => typeof window !== "undefined" && window.scrollY > 0);
26983
+ const collapsedRef = (0, import_react154.useRef)(collapsed);
26984
+ collapsedRef.current = collapsed;
26985
+ const restingOffsetRef = (0, import_react154.useRef)(restingOffset);
26986
+ restingOffsetRef.current = restingOffset;
26987
+ const lastScrollYRef = (0, import_react154.useRef)(Number.POSITIVE_INFINITY);
26988
+ const lastScrollHeightRef = (0, import_react154.useRef)(0);
26989
+ (0, import_react154.useLayoutEffect)(() => {
26990
+ lastScrollHeightRef.current = document.documentElement.scrollHeight;
26991
+ }, [restingOffset]);
26992
+ (0, import_react154.useLayoutEffect)(() => {
26993
+ if (!enabled) return;
26994
+ const commit = (next) => {
26995
+ if (next !== collapsedRef.current) {
26996
+ collapsedRef.current = next;
26997
+ setCollapsed(next);
26998
+ }
26999
+ };
27000
+ const updateCollapsed = () => {
27001
+ const doc = document.documentElement;
27002
+ const currentY = window.scrollY;
27003
+ if (currentY <= 0) {
27004
+ lastScrollYRef.current = 0;
27005
+ lastScrollHeightRef.current = doc.scrollHeight;
27006
+ commit(false);
27007
+ return;
27008
+ }
27009
+ const currentScrollHeight = doc.scrollHeight;
27010
+ const scrollHeightChanged = lastScrollHeightRef.current !== 0 && currentScrollHeight !== lastScrollHeightRef.current;
27011
+ const dy = currentY - lastScrollYRef.current;
27012
+ lastScrollYRef.current = currentY;
27013
+ lastScrollHeightRef.current = currentScrollHeight;
27014
+ if (currentY <= restingOffsetRef.current) return;
27015
+ if (scrollHeightChanged) {
27016
+ commit(true);
27017
+ return;
27018
+ }
27019
+ const atBottom = currentY >= doc.scrollHeight - doc.clientHeight;
27020
+ if (dy > 0) commit(true);
27021
+ else if (dy < 0 && !atBottom) commit(false);
27022
+ };
27023
+ updateCollapsed();
27024
+ window.addEventListener("scroll", updateCollapsed, { passive: true });
27025
+ return () => window.removeEventListener("scroll", updateCollapsed);
27026
+ }, [enabled]);
27027
+ return collapsed;
27028
+ }
27029
+
27030
+ // src/layouts/WorkflowLayout/useUnsavedChangesGuard.tsx
27031
+ var import_react155 = require("react");
26951
27032
  var import_react_router_dom9 = require("react-router-dom");
26952
27033
  var import_jsx_runtime216 = require("react/jsx-runtime");
26953
27034
  function useUnsavedChangesGuard(options) {
26954
27035
  const { isDirty, onCancel } = options;
26955
27036
  const { openModal } = useModal();
26956
- const isDirtyRef = (0, import_react154.useRef)(isDirty);
27037
+ const isDirtyRef = (0, import_react155.useRef)(isDirty);
26957
27038
  isDirtyRef.current = isDirty;
26958
- (0, import_react154.useEffect)(() => {
27039
+ (0, import_react155.useEffect)(() => {
26959
27040
  const onBeforeUnload = (e) => {
26960
27041
  if (isDirtyRef.current?.()) {
26961
27042
  e.preventDefault();
@@ -26981,7 +27062,7 @@ function useUnsavedChangesGuard(options) {
26981
27062
  function UnsavedChangesNavigationModal(props) {
26982
27063
  const { proceed, cancelNavigation } = props;
26983
27064
  const { openModal, closeModal } = useModal();
26984
- (0, import_react154.useEffect)(() => {
27065
+ (0, import_react155.useEffect)(() => {
26985
27066
  openModal({
26986
27067
  allowClosing: false,
26987
27068
  content: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ConfirmCloseModal, { title: "Leave page?", onClose: proceed, onContinue: cancelNavigation })
@@ -27033,11 +27114,11 @@ function WorkflowLayout(props) {
27033
27114
  isDirty,
27034
27115
  ...headerProps
27035
27116
  } = props;
27036
- const tabSteps = steps.map((step) => ({
27117
+ const stepTabs = steps.map((step) => ({
27037
27118
  ...step,
27038
27119
  value: defaultTestId(step.label)
27039
27120
  }));
27040
- const [currentStep, setCurrentStep] = (0, import_react155.useState)(() => getInitialStep(tabSteps, defaultStep));
27121
+ const [currentStep, setCurrentStep] = (0, import_react156.useState)(() => getInitialStep(stepTabs, defaultStep));
27041
27122
  const tid = useTestIds(props, "workflowLayout");
27042
27123
  const {
27043
27124
  sm: isMobile
@@ -27049,28 +27130,30 @@ function WorkflowLayout(props) {
27049
27130
  isDirty,
27050
27131
  onCancel
27051
27132
  });
27052
- const headerMetricsRef = (0, import_react155.useRef)(null);
27133
+ const bannerAndNavbarHeight = useBannerAndNavbarHeight();
27134
+ const headerMetricsRef = (0, import_react156.useRef)(null);
27053
27135
  const headerHeight = useMeasuredHeight(headerMetricsRef, true);
27054
- const collapsed = isMobile;
27136
+ const scrollCollapsed = useScrollCollapse(!isMobile, bannerAndNavbarHeight + headerHeight);
27137
+ const collapsed = isMobile || scrollCollapsed;
27055
27138
  const headerWidth = documentScrollChromeWidth();
27056
27139
  const outerTop = bannerAndNavbarChromeTop();
27057
27140
  const cssVars = headerHeight > 0 ? {
27058
27141
  [beamPageHeaderLayoutHeightVar]: `${headerHeight}px`
27059
27142
  } : void 0;
27060
- const currentIndex = isValidStep(tabSteps, currentStep) ? tabSteps.findIndex((step) => step.value === currentStep) : 0;
27143
+ const currentIndex = isValidStep(stepTabs, currentStep) ? stepTabs.findIndex((step) => step.value === currentStep) : 0;
27061
27144
  const isFirstStep = currentIndex <= 0;
27062
- const isLastStep = currentIndex === tabSteps.length - 1;
27063
- const activeStep = tabSteps[currentIndex];
27064
- const buttons = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(WorkflowActions, { isFirstStep, isLastStep, isMobile, onBack: () => setCurrentStep(tabSteps[currentIndex - 1].value), onCancel: onCancelClick, onSaveAndExit, completeLabel, onComplete, primaryDisabled: !activeStep?.completed, onContinue: async () => {
27145
+ const isLastStep = currentIndex === stepTabs.length - 1;
27146
+ const activeStep = stepTabs[currentIndex];
27147
+ const buttons = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(WorkflowActions, { isFirstStep, isLastStep, isMobile, onBack: () => setCurrentStep(stepTabs[currentIndex - 1].value), onCancel: onCancelClick, onSaveAndExit, completeLabel, onComplete, primaryDisabled: !activeStep?.isValid, onContinue: async () => {
27065
27148
  const onContinue = activeStep?.onContinue;
27066
27149
  if (onContinue) {
27067
27150
  const allowed = await onContinue();
27068
27151
  if (allowed === false) return;
27069
27152
  }
27070
- setCurrentStep(tabSteps[currentIndex + 1].value);
27153
+ setCurrentStep(stepTabs[currentIndex + 1].value);
27071
27154
  } });
27072
27155
  const showFooter = isMobile;
27073
- (0, import_react155.useLayoutEffect)(() => {
27156
+ (0, import_react156.useLayoutEffect)(() => {
27074
27157
  const root = document.documentElement;
27075
27158
  const previous = root.style.getPropertyValue(beamWorkflowLayoutFooterHeightVar);
27076
27159
  root.style.setProperty(beamWorkflowLayoutFooterHeightVar, showFooter ? `${mobileFooterHeightPx}px` : "0px");
@@ -27083,7 +27166,7 @@ function WorkflowLayout(props) {
27083
27166
  };
27084
27167
  }, [showFooter]);
27085
27168
  const headerEl = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(WorkflowHeader, { ...headerProps, rightSlot: isMobile ? void 0 : buttons, stepperTabs: {
27086
- steps: tabSteps,
27169
+ steps: stepTabs,
27087
27170
  currentStep,
27088
27171
  onChange: setCurrentStep,
27089
27172
  collapsed