@homebound/beam 2.71.7 → 2.71.8

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.
@@ -1,5 +1,6 @@
1
1
  import { ReactNode, ReactPortal } from "react";
2
2
  /** Helper component for placing scrollable content within a `NestedScrollProvider`. */
3
- export declare function ScrollableContent({ children }: {
3
+ export declare function ScrollableContent({ children, virtualized, }: {
4
4
  children: ReactNode;
5
+ virtualized?: boolean;
5
6
  }): ReactPortal;
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ScrollableContent = void 0;
4
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
4
5
  const react_dom_1 = require("react-dom");
6
+ const FullBleed_1 = require("./FullBleed");
5
7
  const ScrollableParent_1 = require("./ScrollableParent");
8
+ const Css_1 = require("../../Css");
6
9
  /** Helper component for placing scrollable content within a `NestedScrollProvider`. */
7
- function ScrollableContent({ children }) {
8
- const { scrollableEl } = (0, ScrollableParent_1.useScrollableParent)();
9
- return (0, react_dom_1.createPortal)(children, scrollableEl);
10
+ function ScrollableContent({ children, virtualized = false, }) {
11
+ const { scrollableEl, pl } = (0, ScrollableParent_1.useScrollableParent)();
12
+ return (0, react_dom_1.createPortal)(!virtualized ? (children) : (
13
+ // To prevent Virtuoso's scrollbar from being set in based on the Layout's padding, we will use the FullBleed component w/o padding to push it back over
14
+ (0, jsx_runtime_1.jsx)(FullBleed_1.FullBleed, Object.assign({ omitPadding: true }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.h100.pl(pl).$ }, { children: children }), void 0) }), void 0)), scrollableEl);
10
15
  }
11
16
  exports.ScrollableContent = ScrollableContent;
@@ -10,14 +10,19 @@ const ScrollableParentContext = (0, react_1.createContext)({
10
10
  pl: 0,
11
11
  });
12
12
  function ScrollableParent({ children, xss }) {
13
- const scrollableEl = (0, react_1.useMemo)(() => document.createElement("div"), []);
13
+ const scrollableEl = (0, react_1.useMemo)(() => {
14
+ const el = document.createElement("div");
15
+ // Ensure this wrapping div takes up the full height of its container
16
+ el.style.height = "100%";
17
+ return el;
18
+ }, []);
14
19
  const scrollableRef = (0, react_1.useRef)(null);
15
20
  const { paddingLeft, paddingRight, ...otherXss } = xss || {};
16
21
  const context = { scrollableEl, pl: paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : 0, pr: paddingRight !== null && paddingRight !== void 0 ? paddingRight : 0 };
17
22
  (0, react_1.useEffect)(() => {
18
23
  scrollableRef.current.appendChild(scrollableEl);
19
24
  }, [scrollableEl]);
20
- return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, Object.assign({ value: context }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: { ...Css_1.Css.mh0.mw0.df.fdc.$, ...otherXss } }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.pl(context.pl).pr(context.pr).$ }, { children: children }), void 0), (0, jsx_runtime_1.jsx)("div", { css: { ...Css_1.Css.overflowAuto.$, ...Css_1.Css.pl(context.pl).pr(context.pr).$ }, ref: scrollableRef }, void 0)] }), void 0) }), void 0));
25
+ return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, Object.assign({ value: context }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: { ...Css_1.Css.mh0.mw0.df.fdc.$, ...otherXss } }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.pl(context.pl).pr(context.pr).$ }, { children: children }), void 0), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.pl(context.pl).pr(context.pr).$, ref: scrollableRef }, void 0)] }), void 0) }), void 0));
21
26
  }
22
27
  exports.ScrollableParent = ScrollableParent;
23
28
  function useScrollableParent() {
@@ -1,3 +1,4 @@
1
+ export * from "./FullBleed";
1
2
  export * from "./PreventBrowserScroll";
2
3
  export * from "./ScrollableContent";
3
4
  export * from "./ScrollableParent";
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./FullBleed"), exports);
13
14
  __exportStar(require("./PreventBrowserScroll"), exports);
14
15
  __exportStar(require("./ScrollableContent"), exports);
15
16
  __exportStar(require("./ScrollableParent"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.71.7",
3
+ "version": "2.71.8",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",