@homebound/beam 3.101.1 → 3.103.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.js CHANGED
@@ -21474,9 +21474,20 @@ import { jsx as jsx149 } from "react/jsx-runtime";
21474
21474
  function HeaderActions(props) {
21475
21475
  const {
21476
21476
  actions,
21477
+ collapseOnSm = false,
21477
21478
  ...otherProps
21478
21479
  } = props;
21479
21480
  const tid = useTestIds(otherProps, "headerActions");
21481
+ const {
21482
+ sm
21483
+ } = useBreakpoint();
21484
+ const collapse = collapseOnSm && sm && actions.length > 1;
21485
+ if (collapse) {
21486
+ return /* @__PURE__ */ jsx149("div", { className: "df aic gap1 fs0", ...tid, children: /* @__PURE__ */ jsx149(ButtonMenu, { trigger: {
21487
+ icon: "verticalDots",
21488
+ variant: "outline"
21489
+ }, items: toMenuItems(actions) }) });
21490
+ }
21480
21491
  return /* @__PURE__ */ jsx149("div", { className: "df aic gap1 fs0", ...tid, children: actions.map((action, i) => {
21481
21492
  const key = headerActionKey(action, i);
21482
21493
  if (action.kind === "icon") {
@@ -21496,7 +21507,38 @@ function HeaderActions(props) {
21496
21507
  function headerActionKey(action, index) {
21497
21508
  if (action.kind === "icon") return `${action.icon}-${index}`;
21498
21509
  if (action.kind === "menu") return `menu-${index}`;
21499
- return `${String(action.label)}-${index}`;
21510
+ return `${action.label}-${index}`;
21511
+ }
21512
+ function toMenuItems(actions) {
21513
+ return actions.flatMap((action) => {
21514
+ if (action.kind === "menu") return action.items;
21515
+ const {
21516
+ label,
21517
+ onClick,
21518
+ disabled
21519
+ } = action;
21520
+ const itemOnClick = typeof onClick === "string" ? onClick : () => void onClick({});
21521
+ if (action.kind === "icon") {
21522
+ return [{
21523
+ label,
21524
+ onClick: itemOnClick,
21525
+ disabled,
21526
+ icon: action.icon
21527
+ }];
21528
+ }
21529
+ return [{
21530
+ label,
21531
+ onClick: itemOnClick,
21532
+ disabled,
21533
+ // Buttons can opt out of their default icon with `icon: null`, which menu items can't render.
21534
+ ...action.icon ? {
21535
+ icon: action.icon
21536
+ } : {},
21537
+ ...action.variant === "danger" ? {
21538
+ destructive: true
21539
+ } : {}
21540
+ }];
21541
+ });
21500
21542
  }
21501
21543
 
21502
21544
  // src/components/Headers/ContentHeader.tsx
@@ -27881,8 +27923,72 @@ function EnvironmentBannerLayout(props) {
27881
27923
  }
27882
27924
 
27883
27925
  // src/layouts/FormSectionLayout/FormSectionLayout.tsx
27884
- import { trussProps as trussProps133 } from "@homebound/truss/runtime";
27885
- import { jsx as jsx229, jsxs as jsxs120 } from "react/jsx-runtime";
27926
+ import { trussProps as trussProps134, maybeCssVar as maybeCssVar67 } from "@homebound/truss/runtime";
27927
+
27928
+ // src/layouts/FormSectionLayout/JumpLinksRail.tsx
27929
+ import { trussProps as trussProps133, maybeCssVar as maybeCssVar66 } from "@homebound/truss/runtime";
27930
+ import { jsx as jsx229 } from "react/jsx-runtime";
27931
+ var __maybeInc31 = (inc) => {
27932
+ return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
27933
+ };
27934
+ function JumpLinksRail(props) {
27935
+ const {
27936
+ links,
27937
+ activeId
27938
+ } = props;
27939
+ const tid = useTestIds(props, "jumpLinks");
27940
+ return /* @__PURE__ */ jsx229("nav", { ...trussProps133({
27941
+ display: "df",
27942
+ flexDirection: "fdc",
27943
+ flexShrink: "fs0",
27944
+ width: ["w_var", {
27945
+ "--width": `${jumpLinksRailWidthPx}px`
27946
+ }],
27947
+ position: "sticky",
27948
+ alignSelf: "asfs",
27949
+ top: ["top_var", {
27950
+ "--top": maybeCssVar66(__maybeInc31(stickyNavAndHeaderOffset()))
27951
+ }]
27952
+ }), ...tid, children: links.map((link) => /* @__PURE__ */ jsx229(JumpLink, { label: link.label, href: `#${link.id}`, active: link.id === activeId, ...tid.link }, link.id)) });
27953
+ }
27954
+ var jumpLinksRailWidthPx = 192;
27955
+ var railAndShellPx = centeredShellMaxPx.sm + jumpLinksRailWidthPx;
27956
+ var jumpLinksRailReservation = `clamp(0px, 100% - ${railAndShellPx}px, ${jumpLinksRailWidthPx}px)`;
27957
+
27958
+ // src/layouts/FormSectionLayout/useActiveJumpLink.ts
27959
+ import { useLayoutEffect as useLayoutEffect12, useState as useState61 } from "react";
27960
+ var activationLeadPx = 120;
27961
+ function useActiveJumpLink(sectionIds) {
27962
+ const idsKey = sectionIds.join("\0");
27963
+ const [activeId, setActiveId] = useState61(sectionIds[0]);
27964
+ useLayoutEffect12(() => {
27965
+ const ids = idsKey.length === 0 ? [] : idsKey.split("\0");
27966
+ if (ids.length === 0) return;
27967
+ const update = () => {
27968
+ const first = ids.map((id) => document.getElementById(id)).find((el) => el !== null);
27969
+ if (!first) return;
27970
+ const headerOffset = stickyNavAndHeaderOffsetPx(first);
27971
+ let current = ids[0];
27972
+ for (const id of ids) {
27973
+ const el = document.getElementById(id);
27974
+ if (el && el.getBoundingClientRect().top - headerOffset <= activationLeadPx) {
27975
+ current = id;
27976
+ }
27977
+ }
27978
+ setActiveId(current);
27979
+ };
27980
+ update();
27981
+ window.addEventListener("scroll", update, { passive: true });
27982
+ return () => window.removeEventListener("scroll", update);
27983
+ }, [idsKey]);
27984
+ return sectionIds.includes(activeId ?? "") ? activeId : sectionIds[0];
27985
+ }
27986
+
27987
+ // src/layouts/FormSectionLayout/FormSectionLayout.tsx
27988
+ import { jsx as jsx230, jsxs as jsxs120 } from "react/jsx-runtime";
27989
+ var __maybeInc32 = (inc) => {
27990
+ return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
27991
+ };
27886
27992
  function FormSectionLayout(props) {
27887
27993
  const {
27888
27994
  title,
@@ -27891,10 +27997,23 @@ function FormSectionLayout(props) {
27891
27997
  withAutoSave,
27892
27998
  initialFields,
27893
27999
  sections,
27894
- aiMode = false
28000
+ aiMode = false,
28001
+ withJumpLinks = false
27895
28002
  } = props;
27896
28003
  const tid = useTestIds(props, "formSectionLayout");
27897
- const content = /* @__PURE__ */ jsxs120("div", { ...trussProps133({
28004
+ const {
28005
+ sm: isMobile
28006
+ } = useBreakpoint();
28007
+ const jumpLinks = (sections ?? []).filter((section) => !section.excludeJumpLink).map((section) => {
28008
+ const id = defaultTestId(section.title);
28009
+ return {
28010
+ id,
28011
+ label: section.title
28012
+ };
28013
+ });
28014
+ const showRail = withJumpLinks && jumpLinks.length >= 2 && !isMobile;
28015
+ const activeId = useActiveJumpLink(showRail ? jumpLinks.map((link) => link.id) : []);
28016
+ const content = /* @__PURE__ */ jsxs120("div", { ...trussProps134({
27898
28017
  display: "df",
27899
28018
  flexDirection: "fdc",
27900
28019
  gap: "gap8",
@@ -27906,20 +28025,33 @@ function FormSectionLayout(props) {
27906
28025
  } : {}
27907
28026
  }), children: [
27908
28027
  /* @__PURE__ */ jsxs120("div", { className: "df fdc gap3", children: [
27909
- /* @__PURE__ */ jsx229(ContentHeader, { ...tid, title, description, actions, withAutoSave, level: 2, aiMode }),
28028
+ /* @__PURE__ */ jsx230(ContentHeader, { ...tid, title, description, actions, withAutoSave, level: 2, aiMode }),
27910
28029
  initialFields
27911
28030
  ] }),
27912
- sections && /* @__PURE__ */ jsx229("div", { className: "df fdc gap8", children: sections.map((section, i) => /* @__PURE__ */ jsx229(FormSection, { ...section }, defaultTestId(section.title) || i)) })
28031
+ sections && /* @__PURE__ */ jsx230("div", { className: "df fdc gap8", children: sections.map((section, i) => /* @__PURE__ */ jsx230(FormSection, { ...section }, defaultTestId(section.title) || i)) })
28032
+ ] });
28033
+ const form = /* @__PURE__ */ jsx230(CenteredLayout, { size: "sm", children: aiMode ? /* @__PURE__ */ jsx230(AiCard, { size: "lg", ...tid, children: content }) : content });
28034
+ if (!showRail) {
28035
+ return /* @__PURE__ */ jsx230("div", { className: "mb4", children: form });
28036
+ }
28037
+ return /* @__PURE__ */ jsxs120("div", { className: "df w100 mb4", children: [
28038
+ /* @__PURE__ */ jsx230(JumpLinksRail, { links: jumpLinks, activeId, ...tid.jumpLinks }),
28039
+ /* @__PURE__ */ jsx230("div", { ...trussProps134({
28040
+ flexGrow: "fg1",
28041
+ minWidth: "mw0",
28042
+ marginRight: ["mr_var", {
28043
+ "--marginRight": maybeCssVar67(__maybeInc32(jumpLinksRailReservation))
28044
+ }]
28045
+ }), ...tid.column, children: form })
27913
28046
  ] });
27914
- return /* @__PURE__ */ jsx229(CenteredLayout, { size: "sm", children: aiMode ? /* @__PURE__ */ jsx229(AiCard, { size: "lg", ...tid, children: content }) : content });
27915
28047
  }
27916
28048
 
27917
28049
  // src/layouts/NavbarLayout/NavbarLayout.tsx
27918
28050
  import { useMemo as useMemo57, useRef as useRef69 } from "react";
27919
- import { mergeProps as mergeProps39, maybeCssVar as maybeCssVar66 } from "@homebound/truss/runtime";
28051
+ import { mergeProps as mergeProps39, maybeCssVar as maybeCssVar68 } from "@homebound/truss/runtime";
27920
28052
 
27921
28053
  // src/layouts/useAutoHideOnScroll.ts
27922
- import { useLayoutEffect as useLayoutEffect12, useRef as useRef68, useState as useState61 } from "react";
28054
+ import { useLayoutEffect as useLayoutEffect13, useRef as useRef68, useState as useState62 } from "react";
27923
28055
  var THRESHOLD = 80;
27924
28056
  function getInitialAutoHideState() {
27925
28057
  if (typeof window === "undefined" || window.scrollY <= 0) {
@@ -27929,15 +28061,15 @@ function getInitialAutoHideState() {
27929
28061
  }
27930
28062
  function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
27931
28063
  const initial = getInitialAutoHideState();
27932
- const [state, setState] = useState61(initial.state);
28064
+ const [state, setState] = useState62(initial.state);
27933
28065
  const stateRef = useRef68(initial.state);
27934
- const [atTop, setAtTop] = useState61(initial.atTop);
28066
+ const [atTop, setAtTop] = useState62(initial.atTop);
27935
28067
  const atTopRef = useRef68(initial.atTop);
27936
28068
  const getTopOffsetRef = useRef68(getTopOffset);
27937
28069
  getTopOffsetRef.current = getTopOffset;
27938
28070
  const lastScrollY = useRef68(Number.POSITIVE_INFINITY);
27939
28071
  const lastScrollHeight = useRef68(0);
27940
- useLayoutEffect12(() => {
28072
+ useLayoutEffect13(() => {
27941
28073
  if (!enabled) {
27942
28074
  stateRef.current = "static";
27943
28075
  atTopRef.current = true;
@@ -28010,16 +28142,16 @@ function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
28010
28142
 
28011
28143
  // src/layouts/useMeasuredHeight.ts
28012
28144
  import { useResizeObserver as useResizeObserver12 } from "@react-aria/utils";
28013
- import { useCallback as useCallback41, useLayoutEffect as useLayoutEffect13, useState as useState62 } from "react";
28145
+ import { useCallback as useCallback41, useLayoutEffect as useLayoutEffect14, useState as useState63 } from "react";
28014
28146
  function useMeasuredHeight(ref, enabled) {
28015
- const [height, setHeight] = useState62(0);
28147
+ const [height, setHeight] = useState63(0);
28016
28148
  const syncElementHeight = useCallback41(() => {
28017
28149
  const el = ref.current;
28018
28150
  const next = el ? Math.round(el.getBoundingClientRect().height) : 0;
28019
28151
  setHeight((prev) => prev === next ? prev : next);
28020
28152
  }, [ref]);
28021
28153
  useResizeObserver12({ ref, onResize: syncElementHeight });
28022
- useLayoutEffect13(() => {
28154
+ useLayoutEffect14(() => {
28023
28155
  syncElementHeight();
28024
28156
  }, [enabled, syncElementHeight]);
28025
28157
  return height;
@@ -28027,18 +28159,18 @@ function useMeasuredHeight(ref, enabled) {
28027
28159
 
28028
28160
  // src/layouts/NavbarLayout/NavbarLayoutHeightContext.tsx
28029
28161
  import { createContext as createContext16, useContext as useContext28 } from "react";
28030
- import { jsx as jsx230 } from "react/jsx-runtime";
28162
+ import { jsx as jsx231 } from "react/jsx-runtime";
28031
28163
  var NavbarLayoutHeightContext = createContext16(0);
28032
28164
  function NavbarLayoutHeightProvider({ value, children }) {
28033
- return /* @__PURE__ */ jsx230(NavbarLayoutHeightContext.Provider, { value, children });
28165
+ return /* @__PURE__ */ jsx231(NavbarLayoutHeightContext.Provider, { value, children });
28034
28166
  }
28035
28167
  function useNavbarLayoutHeight() {
28036
28168
  return useContext28(NavbarLayoutHeightContext);
28037
28169
  }
28038
28170
 
28039
28171
  // src/layouts/NavbarLayout/NavbarLayout.tsx
28040
- import { jsx as jsx231, jsxs as jsxs121 } from "react/jsx-runtime";
28041
- var __maybeInc31 = (inc) => {
28172
+ import { jsx as jsx232, jsxs as jsxs121 } from "react/jsx-runtime";
28173
+ var __maybeInc33 = (inc) => {
28042
28174
  return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
28043
28175
  };
28044
28176
  function NavbarLayout(props) {
@@ -28066,10 +28198,10 @@ function NavbarLayout(props) {
28066
28198
  position: "sticky",
28067
28199
  left: "left0",
28068
28200
  zIndex: ["z_var", {
28069
- "--zIndex": maybeCssVar66(zIndices.navbar)
28201
+ "--zIndex": maybeCssVar68(zIndices.navbar)
28070
28202
  }],
28071
28203
  width: ["w_var", {
28072
- "--width": maybeCssVar66(__maybeInc31(innerWidth))
28204
+ "--width": maybeCssVar68(__maybeInc33(innerWidth))
28073
28205
  }]
28074
28206
  }
28075
28207
  ) : (
@@ -28078,10 +28210,10 @@ function NavbarLayout(props) {
28078
28210
  position: "fixed",
28079
28211
  left: "left0",
28080
28212
  zIndex: ["z_var", {
28081
- "--zIndex": maybeCssVar66(zIndices.navbar)
28213
+ "--zIndex": maybeCssVar68(zIndices.navbar)
28082
28214
  }],
28083
28215
  width: ["w_var", {
28084
- "--width": maybeCssVar66(__maybeInc31(innerWidth))
28216
+ "--width": maybeCssVar68(__maybeInc33(innerWidth))
28085
28217
  }],
28086
28218
  transition: "transitionTop"
28087
28219
  }
@@ -28090,20 +28222,20 @@ function NavbarLayout(props) {
28090
28222
  const innerStyle = autoHideState !== "static" ? {
28091
28223
  top: autoHideState === "revealed" ? bannerTop : `calc(${bannerTop} - ${navHeight}px)`
28092
28224
  } : void 0;
28093
- const navbarEl = useMemo57(() => /* @__PURE__ */ jsx231(Navbar, { ...navbar }), [navbar]);
28094
- return /* @__PURE__ */ jsx231(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsx231(NavbarLayoutHeightProvider, { value: navbarOffsetPx, children: /* @__PURE__ */ jsx231(MobileSubNavProvider, { children: /* @__PURE__ */ jsxs121("div", { ...mergeProps39(void 0, cssVars, {
28225
+ const navbarEl = useMemo57(() => /* @__PURE__ */ jsx232(Navbar, { ...navbar }), [navbar]);
28226
+ return /* @__PURE__ */ jsx232(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsx232(NavbarLayoutHeightProvider, { value: navbarOffsetPx, children: /* @__PURE__ */ jsx232(MobileSubNavProvider, { children: /* @__PURE__ */ jsxs121("div", { ...mergeProps39(void 0, cssVars, {
28095
28227
  display: "df",
28096
28228
  flexDirection: "fdc",
28097
28229
  width: "wfc",
28098
28230
  minWidth: "mw100"
28099
28231
  }), ...tid, children: [
28100
- /* @__PURE__ */ jsx231("div", { ref: spacerRef, ...mergeProps39(void 0, {
28232
+ /* @__PURE__ */ jsx232("div", { ref: spacerRef, ...mergeProps39(void 0, {
28101
28233
  height: navHeight
28102
28234
  }, {
28103
28235
  flexShrink: "fs0",
28104
28236
  width: "w100"
28105
- }), children: /* @__PURE__ */ jsx231("div", { ref: navMetricsRef, ...mergeProps39(void 0, innerStyle, innerCss), ...tid.navbar, children: navbarEl }) }),
28106
- /* @__PURE__ */ jsx231("div", { className: "df fdc mh0 mw100 w100", ...tid.body, children })
28237
+ }), children: /* @__PURE__ */ jsx232("div", { ref: navMetricsRef, ...mergeProps39(void 0, innerStyle, innerCss), ...tid.navbar, children: navbarEl }) }),
28238
+ /* @__PURE__ */ jsx232("div", { className: "df fdc mh0 mw100 w100", ...tid.body, children })
28107
28239
  ] }) }) }) });
28108
28240
  }
28109
28241
 
@@ -28111,8 +28243,8 @@ function NavbarLayout(props) {
28111
28243
  import { useCallback as useCallback42, useMemo as useMemo58, useRef as useRef70 } from "react";
28112
28244
 
28113
28245
  // src/components/Headers/BaseHeader.tsx
28114
- import { trussProps as trussProps134 } from "@homebound/truss/runtime";
28115
- import { jsx as jsx232, jsxs as jsxs122 } from "react/jsx-runtime";
28246
+ import { trussProps as trussProps135 } from "@homebound/truss/runtime";
28247
+ import { jsx as jsx233, jsxs as jsxs122 } from "react/jsx-runtime";
28116
28248
  function BaseHeader(props) {
28117
28249
  const {
28118
28250
  title,
@@ -28124,7 +28256,7 @@ function BaseHeader(props) {
28124
28256
  } = props;
28125
28257
  const tid = useTestIds(otherProps, "header");
28126
28258
  useDocumentTitle(title, documentTitleSuffix);
28127
- return /* @__PURE__ */ jsxs122("header", { ...tid, ...trussProps134({
28259
+ return /* @__PURE__ */ jsxs122("header", { ...tid, ...trussProps135({
28128
28260
  display: "df",
28129
28261
  flexDirection: "fdc",
28130
28262
  paddingTop: "pt3",
@@ -28138,7 +28270,7 @@ function BaseHeader(props) {
28138
28270
  "--backgroundColor": "var(--b-surface)"
28139
28271
  }]
28140
28272
  }), children: [
28141
- /* @__PURE__ */ jsxs122("div", { ...trussProps134({
28273
+ /* @__PURE__ */ jsxs122("div", { ...trussProps135({
28142
28274
  ...{
28143
28275
  display: "df",
28144
28276
  justifyContent: "jcsb",
@@ -28153,8 +28285,8 @@ function BaseHeader(props) {
28153
28285
  }
28154
28286
  }), children: [
28155
28287
  /* @__PURE__ */ jsxs122("div", { className: "mw0", children: [
28156
- breadcrumbs && /* @__PURE__ */ jsx232(Breadcrumbs, { ...breadcrumbs }),
28157
- /* @__PURE__ */ jsx232("h1", { ...tid.title, ...trussProps134({
28288
+ breadcrumbs && /* @__PURE__ */ jsx233(Breadcrumbs, { ...breadcrumbs }),
28289
+ /* @__PURE__ */ jsx233("h1", { ...tid.title, ...trussProps135({
28158
28290
  fontWeight: "fw6",
28159
28291
  fontSize: "fz_20px",
28160
28292
  lineHeight: "lh_28px",
@@ -28163,22 +28295,27 @@ function BaseHeader(props) {
28163
28295
  }]
28164
28296
  }), children: title })
28165
28297
  ] }),
28166
- /* @__PURE__ */ jsx232("div", { className: "fs0", children: rightSlot })
28298
+ /* @__PURE__ */ jsx233("div", { className: "fs0", children: rightSlot })
28167
28299
  ] }),
28168
28300
  bottomSlot
28169
28301
  ] });
28170
28302
  }
28171
28303
 
28172
28304
  // src/components/Headers/PageHeader.tsx
28173
- import { trussProps as trussProps135 } from "@homebound/truss/runtime";
28174
- import { jsx as jsx233 } from "react/jsx-runtime";
28305
+ import { trussProps as trussProps136 } from "@homebound/truss/runtime";
28306
+ import { Fragment as Fragment51, jsx as jsx234, jsxs as jsxs123 } from "react/jsx-runtime";
28175
28307
  function PageHeader2(props) {
28176
28308
  const {
28177
28309
  tabs,
28310
+ actions,
28311
+ rightSlot,
28178
28312
  ...otherProps
28179
28313
  } = props;
28180
28314
  const tid = useTestIds(otherProps, "header");
28181
- return /* @__PURE__ */ jsx233(BaseHeader, { ...otherProps, bottomSlot: tabs && /* @__PURE__ */ jsx233("div", { ...trussProps135(pageContentPaddingX), children: /* @__PURE__ */ jsx233(Tabs, { ...tabs, ...tid.tabs }) }) });
28315
+ return /* @__PURE__ */ jsx234(BaseHeader, { ...otherProps, rightSlot: /* @__PURE__ */ jsxs123(Fragment51, { children: [
28316
+ rightSlot,
28317
+ actions && actions.length > 0 && /* @__PURE__ */ jsx234(HeaderActions, { actions, collapseOnSm: true })
28318
+ ] }), bottomSlot: tabs && /* @__PURE__ */ jsx234("div", { ...trussProps136(pageContentPaddingX), children: /* @__PURE__ */ jsx234(Tabs, { ...tabs, ...tid.tabs }) }) });
28182
28319
  }
28183
28320
 
28184
28321
  // src/layouts/useBannerAndNavbarHeight.ts
@@ -28187,9 +28324,9 @@ function useBannerAndNavbarHeight() {
28187
28324
  }
28188
28325
 
28189
28326
  // src/layouts/PageHeaderLayout/PageHeaderLayout.tsx
28190
- import { mergeProps as mergeProps40, maybeCssVar as maybeCssVar67 } from "@homebound/truss/runtime";
28191
- import { jsx as jsx234, jsxs as jsxs123 } from "react/jsx-runtime";
28192
- var __maybeInc32 = (inc) => {
28327
+ import { mergeProps as mergeProps40, maybeCssVar as maybeCssVar69 } from "@homebound/truss/runtime";
28328
+ import { jsx as jsx235, jsxs as jsxs124 } from "react/jsx-runtime";
28329
+ var __maybeInc34 = (inc) => {
28193
28330
  return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
28194
28331
  };
28195
28332
  function PageHeaderLayout(props) {
@@ -28219,103 +28356,46 @@ function PageHeaderLayout(props) {
28219
28356
  const innerCss = autoHideState === "static" ? {
28220
28357
  position: "sticky",
28221
28358
  left: ["left_var", {
28222
- "--left": maybeCssVar67(__maybeInc32(headerLeft))
28359
+ "--left": maybeCssVar69(__maybeInc34(headerLeft))
28223
28360
  }],
28224
28361
  width: ["w_var", {
28225
- "--width": maybeCssVar67(__maybeInc32(headerWidth))
28362
+ "--width": maybeCssVar69(__maybeInc34(headerWidth))
28226
28363
  }],
28227
28364
  zIndex: ["z_var", {
28228
- "--zIndex": maybeCssVar67(zIndices.pageStickyHeader)
28365
+ "--zIndex": maybeCssVar69(zIndices.pageStickyHeader)
28229
28366
  }]
28230
28367
  } : {
28231
28368
  position: "fixed",
28232
28369
  left: ["left_var", {
28233
- "--left": maybeCssVar67(__maybeInc32(headerLeft))
28370
+ "--left": maybeCssVar69(__maybeInc34(headerLeft))
28234
28371
  }],
28235
28372
  width: ["w_var", {
28236
- "--width": maybeCssVar67(__maybeInc32(headerWidth))
28373
+ "--width": maybeCssVar69(__maybeInc34(headerWidth))
28237
28374
  }],
28238
28375
  zIndex: ["z_var", {
28239
- "--zIndex": maybeCssVar67(zIndices.pageStickyHeader)
28376
+ "--zIndex": maybeCssVar69(zIndices.pageStickyHeader)
28240
28377
  }],
28241
28378
  transition: "transitionTop"
28242
28379
  };
28243
28380
  const innerStyle = autoHideState !== "static" ? {
28244
28381
  top: autoHideState === "revealed" ? outerTop : `calc(${outerTop} - ${headerHeight}px)`
28245
28382
  } : void 0;
28246
- const pageHeaderEl = useMemo58(() => /* @__PURE__ */ jsx234(PageHeader2, { ...pageHeader }), [pageHeader]);
28247
- return /* @__PURE__ */ jsx234(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsxs123("div", { ...mergeProps40(void 0, cssVars, {
28383
+ const pageHeaderEl = useMemo58(() => /* @__PURE__ */ jsx235(PageHeader2, { ...pageHeader }), [pageHeader]);
28384
+ return /* @__PURE__ */ jsx235(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsxs124("div", { ...mergeProps40(void 0, cssVars, {
28248
28385
  display: "df",
28249
28386
  flexDirection: "fdc",
28250
28387
  width: "w100"
28251
28388
  }), ...tid, children: [
28252
- /* @__PURE__ */ jsx234("div", { ref: spacerRef, ...mergeProps40(void 0, {
28389
+ /* @__PURE__ */ jsx235("div", { ref: spacerRef, ...mergeProps40(void 0, {
28253
28390
  height: headerHeight
28254
28391
  }, {
28255
28392
  flexShrink: "fs0",
28256
28393
  width: "w100"
28257
- }), children: /* @__PURE__ */ jsx234("div", { ref: headerMetricsRef, ...mergeProps40(void 0, innerStyle, innerCss), ...tid.pageHeader, children: pageHeaderEl }) }),
28258
- /* @__PURE__ */ jsx234("div", { className: "df fdc fg1 mh0 w100", ...tid.body, children })
28394
+ }), children: /* @__PURE__ */ jsx235("div", { ref: headerMetricsRef, ...mergeProps40(void 0, innerStyle, innerCss), ...tid.pageHeader, children: pageHeaderEl }) }),
28395
+ /* @__PURE__ */ jsx235("div", { className: "df fdc fg1 mh0 w100", ...tid.body, children })
28259
28396
  ] }) });
28260
28397
  }
28261
28398
 
28262
- // src/layouts/Workflow/JumpLinksRail.tsx
28263
- import { trussProps as trussProps136, maybeCssVar as maybeCssVar68 } from "@homebound/truss/runtime";
28264
- import { jsx as jsx235 } from "react/jsx-runtime";
28265
- var __maybeInc33 = (inc) => {
28266
- return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
28267
- };
28268
- var jumpLinksRailWidthPx = 180;
28269
- function JumpLinksRail(props) {
28270
- const {
28271
- links,
28272
- activeId
28273
- } = props;
28274
- const tid = useTestIds(props, "jumpLinks");
28275
- return /* @__PURE__ */ jsx235("nav", { ...trussProps136({
28276
- display: "df",
28277
- flexDirection: "fdc",
28278
- flexShrink: "fs0",
28279
- width: ["w_var", {
28280
- "--width": `${jumpLinksRailWidthPx}px`
28281
- }],
28282
- position: "sticky",
28283
- alignSelf: "asfs",
28284
- top: ["top_var", {
28285
- "--top": maybeCssVar68(__maybeInc33(stickyNavAndHeaderOffset()))
28286
- }]
28287
- }), ...tid, children: links.map((link) => /* @__PURE__ */ jsx235(JumpLink, { label: link.label, href: `#${link.id}`, active: link.id === activeId, ...tid.link }, link.id)) });
28288
- }
28289
-
28290
- // src/layouts/Workflow/useActiveJumpLink.ts
28291
- import { useLayoutEffect as useLayoutEffect14, useState as useState63 } from "react";
28292
- var activationLeadPx = 120;
28293
- function useActiveJumpLink(sectionIds) {
28294
- const idsKey = sectionIds.join("\0");
28295
- const [activeId, setActiveId] = useState63(sectionIds[0]);
28296
- useLayoutEffect14(() => {
28297
- const ids = idsKey.length === 0 ? [] : idsKey.split("\0");
28298
- if (ids.length === 0) return;
28299
- const update = () => {
28300
- const first = ids.map((id) => document.getElementById(id)).find((el) => el !== null);
28301
- if (!first) return;
28302
- const headerOffset = stickyNavAndHeaderOffsetPx(first);
28303
- let current = ids[0];
28304
- for (const id of ids) {
28305
- const el = document.getElementById(id);
28306
- if (el && el.getBoundingClientRect().top - headerOffset <= activationLeadPx) {
28307
- current = id;
28308
- }
28309
- }
28310
- setActiveId(current);
28311
- };
28312
- update();
28313
- window.addEventListener("scroll", update, { passive: true });
28314
- return () => window.removeEventListener("scroll", update);
28315
- }, [idsKey]);
28316
- return sectionIds.includes(activeId ?? "") ? activeId : sectionIds[0];
28317
- }
28318
-
28319
28399
  // src/layouts/Workflow/WorkflowPageLayout.tsx
28320
28400
  import { useLayoutEffect as useLayoutEffect15, useRef as useRef72 } from "react";
28321
28401
 
@@ -28379,7 +28459,7 @@ function UnsavedChangesNavigationModal(props) {
28379
28459
  }
28380
28460
 
28381
28461
  // src/layouts/Workflow/WorkflowActions.tsx
28382
- import { jsx as jsx238, jsxs as jsxs124 } from "react/jsx-runtime";
28462
+ import { jsx as jsx238, jsxs as jsxs125 } from "react/jsx-runtime";
28383
28463
  function WorkflowActions(props) {
28384
28464
  const {
28385
28465
  onCancel,
@@ -28397,9 +28477,9 @@ function WorkflowActions(props) {
28397
28477
  sm: isMobile
28398
28478
  } = useBreakpoint();
28399
28479
  const primaryVariant = aiMode ? "ai" : "primary";
28400
- return /* @__PURE__ */ jsxs124("div", { className: "df aic jcsb sm_w100", children: [
28480
+ return /* @__PURE__ */ jsxs125("div", { className: "df aic jcsb sm_w100", children: [
28401
28481
  /* @__PURE__ */ jsx238("div", { className: "df aic", children: !isFirstStep && isMobile && onBack && /* @__PURE__ */ jsx238(IconButton, { icon: "arrowBack", label: "Back", onClick: onBack }) }),
28402
- /* @__PURE__ */ jsxs124("div", { className: "df aic gap1", children: [
28482
+ /* @__PURE__ */ jsxs125("div", { className: "df aic gap1", children: [
28403
28483
  /* @__PURE__ */ jsx238(Button, { label: "Cancel", variant: "quaternary", onClick: onCancel }),
28404
28484
  onSaveAndExit && /* @__PURE__ */ jsx238(Button, { label: "Save & Exit", variant: "secondary", onClick: onSaveAndExit }),
28405
28485
  isLastStep ? /* @__PURE__ */ jsx238(Button, { label: completeLabel, variant: primaryVariant, onClick: onComplete, disabled: primaryDisabled }) : /* @__PURE__ */ jsx238(Button, { label: "Continue", variant: primaryVariant, onClick: async () => {
@@ -28410,9 +28490,9 @@ function WorkflowActions(props) {
28410
28490
  }
28411
28491
 
28412
28492
  // src/layouts/Workflow/WorkflowPageLayout.tsx
28413
- import { trussProps as trussProps137, mergeProps as mergeProps41, maybeCssVar as maybeCssVar69 } from "@homebound/truss/runtime";
28414
- import { jsx as jsx239, jsxs as jsxs125 } from "react/jsx-runtime";
28415
- var __maybeInc34 = (inc) => {
28493
+ import { trussProps as trussProps137, mergeProps as mergeProps41, maybeCssVar as maybeCssVar70 } from "@homebound/truss/runtime";
28494
+ import { jsx as jsx239, jsxs as jsxs126 } from "react/jsx-runtime";
28495
+ var __maybeInc35 = (inc) => {
28416
28496
  return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
28417
28497
  };
28418
28498
  var mobileFooterHeightPx = 80;
@@ -28460,8 +28540,8 @@ function WorkflowPageLayout(props) {
28460
28540
  }
28461
28541
  };
28462
28542
  }, [showFooter]);
28463
- return /* @__PURE__ */ jsxs125(DocumentScrollLayoutProvider, { children: [
28464
- /* @__PURE__ */ jsxs125("div", { ...mergeProps41(void 0, cssVars, {
28543
+ return /* @__PURE__ */ jsxs126(DocumentScrollLayoutProvider, { children: [
28544
+ /* @__PURE__ */ jsxs126("div", { ...mergeProps41(void 0, cssVars, {
28465
28545
  display: "df",
28466
28546
  flexDirection: "fdc",
28467
28547
  width: "w100"
@@ -28470,13 +28550,13 @@ function WorkflowPageLayout(props) {
28470
28550
  position: "sticky",
28471
28551
  left: "left0",
28472
28552
  width: ["w_var", {
28473
- "--width": maybeCssVar69(__maybeInc34(headerWidth))
28553
+ "--width": maybeCssVar70(__maybeInc35(headerWidth))
28474
28554
  }],
28475
28555
  zIndex: ["z_var", {
28476
- "--zIndex": maybeCssVar69(zIndices.pageStickyHeader)
28556
+ "--zIndex": maybeCssVar70(zIndices.pageStickyHeader)
28477
28557
  }],
28478
28558
  top: ["top_var", {
28479
- "--top": maybeCssVar69(__maybeInc34(outerTop))
28559
+ "--top": maybeCssVar70(__maybeInc35(outerTop))
28480
28560
  }]
28481
28561
  }), ...tid.header, children: /* @__PURE__ */ jsx239(WorkflowHeader, { title, documentTitleSuffix, breadcrumbs, rightSlot: isMobile ? void 0 : actions, stepperTabs }) }),
28482
28562
  /* @__PURE__ */ jsx239("div", { ...trussProps137({
@@ -28491,7 +28571,7 @@ function WorkflowPageLayout(props) {
28491
28571
  ...aiMode && {
28492
28572
  backgroundImage: "aiBackground",
28493
28573
  minHeight: ["mh_var", {
28494
- "--minHeight": maybeCssVar69(documentScrollBodyMinHeight())
28574
+ "--minHeight": maybeCssVar70(documentScrollBodyMinHeight())
28495
28575
  }]
28496
28576
  }
28497
28577
  }), ...tid.body, children }),
@@ -28506,13 +28586,13 @@ function WorkflowPageLayout(props) {
28506
28586
  position: "fixed",
28507
28587
  bottom: "bottom0",
28508
28588
  width: ["w_var", {
28509
- "--width": maybeCssVar69(__maybeInc34(headerWidth))
28589
+ "--width": maybeCssVar70(__maybeInc35(headerWidth))
28510
28590
  }],
28511
28591
  height: ["h_var", {
28512
28592
  "--height": `${mobileFooterHeightPx}px`
28513
28593
  }],
28514
28594
  zIndex: ["z_var", {
28515
- "--zIndex": maybeCssVar69(zIndices.pageStickyFooter)
28595
+ "--zIndex": maybeCssVar70(zIndices.pageStickyFooter)
28516
28596
  }],
28517
28597
  display: "df",
28518
28598
  alignItems: "aic",
@@ -28535,37 +28615,25 @@ function WorkflowPageLayout(props) {
28535
28615
  }
28536
28616
 
28537
28617
  // src/layouts/Workflow/FocusedFormLayout.tsx
28538
- import { jsx as jsx240, jsxs as jsxs126 } from "react/jsx-runtime";
28618
+ import { jsx as jsx240 } from "react/jsx-runtime";
28539
28619
  function FocusedFormLayout(props) {
28540
- const {
28541
- onCancel,
28542
- completeLabel,
28543
- onComplete,
28544
- onSaveAndExit,
28545
- isValid,
28546
- isDirty,
28547
- withJumpLinks = true,
28548
- aiMode,
28549
- form,
28550
- ...headerProps
28551
- } = props;
28620
+ const { onCancel, completeLabel, onComplete, onSaveAndExit, isValid, isDirty, aiMode, children, ...headerProps } = props;
28552
28621
  const tid = useTestIds(props, "focusedFormLayout");
28553
- const {
28554
- sm: isMobile
28555
- } = useBreakpoint();
28556
- const jumpLinks = (form.sections ?? []).filter((section) => !section.excludeJumpLink).map((section) => {
28557
- const id = defaultTestId(section.title);
28558
- return {
28559
- id,
28560
- label: section.title
28561
- };
28562
- });
28563
- const activeId = useActiveJumpLink(jumpLinks.map((link) => link.id));
28564
- const showRail = withJumpLinks && jumpLinks.length >= 2 && !isMobile;
28565
- return /* @__PURE__ */ jsx240(WorkflowPageLayout, { ...tid, ...headerProps, aiMode, isDirty, onCancel, onSaveAndExit, completeLabel, onComplete, primaryDisabled: !isValid, children: /* @__PURE__ */ jsxs126("div", { className: "df w100", children: [
28566
- showRail && /* @__PURE__ */ jsx240(JumpLinksRail, { links: jumpLinks, activeId, ...tid.jumpLinks }),
28567
- /* @__PURE__ */ jsx240("div", { className: "fg1 mw0 mb4", children: /* @__PURE__ */ jsx240(FormSectionLayout, { ...form, aiMode }) })
28568
- ] }) });
28622
+ return /* @__PURE__ */ jsx240(
28623
+ WorkflowPageLayout,
28624
+ {
28625
+ ...tid,
28626
+ ...headerProps,
28627
+ aiMode,
28628
+ isDirty,
28629
+ onCancel,
28630
+ onSaveAndExit,
28631
+ completeLabel,
28632
+ onComplete,
28633
+ primaryDisabled: !isValid,
28634
+ children
28635
+ }
28636
+ );
28569
28637
  }
28570
28638
 
28571
28639
  // src/layouts/Workflow/StepperLayout.tsx