@ciridae/ui 2.79.0 → 2.79.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.
@@ -60,9 +60,9 @@ export type AppNavigationProps = Omit<ComponentProps<"aside">, "children"> & {
60
60
  };
61
61
  /**
62
62
  * Whether the sidebar has room to unfold every section: the free space between its navigation and
63
- * its footer covers the `hiddenRows` its folds hide, less the More rows unfolding removes. Once it
64
- * has, it loses it only when the navigation runs out of room, so it does not flicker at the
65
- * threshold.
63
+ * its footer, less the gap the navigation cannot grow into, covers the `hiddenRows` its folds hide,
64
+ * less the More rows unfolding removes. Once it has, it loses it only when the navigation runs out
65
+ * of room, so it does not flicker at the threshold.
66
66
  */
67
67
  export declare function useSidebarRoom(hiddenRows: number): {
68
68
  navRef: import("react").RefObject<HTMLDivElement | null>;
@@ -44,9 +44,9 @@ const expandButtonRail = css({
44
44
  });
45
45
  /**
46
46
  * Whether the sidebar has room to unfold every section: the free space between its navigation and
47
- * its footer covers the `hiddenRows` its folds hide, less the More rows unfolding removes. Once it
48
- * has, it loses it only when the navigation runs out of room, so it does not flicker at the
49
- * threshold.
47
+ * its footer, less the gap the navigation cannot grow into, covers the `hiddenRows` its folds hide,
48
+ * less the More rows unfolding removes. Once it has, it loses it only when the navigation runs out
49
+ * of room, so it does not flicker at the threshold.
50
50
  */
51
51
  export function useSidebarRoom(hiddenRows) {
52
52
  const navRef = useRef(null);
@@ -55,13 +55,17 @@ export function useSidebarRoom(hiddenRows) {
55
55
  useLayoutEffect(() => {
56
56
  const nav = navRef.current;
57
57
  const footer = footerRef.current;
58
- if (!nav || !footer)
58
+ const sidebar = footer?.parentElement;
59
+ if (!nav || !footer || !sidebar)
59
60
  return;
60
61
  const measure = () => {
61
62
  const free = footer.getBoundingClientRect().top - nav.getBoundingClientRect().bottom;
63
+ // The sidebar keeps its gap between the navigation and the footer, so an unfolded
64
+ // navigation overflows and scrolls while that much free space is left.
65
+ const footerGap = parseFloat(getComputedStyle(sidebar).rowGap);
62
66
  setRoomy((current) => current
63
67
  ? free >= 0 && nav.scrollHeight <= nav.clientHeight + 1
64
- : free >= measureHeightUnfoldingAdds(nav, hiddenRows));
68
+ : free - footerGap >= measureHeightUnfoldingAdds(nav, hiddenRows));
65
69
  };
66
70
  measure();
67
71
  const observer = new ResizeObserver(measure);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciridae/ui",
3
- "version": "2.79.0",
3
+ "version": "2.79.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",