@homebound/beam 4.59.1 → 4.60.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
@@ -27362,7 +27362,7 @@ function invertSpacing(value) {
27362
27362
  }
27363
27363
 
27364
27364
  // src/components/Layout/GridTableLayout/GridTableLayout.tsx
27365
- import React17, { useCallback as useCallback37, useEffect as useEffect29, useMemo as useMemo50, useRef as useRef66, useState as useState55 } from "react";
27365
+ import React17, { useCallback as useCallback37, useEffect as useEffect29, useMemo as useMemo50, useRef as useRef67, useState as useState56 } from "react";
27366
27366
 
27367
27367
  // src/components/Layout/GridTableLayout/GridTableLayoutActions.tsx
27368
27368
  import { memo as memo2, useMemo as useMemo46, useState as useState48 } from "react";
@@ -27903,7 +27903,7 @@ function SelectionSummaryAction(props) {
27903
27903
 
27904
27904
  // src/components/Layout/GridTableLayout/GridTableLayoutHost.tsx
27905
27905
  import { useResizeObserver as useResizeObserver10 } from "@react-aria/utils";
27906
- import { useCallback as useCallback33, useLayoutEffect as useLayoutEffect14, useRef as useRef64 } from "react";
27906
+ import { useCallback as useCallback33, useImperativeHandle, useLayoutEffect as useLayoutEffect15, useRef as useRef65 } from "react";
27907
27907
 
27908
27908
  // src/components/Layout/RightPaneLayout/DocumentScrollOverlayRightPaneLayout.tsx
27909
27909
  import { useContext as useContext23, useEffect as useEffect27, useLayoutEffect as useLayoutEffect13, useRef as useRef63, useState as useState51 } from "react";
@@ -28375,6 +28375,132 @@ function ModalFullBleed({
28375
28375
  }));
28376
28376
  }
28377
28377
 
28378
+ // src/layouts/useAutoHideOnScroll.ts
28379
+ import { useLayoutEffect as useLayoutEffect14, useRef as useRef64, useState as useState52 } from "react";
28380
+ var THRESHOLD = 80;
28381
+ var HOLD_QUIET_MS = 150;
28382
+ var cancelActiveHold;
28383
+ var holdReleaseListeners = /* @__PURE__ */ new Set();
28384
+ var userScrollEvents = ["wheel", "touchstart"];
28385
+ function holdAutoHideWhile(scroll) {
28386
+ cancelActiveHold?.();
28387
+ let quietTimer;
28388
+ const restartQuietTimer = () => {
28389
+ clearTimeout(quietTimer);
28390
+ quietTimer = setTimeout(release, HOLD_QUIET_MS);
28391
+ };
28392
+ const cancel = () => {
28393
+ clearTimeout(quietTimer);
28394
+ window.removeEventListener("scroll", restartQuietTimer);
28395
+ for (const event of userScrollEvents) window.removeEventListener(event, release);
28396
+ window.removeEventListener("scrollend", release);
28397
+ cancelActiveHold = void 0;
28398
+ };
28399
+ function release() {
28400
+ cancel();
28401
+ holdReleaseListeners.forEach((listener) => listener());
28402
+ }
28403
+ window.addEventListener("scroll", restartQuietTimer, { passive: true });
28404
+ for (const event of userScrollEvents) window.addEventListener(event, release, { passive: true });
28405
+ window.addEventListener("scrollend", release);
28406
+ cancelActiveHold = cancel;
28407
+ restartQuietTimer();
28408
+ scroll();
28409
+ }
28410
+ function getInitialAutoHideState() {
28411
+ if (typeof window === "undefined" || window.scrollY <= 0) {
28412
+ return "resting";
28413
+ }
28414
+ return "hidden";
28415
+ }
28416
+ function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
28417
+ const initial = getInitialAutoHideState();
28418
+ const [state, setState] = useState52(initial);
28419
+ const stateRef = useRef64(initial);
28420
+ const getTopOffsetRef = useRef64(getTopOffset);
28421
+ getTopOffsetRef.current = getTopOffset;
28422
+ const lastScrollY = useRef64(Number.POSITIVE_INFINITY);
28423
+ const lastScrollHeight = useRef64(0);
28424
+ useLayoutEffect14(() => {
28425
+ if (!enabled) {
28426
+ stateRef.current = "resting";
28427
+ lastScrollY.current = Number.POSITIVE_INFINITY;
28428
+ lastScrollHeight.current = 0;
28429
+ setState("resting");
28430
+ return;
28431
+ }
28432
+ const commit = (nextState) => {
28433
+ if (nextState !== stateRef.current) {
28434
+ stateRef.current = nextState;
28435
+ setState(nextState);
28436
+ }
28437
+ };
28438
+ const autoHideStateOnLayoutChange = (rect, topOffset) => {
28439
+ const nextAtTop = rect.top >= topOffset;
28440
+ let next = stateRef.current;
28441
+ if (nextAtTop) {
28442
+ next = "resting";
28443
+ } else if (rect.bottom < -THRESHOLD && next !== "revealed") {
28444
+ next = "hidden";
28445
+ }
28446
+ return next;
28447
+ };
28448
+ const updateAutoHideState = () => {
28449
+ const el = spacerRef.current;
28450
+ if (!el) return;
28451
+ const doc = document.documentElement;
28452
+ const currentScrollHeight = doc.scrollHeight;
28453
+ const scrollHeightChanged = lastScrollHeight.current !== 0 && currentScrollHeight !== lastScrollHeight.current;
28454
+ lastScrollHeight.current = currentScrollHeight;
28455
+ if (window.scrollY <= 0) {
28456
+ lastScrollY.current = 0;
28457
+ commit("resting");
28458
+ return;
28459
+ }
28460
+ const currentY = window.scrollY;
28461
+ if (cancelActiveHold) {
28462
+ lastScrollY.current = currentY;
28463
+ return;
28464
+ }
28465
+ const rect = el.getBoundingClientRect();
28466
+ const topOffset = getTopOffsetRef.current?.() ?? 0;
28467
+ if (scrollHeightChanged) {
28468
+ lastScrollY.current = currentY;
28469
+ commit(autoHideStateOnLayoutChange(rect, topOffset));
28470
+ return;
28471
+ }
28472
+ const dy = currentY - lastScrollY.current;
28473
+ lastScrollY.current = currentY;
28474
+ const atBottom = currentY >= doc.scrollHeight - doc.clientHeight;
28475
+ const nextAtTop = rect.top >= topOffset;
28476
+ let next = stateRef.current;
28477
+ if (nextAtTop) {
28478
+ next = "resting";
28479
+ } else if (rect.bottom < -THRESHOLD) {
28480
+ if (dy < 0 && !atBottom) next = "revealed";
28481
+ else if (dy > 0) next = "hidden";
28482
+ }
28483
+ commit(next);
28484
+ };
28485
+ const onHoldRelease = () => {
28486
+ const el = spacerRef.current;
28487
+ if (!el) return;
28488
+ lastScrollY.current = window.scrollY;
28489
+ lastScrollHeight.current = document.documentElement.scrollHeight;
28490
+ if (window.scrollY <= 0) return commit("resting");
28491
+ commit(autoHideStateOnLayoutChange(el.getBoundingClientRect(), getTopOffsetRef.current?.() ?? 0));
28492
+ };
28493
+ updateAutoHideState();
28494
+ window.addEventListener("scroll", updateAutoHideState, { passive: true });
28495
+ holdReleaseListeners.add(onHoldRelease);
28496
+ return () => {
28497
+ window.removeEventListener("scroll", updateAutoHideState);
28498
+ holdReleaseListeners.delete(onHoldRelease);
28499
+ };
28500
+ }, [enabled, spacerRef]);
28501
+ return { state };
28502
+ }
28503
+
28378
28504
  // src/components/Layout/GridTableLayout/GridTableLayoutHost.tsx
