@homebound/beam 2.183.3 → 2.184.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.
@@ -1,8 +1,10 @@
1
1
  import { ReactNode, ReactPortal } from "react";
2
+ import { Palette } from "../../Css";
2
3
  interface ScrollableContentProps {
3
4
  children: ReactNode;
4
5
  virtualized?: boolean;
5
6
  omitBottomPadding?: true;
7
+ bgColor?: Palette;
6
8
  }
7
9
  /** Helper component for placing scrollable content within a `ScrollableParent`. */
8
10
  export declare function ScrollableContent(props: ScrollableContentProps): ReactPortal | JSX.Element;
@@ -4,13 +4,12 @@ exports.ScrollableContent = void 0;
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_dom_1 = require("react-dom");
7
- const FullBleed_1 = require("./FullBleed");
8
7
  const ScrollableParent_1 = require("./ScrollableParent");
9
8
  const Css_1 = require("../../Css");
10
9
  /** Helper component for placing scrollable content within a `ScrollableParent`. */
11
10
  function ScrollableContent(props) {
12
- const { children, virtualized = false, omitBottomPadding } = props;
13
- const { scrollableEl, setPortalTick, pl } = (0, ScrollableParent_1.useScrollableParent)();
11
+ const { children, virtualized = false, omitBottomPadding, bgColor } = props;
12
+ const { scrollableEl, setPortalTick, pl, pr } = (0, ScrollableParent_1.useScrollableParent)();
14
13
  (0, react_1.useEffect)(() => {
15
14
  // The below `tick` logic is a way to detect whether the ScrollableContent is being used.
16
15
  // The ScrollableParent sets scrolling style based on whether or not there are children inside of the `scrollableEl` portal.
@@ -22,8 +21,10 @@ function ScrollableContent(props) {
22
21
  if (!scrollableEl) {
23
22
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }, void 0);
24
23
  }
25
- return (0, react_dom_1.createPortal)(!virtualized ? (omitBottomPadding ? (children) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: ScrollableParent_1.scrollContainerBottomPadding }, { children: children }), void 0))) : (
26
- // 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
27
- (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);
24
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
25
+ ...Css_1.Css.h100.pr(pr).pl(pl).if(virtualized).pr0.$,
26
+ ...(bgColor && Css_1.Css.bgColor(bgColor).$),
27
+ ...(!omitBottomPadding && !virtualized && ScrollableParent_1.scrollContainerBottomPadding),
28
+ } }, { children: children }), void 0), scrollableEl);
28
29
  }
29
30
  exports.ScrollableContent = ScrollableContent;
@@ -13,10 +13,10 @@ interface ScrollableParentContextProviderProps {
13
13
  export declare function ScrollableParent(props: PropsWithChildren<ScrollableParentContextProviderProps>): import("@emotion/react/jsx-runtime").JSX.Element;
14
14
  export declare function useScrollableParent(): ScrollableParentContextProps;
15
15
  export declare const scrollContainerBottomPadding: {
16
- height: import("csstype").Property.Height<0 | (string & {})> | undefined;
17
- } & {
18
16
  content: import("csstype").Property.Content | undefined;
19
17
  } & {
20
18
  display: import("csstype").Property.Display | undefined;
19
+ } & {
20
+ height: import("csstype").Property.Height<0 | (string & {})> | undefined;
21
21
  };
22
22
  export {};
@@ -33,8 +33,8 @@ function ScrollableParent(props) {
33
33
  }, [scrollableEl]);
34
34
  return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, Object.assign({ value: context }, { children: (0, jsx_runtime_1.jsxs)(Tag, Object.assign({ css: { ...Css_1.Css.mh0.mw0.fg1.df.fdc.$, ...otherXss } }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
35
35
  ...Css_1.Css.pl(context.pl).pr(context.pr).$,
36
- ...(!hasScrollableContent ? { ...Css_1.Css.overflowAuto.$, ...exports.scrollContainerBottomPadding } : undefined),
37
- } }, { 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));
36
+ ...(!hasScrollableContent ? { ...Css_1.Css.overflowAuto.h100.$, ...exports.scrollContainerBottomPadding } : undefined),
37
+ } }, { children: children }), void 0), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.$, ref: scrollableRef }, void 0)] }), void 0) }), void 0));
38
38
  }
