@expofp/ui 3.41.0 → 3.42.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.
@@ -6,6 +6,7 @@ import debounce from '../../shared/debounce';
6
6
  import { useKeyboardInset } from '../../shared/hooks/useKeyboardInset';
7
7
  import { useSheetDrag } from '../../shared/hooks/useSheetDrag';
8
8
  import { useWindowSize } from '../../shared/hooks/useWindowSize';
9
+ import { OverlayHeaderContext } from './OverlayHeaderContext';
9
10
  import { OverlayScrollContext } from './OverlayScrollContext';
10
11
  const TRANSITION_DURATION = '0.3s';
11
12
  const DEFAULT_SCROLL_THRESHOLD = 10;
@@ -61,6 +62,8 @@ const Overlay = ({ children, open, size = 'medium', particles, className, onChan
61
62
  scrollRef.current = node;
62
63
  setScrollElement(node);
63
64
  }, []);
65
+ // The header slot, held as state for the same reason.
66
+ const [headerElement, setHeaderElement] = useState(null);
64
67
  // The snap point the sheet actually sits on. The prop may be undefined
65
68
  // before the host has chosen one, and a drag needs a value to start from.
66
69
  const [currentSnap, setCurrentSnap] = useState(size);
@@ -226,9 +229,9 @@ const Overlay = ({ children, open, size = 'medium', particles, className, onChan
226
229
  'efp-overlay--scrolled': isScrolled,
227
230
  'efp-overlay--forced-full': forceFull && mobile,
228
231
  'efp-overlay--button-inset': mobile && withFloatingButton,
229
- }, className), style: positioningStyles, ref: overlayPanelRef, onPointerDown: onPointerDown, children: [!disableDrag && _jsx("div", { className: "efp-overlay__draghandle", "data-sheet-handle": true }), _jsxs("div", { className: "efp-overlay__scroll", ref: attachScroll, onScroll: () => {
232
+ }, className), style: positioningStyles, ref: overlayPanelRef, onPointerDown: onPointerDown, children: [!disableDrag && _jsx("div", { className: "efp-overlay__draghandle", "data-sheet-handle": true }), _jsx("div", { className: "efp-overlay__header", ref: setHeaderElement }), _jsxs("div", { className: "efp-overlay__scroll", ref: attachScroll, onScroll: () => {
230
233
  handleScroll();
231
234
  debouncedScrollActivity();
232
- }, children: [particles, _jsx("div", { className: "efp-overlay__content", children: children ? children : noContentLabel })] })] }) }));
235
+ }, children: [particles, _jsx("div", { className: "efp-overlay__content", children: _jsx(OverlayHeaderContext, { value: headerElement, children: children ? children : noContentLabel }) })] })] }) }));
233
236
  };
234
237
  export default Overlay;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The overlay's header slot: a node above the scroll container that descendants can portal into
3
+ * (e.g. a toolbar that must not scroll with the content). Provided by {@link Overlay}; `null` when
4
+ * rendered outside an overlay.
5
+ */
6
+ export declare const OverlayHeaderContext: import("react").Context<HTMLDivElement | null>;
7
+ //# sourceMappingURL=OverlayHeaderContext.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+ /**
3
+ * The overlay's header slot: a node above the scroll container that descendants can portal into
4
+ * (e.g. a toolbar that must not scroll with the content). Provided by {@link Overlay}; `null` when
5
+ * rendered outside an overlay.
6
+ */
7
+ export const OverlayHeaderContext = createContext(null);
@@ -1,4 +1,5 @@
1
1
  export type { OverlayProps, Size } from './Overlay';
2
2
  export { default } from './Overlay';
3
+ export { OverlayHeaderContext } from './OverlayHeaderContext';
3
4
  export { OverlayScrollContext } from './OverlayScrollContext';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export { default } from './Overlay';
2
+ export { OverlayHeaderContext } from './OverlayHeaderContext';
2
3
  export { OverlayScrollContext } from './OverlayScrollContext';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/ui",
3
- "version": "3.41.0",
3
+ "version": "3.42.0",
4
4
  "type": "module",
5
5
  "description": "ExpoFP SDK internal: shared pure React UI components",
6
6
  "homepage": "https://developer.expofp.com/",