28379
28505
  import { trussProps as trussProps118, maybeCssVar as maybeCssVar55 } from "@homebound/truss/runtime";
28380
28506
  import { jsx as jsx206, jsxs as jsxs108 } from "react/jsx-runtime";
@@ -28388,12 +28514,33 @@ function GridTableLayoutHost(props) {
28388
28514
  rightPane,
28389
28515
  isVirtualized,
28390
28516
  testIds,
28517
+ scrollToTopRef,
28391
28518
  children
28392
28519
  } = props;
28393
- const tableWrapperRef = useRef64(null);
28394
- const tableActionsRef = useRef64(null);
28520
+ const tableWrapperRef = useRef65(null);
28521
+ const tableActionsRef = useRef65(null);
28395
28522
  const hasActions = actions !== void 0;
28523
+ const {
28524
+ scrollableEl
28525
+ } = useScrollableParent();
28396
28526
  useSetTableActionsHeight(tableWrapperRef, tableActionsRef, host.kind !== "scrollable-parent" && hasActions);
28527
+ useImperativeHandle(scrollToTopRef, () => () => {
28528
+ const scrollableParent = host.kind === "scrollable-parent" ? scrollableEl?.parentElement : void 0;
28529
+ if (scrollableParent) {
28530
+ scrollableParent.scrollTo?.({
28531
+ top: 0,
28532
+ behavior: "smooth"
28533
+ });
28534
+ } else {
28535
+ const scrollToWrapper = () => tableWrapperRef.current?.scrollIntoView?.({
28536
+ behavior: "smooth",
28537
+ block: "start",
28538
+ inline: "start"
28539
+ });
28540
+ if (host.kind === "modal") scrollToWrapper();
28541
+ else holdAutoHideWhile(scrollToWrapper);
28542
+ }
28543
+ }, [host.kind, scrollableEl]);
28397
28544
  const shared = {
28398
28545
  actions,
28399
28546
  tableWrapperRef,
@@ -28447,29 +28594,49 @@ function DocumentScrollHost(props) {
28447
28594
  "--minWidth": maybeCssVar55(documentScrollRightPaneContentMinCss())
28448
28595
  }]
28449
28596
  }), children }) }) : children;
28450
- return /* @__PURE__ */ jsxs108("div", { ref: tableWrapperRef, className: "df fdc wfc mw100", ...actions !== void 0 ? selfTopSpaced : {}, ...testIds.tableWrapper, children: [
28451
- /* @__PURE__ */ jsx206(ActionsBar, { actionsRef: tableActionsRef, xss: {
28452
- transition: "transitionTop",
28453
- position: "sticky",
28454
- top: ["top_var", {
28455
- "--top": maybeCssVar55(__maybeInc21(stickyNavAndHeaderOffset()))
28456
- }],
28457
- left: ["left_var", {
28458
- "--left": maybeCssVar55(__maybeInc21(documentScrollChromeLeft()))
28459
- }],
28460
- width: ["w_var", {
28461
- "--width": maybeCssVar55(__maybeInc21(`min(100%, ${documentScrollChromeWidth()})`))
28462
- }],
28463
- contain: "ctn_inline_size",
28464
- zIndex: ["z_var", {
28465
- "--zIndex": maybeCssVar55(zIndices.tableActions)
28466
- }],
28467
- backgroundColor: ["bgColor_var", {
28468
- "--backgroundColor": "var(--b-surface)"
28469
- }]
28470
- }, testIds, children: actions }),
28471
- tableBody
28472
- ] });
28597
+ return /* @__PURE__ */ jsxs108(
28598
+ "div",
28599
+ {
28600
+ ref: tableWrapperRef,
28601
+ ...trussProps118({
28602
+ display: "df",
28603
+ flexDirection: "fdc",
28604
+ width: "wfc",
28605
+ minWidth: "mw100",
28606
+ scrollMarginTop: ["scrollMarginTop_var", {
28607
+ "--scrollMarginTop": maybeCssVar55(stickyNavAndHeaderOffset())
28608
+ }],
28609
+ scrollMarginLeft: ["scrollMarginLeft_var", {
28610
+ "--scrollMarginLeft": maybeCssVar55(documentScrollContentLeft())
28611
+ }]
28612
+ }),
28613
+ ...actions !== void 0 ? selfTopSpaced : {},
28614
+ ...testIds.tableWrapper,
28615
+ children: [
28616
+ /* @__PURE__ */ jsx206(ActionsBar, { actionsRef: tableActionsRef, xss: {
28617
+ transition: "transitionTop",
28618
+ position: "sticky",
28619
+ top: ["top_var", {
28620
+ "--top": maybeCssVar55(__maybeInc21(stickyNavAndHeaderOffset()))
28621
+ }],
28622
+ left: ["left_var", {
28623
+ "--left": maybeCssVar55(__maybeInc21(documentScrollChromeLeft()))
28624
+ }],
28625
+ width: ["w_var", {
28626
+ "--width": maybeCssVar55(__maybeInc21(`min(100%, ${documentScrollChromeWidth()})`))
28627
+ }],
28628
+ contain: "ctn_inline_size",
28629
+ zIndex: ["z_var", {
28630
+ "--zIndex": maybeCssVar55(zIndices.tableActions)
28631
+ }],
28632
+ backgroundColor: ["bgColor_var", {
28633
+ "--backgroundColor": "var(--b-surface)"
28634
+ }]
28635
+ }, testIds, children: actions }),
28636
+ tableBody
28637
+ ]
28638
+ }
28639
+ );
28473
28640
  }