39
39
  exports.ScrollableParent = ScrollableParent;
40
40
  function useScrollableParent() {
@@ -42,4 +42,4 @@ function useScrollableParent() {
42
42
  }
43
43
  exports.useScrollableParent = useScrollableParent;
44
44
  // Styles to wrap around the scrollable content in order to give padding beneath the content within the scrollable container.
45
- exports.scrollContainerBottomPadding = Css_1.Css.h100.addIn("&:after", Css_1.Css.contentEmpty.db.h2.$).$;
45
+ exports.scrollContainerBottomPadding = Css_1.Css.addIn("&:after", Css_1.Css.contentEmpty.db.h2.$).$;
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import type { IconKey } from "./";
3
- import { Margin, Only, Xss } from "../Css";
3
+ import { Margin, Only, Padding, Xss } from "../Css";
4
4
  export interface Tab<V extends string = string> {
5
5
  name: string;
6
6
  value: V;
@@ -8,7 +8,7 @@ export interface Tab<V extends string = string> {
8
8
  endAdornment?: ReactNode;
9
9
  disabled?: boolean;
10
10
  }
11
- declare type TabsContentXss = Xss<Margin>;
11
+ declare type TabsContentXss = Xss<Margin | Padding | "backgroundColor">;
12
12
  export interface TabsProps<V extends string, X> {
13
13
  ariaLabel?: string;
14
14
  selected: V;
@@ -7,6 +7,7 @@ const react_1 = require("react");
7
7
  const react_aria_1 = require("react-aria");
8
8
  const react_router_1 = require("react-router");
9
9
  const react_router_dom_1 = require("react-router-dom");
10
+ const components_1 = require("./");
10
11
  const Css_1 = require("../Css");
11
12
  const utils_1 = require("../utils");
12
13
  const defaultTestId_1 = require("../utils/defaultTestId");
@@ -21,7 +22,9 @@ const Icon_1 = require("./Icon");
21
22
  * and `TabContent` components directly.
22
23
  */
23
24
  function TabsWithContent(props) {
24
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Tabs, Object.assign({}, props), void 0), (0, jsx_runtime_1.jsx)(TabContent, Object.assign({}, props), void 0)] }, void 0));
25
+ // Do not apply default top padding styles if the tabs are being hidden. This avoids unnecessary white space being added
26
+ const styles = hideTabs(props) ? {} : Css_1.Css.pt3.$;
27
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Tabs, Object.assign({}, props), void 0), (0, jsx_runtime_1.jsx)(TabContent, Object.assign({}, props, { contentXss: { ...styles, ...props.contentXss } }), void 0)] }, void 0));
25
28
  }
26
29
  exports.TabsWithContent = TabsWithContent;
27
30
  function TabContent(props) {
@@ -35,9 +38,9 @@ function TabContent(props) {
35
38
  }) || tabs[0]
36
39
  : props.tabs.find((tab) => tab.value === props.selected) || tabs[0];
37
40
  const uniqueValue = uniqueTabValue(selectedTab);
38
- // Do not apply default top margin styles if the tabs are being hidden. This avoids unnecessary white space being added
39
- const styles = hideTabs(props) ? {} : Css_1.Css.mt3.$;
40
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0 }, tid.panel, { css: { ...styles, ...contentXss } }, { children: isRouteTab(selectedTab) ? (0, jsx_runtime_1.jsx)(react_router_1.Route, { path: selectedTab.path, render: selectedTab.render }, void 0) : selectedTab.render() }), void 0));
41
+ return (
42
+ // Using FullBleed to allow the tab's bgColor to extend to the edges of the <ScrollableContent /> element.
43
+ (0, jsx_runtime_1.jsx)(components_1.FullBleed, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0 }, tid.panel, { css: contentXss }, { children: isRouteTab(selectedTab) ? (0, jsx_runtime_1.jsx)(react_router_1.Route, { path: selectedTab.path, render: selectedTab.render }, void 0) : selectedTab.render() }), void 0) }, void 0));
41
44
  }
42
45
  exports.TabContent = TabContent;
43
46
  /** The top list of tabs. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.183.3",
3
+ "version": "2.184.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",