@homebound/beam 2.259.0 → 2.260.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.
@@ -1,7 +1,8 @@
1
1
  import { ReactElement } from "react";
2
2
  import { Palette } from "../../../Css";
3
- export declare function RightPaneLayout({ children, paneBgColor, paneWidth, }: {
3
+ export declare function RightPaneLayout({ children, paneBgColor, paneWidth, defaultPaneContent, }: {
4
4
  children: ReactElement;
5
5
  paneBgColor?: Palette;
6
6
  paneWidth?: number;
7
+ defaultPaneContent?: ReactElement;
7
8
  }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -6,7 +6,7 @@ const framer_motion_1 = require("framer-motion");
6
6
  const react_1 = require("react");
7
7
  const Css_1 = require("../../../Css");
8
8
  const RightPaneContext_1 = require("./RightPaneContext");
9
- function RightPaneLayout({ children, paneBgColor = Css_1.Palette.White, paneWidth = 450, }) {
9
+ function RightPaneLayout({ children, paneBgColor = Css_1.Palette.White, paneWidth = 450, defaultPaneContent, }) {
10
10
  const { isRightPaneOpen, rightPaneContent, clearPane, closePane } = (0, RightPaneContext_1.useRightPaneContext)();
11
11
  // Close pane on page unmount because otherwise the next page that has a right pane will show our stale content
12
12
  (0, react_1.useEffect)(() => {
@@ -14,12 +14,21 @@ function RightPaneLayout({ children, paneBgColor = Css_1.Palette.White, paneWidt
14
14
  closePane();
15
15
  };
16
16
  }, []);
17
- return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100.df.overflowXHidden.$, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.w(`calc(100% - ${paneWidth + 24}px)`)
18
- .add("transition", "width .2s linear")
19
- .h100.mr3.overflowXAuto.if(!isRightPaneOpen).w100.mr0.$, children: children }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: isRightPaneOpen && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { layout: "position", "data-testid": "rightPaneContent", css: Css_1.Css.bgColor(paneBgColor).h100.wPx(paneWidth).$,
20
- // Keeping initial x to offset pane width and space between panel and page content
21
- initial: { x: paneWidth + 24 }, animate: { x: 0 }, transition: { ease: "linear", duration: 0.2 }, exit: { transition: { ease: "linear", duration: 0.2 }, x: paneWidth },
22
- // Clear the content of the detail pane when the animation is completed and only when pane is closing
23
- onAnimationComplete: (definition) => definition.x !== 0 && clearPane(), children: rightPaneContent }, "rightPane")) })] }) }));
17
+ return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100.df.overflowXHidden.$, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { css: {
18
+ ...Css_1.Css.w(`calc(100% - ${paneWidth + 24}px)`).add("transition", "width .2s linear").h100.mr3.overflowXAuto.$,
19
+ ...Css_1.Css.if(!isRightPaneOpen).w100.mr0.$,
20
+ ...Css_1.Css.if(!!defaultPaneContent).w(`calc(100% - ${paneWidth + 24}px)`).mr3.$,
21
+ }, children: children }), (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.position("relative").if(!!defaultPaneContent).wPx(paneWidth).$, children: [defaultPaneContent && ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100
22
+ .wPx(paneWidth)
23
+ .left(0)
24
+ .position("absolute")
25
+ .add("transition", "all .3s ease-in-out")
26
+ .if(isRightPaneOpen)
27
+ .add("opacity", 0)
28
+ .left(100).$, children: defaultPaneContent })), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: isRightPaneOpen && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { layout: "position", "data-testid": "rightPaneContent", css: Css_1.Css.bgColor(paneBgColor).h100.wPx(paneWidth).$,
29
+ // Keeping initial x to offset pane width and space between panel and page content
30
+ initial: { x: paneWidth + 24, position: "absolute" }, animate: { x: 0 }, transition: { ease: "linear", duration: 0.2 }, exit: { transition: { ease: "linear", duration: 0.2 }, x: paneWidth },
31
+ // Clear the content of the detail pane when the animation is completed and only when pane is closing
32
+ onAnimationComplete: (definition) => definition.x !== 0 && clearPane(), children: rightPaneContent }, "rightPane")) })] })] }) }));
24
33
  }
25
34
  exports.RightPaneLayout = RightPaneLayout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.259.0",
3
+ "version": "2.260.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",