28474
28641
  function ScrollableParentHost(props) {
28475
28642
  const {
@@ -28513,7 +28680,7 @@ function useSetTableActionsHeight(tableWrapperRef, tableActionsRef, enabled) {
28513
28680
  ref: tableActionsRef,
28514
28681
  onResize: enabled ? syncHeightVar : noop
28515
28682
  });
28516
- useLayoutEffect14(() => {
28683
+ useLayoutEffect15(() => {
28517
28684
  syncHeightVar();
28518
28685
  const tableWrapper = tableWrapperRef.current;
28519
28686
  return () => {
@@ -28559,10 +28726,10 @@ function useGridTableLayoutHost() {
28559
28726
  }
28560
28727
 
28561
28728
  // src/components/Layout/GridTableLayout/usePersistedTableView.ts
28562
- import { useCallback as useCallback34, useState as useState52 } from "react";
28729
+ import { useCallback as useCallback34, useState as useState53 } from "react";
28563
28730
  function usePersistedTableView(defaultView, persist) {
28564
28731
  const storageKey = persist ? getGridTableViewStorageKey(window.location.pathname) : void 0;
28565
- const [view, setView] = useState52(() => {
28732
+ const [view, setView] = useState53(() => {
28566
28733
  if (!storageKey) return defaultView;
28567
28734
  try {
28568
28735
  return parseStoredTableView(localStorage.getItem(storageKey)) ?? defaultView;
@@ -28597,7 +28764,7 @@ function isGridTableProps(props) {
28597
28764
  }
28598
28765
 
28599
28766
  // src/hooks/useGroupBy.ts
28600
- import { useMemo as useMemo48, useState as useState53 } from "react";
28767
+ import { useMemo as useMemo48, useState as useState54 } from "react";
28601
28768
 
28602
28769
  // src/hooks/useQueryState.ts
28603
28770
  import { useCallback as useCallback35 } from "react";
@@ -28618,7 +28785,7 @@ function useGroupBy(opts) {
28618
28785
  []
28619
28786
  );
28620
28787
  const [queryValue, setQueryValue] = useQueryState("groupBy", options[0].id);
28621
- const [localValue, setLocalValue] = useState53(options[0].id);
28788
+ const [localValue, setLocalValue] = useState54(options[0].id);
28622
28789
  return {
28623
28790
  value: inModal ? localValue : queryValue,
28624
28791
  setValue: inModal ? setLocalValue : setQueryValue,
@@ -28627,17 +28794,17 @@ function useGroupBy(opts) {
28627
28794
  }
28628
28795
 
28629
28796
  // src/hooks/usePersistedFilter.ts
28630
- import { useEffect as useEffect28, useMemo as useMemo49, useRef as useRef65 } from "react";
28797
+ import { useEffect as useEffect28, useMemo as useMemo49, useRef as useRef66 } from "react";
28631
28798
 
28632
28799
  // src/hooks/useSessionStorage.ts
28633
- import { useCallback as useCallback36, useState as useState54 } from "react";
28800
+ import { useCallback as useCallback36, useState as useState55 } from "react";
28634
28801
  function useSessionStorage(key, defaultValue) {
28635
28802
  let hasSessionStorage = false;
28636
28803
  try {
28637
28804
  hasSessionStorage = !!window.sessionStorage;
28638
28805
  } catch (e) {
28639
28806
  }
28640
- const [state, setState] = useState54(() => {
28807
+ const [state, setState] = useState55(() => {
28641
28808
  if (!hasSessionStorage) {
28642
28809
  return defaultValue;
28643
28810
  }
@@ -28764,8 +28931,8 @@ function parseSerializedValue(value) {
28764
28931
  return value === void 0 ? void 0 : JSON.parse(value);
28765
28932
  }
28766
28933
  function useStableValue(value) {
28767
- const stableValue = useRef65(value);
28768
- const stableKey = useRef65(JSON.stringify(value));
28934
+ const stableValue = useRef66(value);
28935
+ const stableKey = useRef66(JSON.stringify(value));
28769
28936
  const nextKey = JSON.stringify(value);
28770
28937
  if (stableKey.current !== nextKey) {
28771
28938
  stableValue.current = value;
@@ -28788,7 +28955,8 @@ function GridTableLayoutComponent(props) {
28788
28955
  withCardView,
28789
28956
  defaultView = "list",
28790
28957
  emptyFallback: layoutEmptyFallback,
28791
- withRightPane
28958
+ withRightPane,
28959
+ scrollToTopOnFilterChange = false
28792
28960
  } = props;
28793
28961
  const tid = useTestIds(props);
28794
28962
  const host = useGridTableLayoutHost();
@@ -28820,11 +28988,18 @@ function GridTableLayoutComponent(props) {
28820
28988
  () => layoutState?.search ? { onSearch: layoutState.setSearchString } : void 0,
28821
28989
  [layoutState?.search, layoutState?.setSearchString]
28822
28990
  );
28823
- const searchApiRef = useRef66(void 0);
28991
+ const searchApiRef = useRef67(void 0);
28824
28992
  const clearFilters = useCallback37(() => {
28825
28993
  layoutState?.clearFilters();
28826
28994
  searchApiRef.current?.clear();
28827
28995
  }, [layoutState]);
28996
+ const scrollToTopRef = useRef67(void 0);
28997
+ useScrollToTopOnFilterChange({
28998
+ enabled: scrollToTopOnFilterChange,
28999
+ layoutState,
29000
+ loading: isGridTableProps(tableProps) ? !!tableProps.loading : tableProps.query.loading,
29001
+ scrollToTopRef
29002
+ });
28828
29003
  const emptyState = useMemo50(
28829
29004
  () => composeEmptyState(tableProps, layoutState, layoutEmptyFallback, clearFilters),
28830
29005
  [layoutEmptyFallback, layoutState, tableProps, clearFilters]
@@ -28890,11 +29065,25 @@ function GridTableLayoutComponent(props) {
28890
29065
  rightPane: withRightPane,
28891
29066
  isVirtualized,
28892
29067
  testIds: tid,
29068
+ scrollToTopRef,
28893
29069
  children: tableBody
28894
29070
  }
28895
29071
  );
28896
29072
  }
28897
29073
  var GridTableLayout = React17.memo(GridTableLayoutComponent);
29074
+ function useScrollToTopOnFilterChange(opts) {
29075
+ const { enabled, layoutState, loading, scrollToTopRef } = opts;
29076
+ const { filter, searchString } = layoutState ?? {};
29077
+ const currentFiltersRef = useRef67({ filter, searchString });
29078
+ useEffect29(() => {
29079
+ const scrolledFor = currentFiltersRef.current;
29080
+ if (scrolledFor.filter === filter && scrolledFor.searchString === searchString) return;
29081
+ if (!enabled) return void (currentFiltersRef.current = { filter, searchString });
29082
+ if (loading) return;
29083
+ currentFiltersRef.current = { filter, searchString };
29084
+ scrollToTopRef.current?.();
29085
+ }, [enabled, filter, searchString, loading, scrollToTopRef]);
29086
+ }
28898
29087
  function getDefaultStyle(style, insetHandled) {
28899
29088
  if (style !== void 0 && !isGridStyleDef(style)) return style;
28900
29089
  return { allWhite: true, ...!insetHandled && { bordered: "top" }, ...style };
@@ -28915,7 +29104,7 @@ function useGridTableLayoutState({
28915
29104
  const filterFallback = { filterDefs: {}, storageKey: "unset-filter" };
28916
29105
  const { filter, setFilter } = usePersistedFilter(persistedFilter ?? filterFallback);
28917
29106
  const groupBy = useGroupBy(maybeGroupBy ?? { none: "none" });
28918
- const [searchString, setSearchString] = useState55("");
29107
+ const [searchString, setSearchString] = useState56("");
28919
29108
  const columnsFallback = "unset-columns";
28920
29109
  const [visibleColumnIds, setVisibleColumnIds] = useSessionStorage(
28921
29110
  persistedColumns?.storageKey ?? columnsFallback,
@@ -29077,12 +29266,12 @@ function RightPaneLayout(props) {
29077
29266
  }
29078
29267
 
29079
29268
  // src/components/Layout/RightPaneLayout/RightPanePanel.tsx
29080
- import { createContext as createContext14, useContext as useContext24, useEffect as useEffect31, useState as useState57 } from "react";
29269
+ import { createContext as createContext14, useContext as useContext24, useEffect as useEffect31, useState as useState58 } from "react";
29081
29270
  import { createPortal as createPortal8 } from "react-dom";
29082
29271
 
29083
29272
  // src/components/Layout/RightPaneLayout/internal/DeleteAction.tsx
29084
29273
  import { useResizeObserver as useResizeObserver11 } from "@react-aria/utils";
29085
- import { useRef as useRef67, useState as useState56 } from "react";
29274
+ import { useRef as useRef68, useState as useState57 } from "react";
29086
29275
  import { trussProps as trussProps120 } from "@homebound/truss/runtime";
29087
29276
  import { jsx as jsx211, jsxs as jsxs111 } from "react/jsx-runtime";
29088
29277
  function MaybeDeleteAction(props) {
@@ -29099,9 +29288,9 @@ function BulkDeleteAction(props) {
29099
29288
  count,
29100
29289
  ...buttonProps
29101
29290
  } = props;
29102
- const containerRef = useRef67(null);
29103
- const contentRef = useRef67(null);
29104
- const [overflows, setOverflows] = useState56(false);
29291
+ const containerRef = useRef68(null);
29292
+ const contentRef = useRef68(null);
29293
+ const [overflows, setOverflows] = useState57(false);
29105
29294
  const onResize = () => {
29106
29295
  if (!containerRef.current || !contentRef.current) return;
29107
29296
  setOverflows(contentRef.current.offsetWidth > containerRef.current.clientWidth);
@@ -29168,7 +29357,7 @@ function RightPanePanel(props) {
29168
29357
  const {
29169
29358
  closeRightPane
29170
29359
  } = useRightPaneActions();
29171
- const [bannerSlot, setBannerSlot] = useState57(null);
29360
+ const [bannerSlot, setBannerSlot] = useState58(null);
29172
29361
  const {
29173
29362
  openModal
29174
29363
  } = useModal();
@@ -29255,7 +29444,7 @@ function ScrollableFooter(props) {
29255
29444
 
29256
29445
  // src/components/Layout/TableReviewLayout/TableReviewLayout.tsx
29257
29446
  import { AnimatePresence as AnimatePresence5, motion as motion5 } from "framer-motion";
29258
- import { useEffect as useEffect32, useState as useState58 } from "react";
29447
+ import { useEffect as useEffect32, useState as useState59 } from "react";
29259
29448
 
29260
29449
  // src/components/Layout/TableReviewLayout/SidePanel.tsx
29261
29450
  import { jsx as jsx214, jsxs as jsxs113 } from "react/jsx-runtime";
@@ -29295,7 +29484,7 @@ function TableReviewLayout(props) {
29295
29484
  rightPaneWidth = defaultRightPaneWidth
29296
29485
  } = props;
29297
29486
  const tid = useTestIds(props, "tableReviewLayout");
29298
- const [isPanelVisible, setIsPanelVisible] = useState58(!!panelContent);
29487
+ const [isPanelVisible, setIsPanelVisible] = useState59(!!panelContent);
29299
29488
  useEffect32(() => {
29300
29489
  setIsPanelVisible(!!panelContent);
29301
29490
  }, [panelContent]);
@@ -29455,18 +29644,18 @@ function HomeboundLogo(props) {
29455
29644
  }
29456
29645
 
29457
29646
  // src/components/MaxLines.tsx
29458
- import { useLayoutEffect as useLayoutEffect15, useResizeObserver as useResizeObserver12 } from "@react-aria/utils";
29459
- import { useCallback as useCallback38, useEffect as useEffect33, useRef as useRef68, useState as useState59 } from "react";
29647
+ import { useLayoutEffect as useLayoutEffect16, useResizeObserver as useResizeObserver12 } from "@react-aria/utils";
29648
+ import { useCallback as useCallback38, useEffect as useEffect33, useRef as useRef69, useState as useState60 } from "react";
29460
29649
  import { trussProps as trussProps125, maybeCssVar as maybeCssVar60 } from "@homebound/truss/runtime";
29461
29650
  import { jsx as jsx218, jsxs as jsxs116 } from "react/jsx-runtime";
29462
29651
  function MaxLines({
29463
29652
  maxLines,
29464
29653
  children
29465
29654
  }) {
29466
- const elRef = useRef68(null);
29467
- const [hasMore, setHasMore] = useState59(false);
29468
- const [expanded, setExpanded] = useState59(false);
29469
- useLayoutEffect15(() => {
29655
+ const elRef = useRef69(null);
29656
+ const [hasMore, setHasMore] = useState60(false);
29657
+ const [expanded, setExpanded] = useState60(false);
29658
+ useLayoutEffect16(() => {
29470
29659
  if (!elRef.current) return;
29471
29660
  setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
29472
29661
  }, []);
@@ -29588,7 +29777,7 @@ function toPageNumberSize(page) {
29588
29777
 
29589
29778
  // src/components/ScrollShadows.tsx
29590
29779
  import { useResizeObserver as useResizeObserver13 } from "@react-aria/utils";
29591
- import { useCallback as useCallback39, useMemo as useMemo51, useRef as useRef69, useState as useState60 } from "react";
29780
+ import { useCallback as useCallback39, useMemo as useMemo51, useRef as useRef70, useState as useState61 } from "react";
29592
29781
  import { trussProps as trussProps127, maybeCssVar as maybeCssVar61 } from "@homebound/truss/runtime";
29593
29782
  import { jsx as jsx220, jsxs as jsxs118 } from "react/jsx-runtime";
29594
29783
  function ScrollShadows(props) {
@@ -29606,9 +29795,9 @@ function ScrollShadows(props) {
29606
29795
  if (!bgColor.includes("rgba")) {
29607
29796
  throw new Error("ScrollShadows: bgColor prop must be in the format 'rgba(255, 255, 255, 1)'");
29608
29797
  }
29609
- const [showStartShadow, setShowStartShadow] = useState60(false);
29610
- const [showEndShadow, setShowEndShadow] = useState60(false);
29611
- const scrollRef = useRef69(null);
29798
+ const [showStartShadow, setShowStartShadow] = useState61(false);
29799
+ const [showEndShadow, setShowEndShadow] = useState61(false);
29800
+ const scrollRef = useRef70(null);
29612
29801
  const [startShadowStyles, endShadowStyles] = useMemo51(() => {
29613
29802
  const transparentBgColor = bgColor.replace(/,1\)$/, ",0)");
29614
29803
  const commonStyles = {
@@ -29729,10 +29918,10 @@ import { camelCase as camelCase7 } from "change-case";
29729
29918
  // src/components/AppNav/AppNavGroup.tsx
29730
29919
  import { useResizeObserver as useResizeObserver14 } from "@react-aria/utils";
29731
29920
  import { camelCase as camelCase6, kebabCase } from "change-case";
29732
- import { useCallback as useCallback41, useEffect as useEffect34, useMemo as useMemo53, useState as useState62 } from "react";
29921
+ import { useCallback as useCallback41, useEffect as useEffect34, useMemo as useMemo53, useState as useState63 } from "react";
29733
29922
 
29734
29923
  // src/components/AppNav/AppNavGroupTrigger.tsx
29735
- import { useMemo as useMemo52, useRef as useRef70 } from "react";
29924
+ import { useMemo as useMemo52, useRef as useRef71 } from "react";
29736
29925
  import { mergeProps as mergeProps35, useButton as useButton11, useFocusRing as useFocusRing17, useHover as useHover22 } from "react-aria";
29737
29926
  import { trussProps as trussProps128, mergeProps as mergeProps_15 } from "@homebound/truss/runtime";
29738
29927
  import { jsx as jsx221, jsxs as jsxs119 } from "react/jsx-runtime";
@@ -29745,7 +29934,7 @@ function AppNavGroupTrigger(props) {
29745
29934
  active = false
29746
29935
  } = props;
29747
29936
  const tid = useTestIds(props, "trigger");
29748
- const ref = useRef70(null);
29937
+ const ref = useRef71(null);
29749
29938
  const {
29750
29939
  buttonProps,
29751
29940
  isPressed
@@ -29904,7 +30093,7 @@ function entryHasIcons(item) {
29904
30093
  }
29905
30094
 
29906
30095
  // src/components/AppNav/useAppNavGroupExpanded.ts
29907
- import { useCallback as useCallback40, useState as useState61 } from "react";
30096
+ import { useCallback as useCallback40, useState as useState62 } from "react";
29908
30097
  var APP_NAV_EXPANDED_LINK_GROUPS_STORAGE_KEY = "beam.appNav.expandedLinkGroups";
29909
30098
  function loadStored() {
29910
30099
  try {
@@ -29923,7 +30112,7 @@ function persistLabel(label, expanded) {
29923
30112
  }
29924
30113
  function useAppNavGroupExpanded(linkGroup) {
29925
30114
  const { label } = linkGroup;
29926
- const [userExpanded, setUserExpanded] = useState61(() => {
30115
+ const [userExpanded, setUserExpanded] = useState62(() => {
29927
30116
  const stored = loadStored();
29928
30117
  return label in stored ? stored[label] : null;
29929
30118
  });
@@ -29964,11 +30153,11 @@ function AppNavGroupDisclosure(props) {
29964
30153
  } = useAppNavGroupExpanded(linkGroup);
29965
30154
  const tid = useTestIds(props, "linkGroup");
29966
30155
  const navGroupId = `nav-group-${kebabCase(linkGroup.label)}`;
29967
- const [contentEl, setContentEl] = useState62(null);
30156
+ const [contentEl, setContentEl] = useState63(null);
29968
30157
  const contentRef = useMemo53(() => ({
29969
30158
  current: contentEl
29970
30159
  }), [contentEl]);
29971
- const [contentHeight, setContentHeight] = useState62(expanded ? "auto" : "0");
30160
+ const [contentHeight, setContentHeight] = useState63(expanded ? "auto" : "0");
29972
30161
  useEffect34(() => {
29973
30162
  setContentHeight(expanded && contentEl ? `${contentEl.scrollHeight}px` : "0");
29974
30163
  }, [expanded, contentEl]);
@@ -30124,8 +30313,8 @@ import {
30124
30313
  useContext as useContext25,
30125
30314
  useEffect as useEffect35,
30126
30315
  useMemo as useMemo54,
30127
- useRef as useRef71,
30128
- useState as useState63
30316
+ useRef as useRef72,
30317
+ useState as useState64
30129
30318
  } from "react";
30130
30319
  import { jsx as jsx226 } from "react/jsx-runtime";
30131
30320
  var SIDE_NAV_LAYOUT_STATE_STORAGE_KEY = "beam.sideNavLayout.navState";
@@ -30151,11 +30340,11 @@ function resolveInitialNavState(defaultNavState) {
30151
30340
  }
30152
30341
  var SideNavLayoutContext = createContext15(void 0);
30153
30342
  function SideNavLayoutProvider(props) {
30154
- const [navState, setNavStateInternal] = useState63(
30343
+ const [navState, setNavStateInternal] = useState64(
30155
30344
  () => resolveInitialNavState(props.defaultNavState)
30156
30345
  );
30157
30346
  const bp = useBreakpoint();
30158
- const prevMdAndUp = useRef71(bp.mdAndUp);
30347
+ const prevMdAndUp = useRef72(bp.mdAndUp);
30159
30348
  useEffect35(() => {
30160
30349
  if (prevMdAndUp.current && !bp.mdAndUp) {
30161
30350
  setNavStateInternal((prev) => prev === "expanded" ? "collapse" : prev);
@@ -30243,7 +30432,7 @@ function SideNav(props) {
30243
30432
  }
30244
30433
 
30245
30434
  // src/components/Stepper.tsx
30246
- import { useRef as useRef72 } from "react";
30435
+ import { useRef as useRef73 } from "react";
30247
30436
  import { useButton as useButton12, useFocusRing as useFocusRing18, useHover as useHover23 } from "react-aria";
30248
30437
  import { trussProps as trussProps132, maybeCssVar as maybeCssVar63 } from "@homebound/truss/runtime";
30249
30438
  import { jsx as jsx228, jsxs as jsxs123 } from "react/jsx-runtime";
@@ -30325,7 +30514,7 @@ function StepButton(props) {
30325
30514
  onPress: onClick,
30326
30515
  isDisabled: disabled
30327
30516
  };
30328
- const ref = useRef72(null);
30517
+ const ref = useRef73(null);
30329
30518
  const {
30330
30519
  buttonProps,
30331
30520
  isPressed
@@ -30435,7 +30624,7 @@ function StepIcon({
30435
30624
  }
30436
30625
 
30437
30626
  // src/components/StepperTabs/StepperTab.tsx
30438
- import { useRef as useRef73 } from "react";
30627
+ import { useRef as useRef74 } from "react";
30439
30628
  import { mergeProps as mergeProps36, useButton as useButton13, useFocusRing as useFocusRing19, useHover as useHover24, VisuallyHidden as VisuallyHidden10 } from "react-aria";
30440
30629
  import { trussProps as trussProps133 } from "@homebound/truss/runtime";
30441
30630
  import { Fragment as Fragment49, jsx as jsx229, jsxs as jsxs124 } from "react/jsx-runtime";
@@ -30454,7 +30643,7 @@ function StepperTab(props) {
30454
30643
  onPress: () => onClick(value),
30455
30644
  isDisabled: disabled || collapsed
30456
30645
  };
30457
- const ref = useRef73(null);
30646
+ const ref = useRef74(null);
30458
30647
  const {
30459
30648
  buttonProps
30460
30649
  } = useButton13(ariaProps, ref);
@@ -30855,7 +31044,7 @@ function segmentWidth(count, total) {
30855
31044
  }
30856
31045
 
30857
31046
  // src/components/TableSummary/TableSummary.tsx
30858
- import { useRef as useRef74 } from "react";
31047
+ import { useRef as useRef75 } from "react";
30859
31048
  import { mergeProps as mergeProps38, useButton as useButton14, useFocusRing as useFocusRing20, useHover as useHover25 } from "react-aria";
30860
31049
  import { trussProps as trussProps138, maybeCssVar as maybeCssVar65 } from "@homebound/truss/runtime";
30861
31050
  import { jsx as jsx235, jsxs as jsxs129 } from "react/jsx-runtime";
@@ -30915,7 +31104,7 @@ function MetricButton(props) {
30915
31104
  metric,
30916
31105
  divider
30917
31106
  } = props;
30918
- const ref = useRef74(null);
31107
+ const ref = useRef75(null);
30919
31108
  const {
30920
31109
  buttonProps
30921
31110
  } = useButton14({
@@ -30992,7 +31181,7 @@ function MetricButton(props) {
30992
31181
 
30993
31182
  // src/components/DnDGrid/DnDGrid.tsx
30994
31183
  import equal2 from "fast-deep-equal";
30995
- import { useCallback as useCallback43, useEffect as useEffect36, useRef as useRef75 } from "react";
31184
+ import { useCallback as useCallback43, useEffect as useEffect36, useRef as useRef76 } from "react";
30996
31185
 
30997
31186
  // src/utils/inlineStyles.ts
30998
31187
  function isInlineStyleValue(value) {
@@ -31042,13 +31231,13 @@ function DnDGrid(props) {
31042
31231
  activeItemStyles,
31043
31232
  lockAxis
31044
31233
  } = props;
31045
- const gridEl = useRef75(null);
31046
- const dragEl = useRef75(void 0);
31047
- const cloneEl = useRef75(void 0);
31048
- const initialOrder = useRef75(void 0);
31049
- const styleSnapshot = useRef75(void 0);
31050
- const reorderViaKeyboard = useRef75(false);
31051
- const transformFrom = useRef75({
31234
+ const gridEl = useRef76(null);
31235
+ const dragEl = useRef76(void 0);
31236
+ const cloneEl = useRef76(void 0);
31237
+ const initialOrder = useRef76(void 0);
31238
+ const styleSnapshot = useRef76(void 0);
31239
+ const reorderViaKeyboard = useRef76(false);
31240
+ const transformFrom = useRef76({
31052
31241
  x: 0,
31053
31242
  y: 0
31054
31243
  });
@@ -32077,17 +32266,17 @@ function OpenModal(props) {
32077
32266
 
32078
32267
  // src/components/Navbar/NavbarMobileMenu.tsx
32079
32268
  import { AnimatePresence as AnimatePresence6, motion as motion7 } from "framer-motion";
32080
- import { useEffect as useEffect39, useState as useState65 } from "react";
32269
+ import { useEffect as useEffect39, useState as useState66 } from "react";
32081
32270
  import { FocusScope as FocusScope7, usePreventScroll as usePreventScroll4 } from "react-aria";
32082
32271
  import { createPortal as createPortal11 } from "react-dom";
32083
32272
  import { useLocation } from "react-router-dom";
32084
32273
 
32085
32274
  // src/layouts/NavbarLayout/MobileSubNavContext.tsx
32086
- import { createContext as createContext18, useContext as useContext29, useLayoutEffect as useLayoutEffect16, useMemo as useMemo60, useState as useState64 } from "react";
32275
+ import { createContext as createContext18, useContext as useContext29, useLayoutEffect as useLayoutEffect17, useMemo as useMemo60, useState as useState65 } from "react";
32087
32276
  import { jsx as jsx251 } from "react/jsx-runtime";
32088
32277
  var MobileSubNavContext = createContext18(void 0);
32089
32278
  function MobileSubNavProvider(props) {
32090
- const [mobileSubNav, setMobileSubNav] = useState64(null);
32279
+ const [mobileSubNav, setMobileSubNav] = useState65(null);
32091
32280
  const value = useMemo60(() => ({ mobileSubNav, setMobileSubNav }), [mobileSubNav]);
32092
32281
  return /* @__PURE__ */ jsx251(MobileSubNavContext.Provider, { value, children: props.children });
32093
32282
  }
@@ -32099,11 +32288,11 @@ function useRegisterMobileSubNav(content2) {
32099
32288
  const setMobileSubNav = ctx?.setMobileSubNav;
32100
32289
  const enabled = !useBreakpoint().mdAndUp;
32101
32290
  const { top, items, footer } = content2;
32102
- useLayoutEffect16(() => {
32291
+ useLayoutEffect17(() => {
32103
32292
  if (!setMobileSubNav || !enabled) return;
32104
32293
  setMobileSubNav({ top, items, footer });
32105
32294
  }, [setMobileSubNav, enabled, top, items, footer]);
32106
- useLayoutEffect16(() => {
32295
+ useLayoutEffect17(() => {
32107
32296
  if (!setMobileSubNav || !enabled) return;
32108
32297
  return () => setMobileSubNav(null);
32109
32298
  }, [setMobileSubNav, enabled]);
@@ -32118,8 +32307,8 @@ function NavbarMobileMenu(props) {
32118
32307
  items
32119
32308
  } = props;
32120
32309
  const tid = useTestIds(props, "navbar");
32121
- const [isOpen2, setIsOpen] = useState65(false);
32122
- const [level, setLevel] = useState65("sub");
32310
+ const [isOpen2, setIsOpen] = useState66(false);
32311
+ const [level, setLevel] = useState66("sub");
32123
32312
  const {
32124
32313
  pathname,
32125
32314
  search
@@ -32278,11 +32467,11 @@ function NavbarMobileDrawer({
32278
32467
  }
32279
32468
 
32280
32469
  // src/hooks/useContentOverflow.ts
32281
- import { useCallback as useCallback44, useLayoutEffect as useLayoutEffect17, useRef as useRef76, useState as useState66 } from "react";
32470
+ import { useCallback as useCallback44, useLayoutEffect as useLayoutEffect18, useRef as useRef77, useState as useState67 } from "react";
32282
32471
  function useContentOverflow(enabled = true) {
32283
- const containerRef = useRef76(null);
32284
- const contentRef = useRef76(null);
32285
- const [overflows, setOverflows] = useState66(false);
32472
+ const containerRef = useRef77(null);
32473
+ const contentRef = useRef77(null);
32474
+ const [overflows, setOverflows] = useState67(false);
32286
32475
  const checkContentOverflow = useCallback44(() => {
32287
32476
  const container = containerRef.current;
32288
32477
  const content2 = contentRef.current;
@@ -32292,7 +32481,7 @@ function useContentOverflow(enabled = true) {
32292
32481
  }
32293
32482
  setOverflows(content2.offsetWidth > container.clientWidth);
32294
32483
  }, [enabled]);
32295
- useLayoutEffect17(() => {
32484
+ useLayoutEffect18(() => {
32296
32485
  checkContentOverflow();
32297
32486
  window.addEventListener("resize", checkContentOverflow);
32298
32487
  return () => window.removeEventListener("resize", checkContentOverflow);
@@ -32478,7 +32667,7 @@ function simpleDataRows(data = []) {
32478
32667
 
32479
32668
  // src/components/Tabs.tsx
32480
32669
  import { camelCase as camelCase8 } from "change-case";
32481
- import { useEffect as useEffect41, useMemo as useMemo61, useRef as useRef77, useState as useState67 } from "react";
32670
+ import { useEffect as useEffect41, useMemo as useMemo61, useRef as useRef78, useState as useState68 } from "react";
32482
32671
  import { mergeProps as mergeProps42, useFocusRing as useFocusRing22, useHover as useHover27 } from "react-aria";
32483
32672
  import { matchPath } from "react-router";
32484
32673
  import { Link as Link7, useLocation as useLocation2 } from "react-router-dom";
@@ -32558,8 +32747,8 @@ function Tabs(props) {
32558
32747
  focusProps
32559
32748
  } = useFocusRing22();
32560
32749
  const tid = useTestIds(others, "tabs");
32561
- const [active, setActive] = useState67(selected);
32562
- const ref = useRef77(null);
32750
+ const [active, setActive] = useState68(selected);
32751
+ const ref = useRef78(null);
32563
32752
  useEffect41(() => setActive(selected), [selected]);
32564
32753
  function onKeyUp(e) {
32565
32754
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
@@ -33070,7 +33259,7 @@ import { useCheckboxGroupState as useCheckboxGroupState4, useRadioGroupState as
33070
33259
  import { trussProps as trussProps151, maybeCssVar as maybeCssVar71 } from "@homebound/truss/runtime";
33071
33260
 
33072
33261
  // src/forms/FormSection/FormSectionChild.tsx
33073
- import { useRef as useRef78 } from "react";
33262
+ import { useRef as useRef79 } from "react";
33074
33263
  import { mergeProps as mergeProps46, useCheckboxGroupItem as useCheckboxGroupItem4, useFocusRing as useFocusRing23, useRadio as useRadio3, VisuallyHidden as VisuallyHidden11 } from "react-aria";
33075
33264
  import { trussProps as trussProps150 } from "@homebound/truss/runtime";
33076
33265
  import { Fragment as Fragment56, jsx as jsx260, jsxs as jsxs141 } from "react/jsx-runtime";
@@ -33087,7 +33276,7 @@ function FormSectionChild(props) {
33087
33276
  group
33088
33277
  } = props;
33089
33278
  const tid = useTestIds(props, "formSectionChild");
33090
- const itemRef = useRef78(null);
33279
+ const itemRef = useRef79(null);
33091
33280
  const isDraggable = !!orderField;
33092
33281
  const {
33093
33282
  dragItemProps,
@@ -33129,7 +33318,7 @@ function FormSectionChildRadio(props) {
33129
33318
  value,
33130
33319
  label
33131
33320
  } = props;
33132
- const ref = useRef78(null);
33321
+ const ref = useRef79(null);
33133
33322
  const {
33134
33323
  inputProps,
33135
33324
  isDisabled,
@@ -33155,7 +33344,7 @@ function FormSectionChildCheckbox(props) {
33155
33344
  value,
33156
33345
  label
33157
33346
  } = props;
33158
- const ref = useRef78(null);
33347
+ const ref = useRef79(null);
33159
33348
  const {
33160
33349
  inputProps,
33161
33350
  isDisabled,
@@ -33348,12 +33537,12 @@ var railAndShellPx = centeredShellMaxPx.sm + jumpLinksRailWidthPx;
33348
33537
  var jumpLinksRailReservation = `clamp(0px, 100% - ${railAndShellPx}px, ${jumpLinksRailWidthPx}px)`;
33349
33538
 
33350
33539
  // src/layouts/FormSectionLayout/useActiveJumpLink.ts
33351
- import { useLayoutEffect as useLayoutEffect18, useState as useState68 } from "react";
33540
+ import { useLayoutEffect as useLayoutEffect19, useState as useState69 } from "react";
33352
33541
  var activationLeadPx = 120;
33353
33542
  function useActiveJumpLink(sectionIds) {
33354
33543
  const idsKey = sectionIds.join("\0");
33355
- const [activeId, setActiveId] = useState68(sectionIds[0]);
33356
- useLayoutEffect18(() => {
33544
+ const [activeId, setActiveId] = useState69(sectionIds[0]);
33545
+ useLayoutEffect19(() => {
33357
33546
  const ids = idsKey.length === 0 ? [] : idsKey.split("\0");
33358
33547
  if (ids.length === 0) return;
33359
33548
  const update = () => {
@@ -33454,7 +33643,7 @@ function FormSectionLayout(props) {
33454
33643
  }
33455
33644
 
33456
33645
  // src/layouts/PageBanner/usePageBanner.tsx
33457
- import { useEffect as useEffect42, useId as useId5, useLayoutEffect as useLayoutEffect19 } from "react";
33646
+ import { useEffect as useEffect42, useId as useId5, useLayoutEffect as useLayoutEffect20 } from "react";
33458
33647
 
33459
33648
  // src/layouts/PageBanner/pageBannerStore.ts
33460
33649
  var current;
@@ -33492,7 +33681,7 @@ function clearPageBanner(id) {
33492
33681
  // src/layouts/PageBanner/usePageBanner.tsx
33493
33682
  function usePageBanner(banner) {
33494
33683
  const id = useId5();
33495
- useLayoutEffect19(() => {
33684
+ useLayoutEffect20(() => {
33496
33685
  if (!banner) return;
33497
33686
  setPageBanner(id, banner);
33498
33687
  return () => clearPageBanner(id);
@@ -33511,87 +33700,6 @@ function PageBanner(props) {
33511
33700
  import { useMemo as useMemo62, useRef as useRef80 } from "react";
33512
33701
  import { mergeProps as mergeProps47, maybeCssVar as maybeCssVar74 } from "@homebound/truss/runtime";
33513
33702
 
33514
- // src/layouts/useAutoHideOnScroll.ts
33515
- import { useLayoutEffect as useLayoutEffect20, useRef as useRef79, useState as useState69 } from "react";
33516
- var THRESHOLD = 80;
33517
- function getInitialAutoHideState() {
33518
- if (typeof window === "undefined" || window.scrollY <= 0) {
33519
- return "resting";
33520
- }
33521
- return "hidden";
33522
- }
33523
- function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
33524
- const initial = getInitialAutoHideState();
33525
- const [state, setState] = useState69(initial);
33526
- const stateRef = useRef79(initial);
33527
- const getTopOffsetRef = useRef79(getTopOffset);
33528
- getTopOffsetRef.current = getTopOffset;
33529
- const lastScrollY = useRef79(Number.POSITIVE_INFINITY);
33530
- const lastScrollHeight = useRef79(0);
33531
- useLayoutEffect20(() => {
33532
- if (!enabled) {
33533
- stateRef.current = "resting";
33534
- lastScrollY.current = Number.POSITIVE_INFINITY;
33535
- lastScrollHeight.current = 0;
33536
- setState("resting");
33537
- return;
33538
- }
33539
- const commit = (nextState) => {
33540
- if (nextState !== stateRef.current) {
33541
- stateRef.current = nextState;
33542
- setState(nextState);
33543
- }
33544
- };
33545
- const autoHideStateOnLayoutChange = (rect, topOffset) => {
33546
- const nextAtTop = rect.top >= topOffset;
33547
- let next = stateRef.current;
33548
- if (nextAtTop) {
33549
- next = "resting";
33550
- } else if (rect.bottom < -THRESHOLD && next !== "revealed") {
33551
- next = "hidden";
33552
- }
33553
- return next;
33554
- };
33555
- const updateAutoHideState = () => {
33556
- const el = spacerRef.current;
33557
- if (!el) return;
33558
- const doc = document.documentElement;
33559
- const currentScrollHeight = doc.scrollHeight;
33560
- const scrollHeightChanged = lastScrollHeight.current !== 0 && currentScrollHeight !== lastScrollHeight.current;
33561
- lastScrollHeight.current = currentScrollHeight;
33562
- if (window.scrollY <= 0) {
33563
- lastScrollY.current = 0;
33564
- commit("resting");
33565
- return;
33566
- }
33567
- const currentY = window.scrollY;
33568
- const rect = el.getBoundingClientRect();
33569
- const topOffset = getTopOffsetRef.current?.() ?? 0;
33570
- if (scrollHeightChanged) {
33571
- lastScrollY.current = currentY;
33572
- commit(autoHideStateOnLayoutChange(rect, topOffset));
33573
- return;
33574
- }
33575
- const dy = currentY - lastScrollY.current;
33576
- lastScrollY.current = currentY;
33577
- const atBottom = currentY >= doc.scrollHeight - doc.clientHeight;
33578
- const nextAtTop = rect.top >= topOffset;
33579
- let next = stateRef.current;
33580
- if (nextAtTop) {
33581
- next = "resting";
33582
- } else if (rect.bottom < -THRESHOLD) {
33583
- if (dy < 0 && !atBottom) next = "revealed";
33584
- else if (dy > 0) next = "hidden";
33585
- }
33586
- commit(next);
33587
- };
33588
- updateAutoHideState();
33589
- window.addEventListener("scroll", updateAutoHideState, { passive: true });
33590
- return () => window.removeEventListener("scroll", updateAutoHideState);
33591
- }, [enabled, spacerRef]);
33592
- return { state };
33593
- }
33594
-
33595
33703
  // src/layouts/useMeasuredHeight.ts
33596
33704
  import { useResizeObserver as useResizeObserver15 } from "@react-aria/utils";
33597
33705
  import { useCallback as useCallback47, useLayoutEffect as useLayoutEffect21, useState as useState70 } from "react";