@homebound/beam 2.175.0 → 2.176.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.
- package/dist/components/CssReset.js +6 -0
- package/dist/components/Layout/ScrollableContent.d.ts +6 -3
- package/dist/components/Layout/ScrollableContent.js +2 -2
- package/dist/components/Layout/ScrollableParent.js +1 -1
- package/dist/components/LoadingSkeleton.d.ts +10 -0
- package/dist/components/LoadingSkeleton.js +30 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -54,6 +54,12 @@ const ourReset = (0, react_1.css) `
|
|
|
54
54
|
transform: rotate(360deg);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
@keyframes pulse {
|
|
59
|
+
50% {
|
|
60
|
+
opacity: 0.6;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
57
63
|
`;
|
|
58
64
|
// Copy/pasted from TW which uses this as their base reset.
|
|
59
65
|
const modernNormalizeReset = (0, react_1.css) `
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ReactNode, ReactPortal } from "react";
|
|
2
|
-
|
|
3
|
-
export declare function ScrollableContent(props: {
|
|
2
|
+
interface ScrollableContentProps {
|
|
4
3
|
children: ReactNode;
|
|
5
4
|
virtualized?: boolean;
|
|
6
|
-
|
|
5
|
+
omitBottomPadding?: true;
|
|
6
|
+
}
|
|
7
|
+
/** Helper component for placing scrollable content within a `ScrollableParent`. */
|
|
8
|
+
export declare function ScrollableContent(props: ScrollableContentProps): ReactPortal | JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -9,7 +9,7 @@ const ScrollableParent_1 = require("./ScrollableParent");
|
|
|
9
9
|
const Css_1 = require("../../Css");
|
|
10
10
|
/** Helper component for placing scrollable content within a `ScrollableParent`. */
|
|
11
11
|
function ScrollableContent(props) {
|
|
12
|
-
const { children, virtualized = false } = props;
|
|
12
|
+
const { children, virtualized = false, omitBottomPadding } = props;
|
|
13
13
|
const { scrollableEl, setPortalTick, pl } = (0, ScrollableParent_1.useScrollableParent)();
|
|
14
14
|
(0, react_1.useEffect)(() => {
|
|
15
15
|
// The below `tick` logic is a way to detect whether the ScrollableContent is being used.
|
|
@@ -22,7 +22,7 @@ function ScrollableContent(props) {
|
|
|
22
22
|
if (!scrollableEl) {
|
|
23
23
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }, void 0);
|
|
24
24
|
}
|
|
25
|
-
return (0, react_dom_1.createPortal)(!virtualized ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: ScrollableParent_1.scrollContainerBottomPadding }, { children: children }), void 0)) : (
|
|
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
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
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);
|
|
28
28
|
}
|
|
@@ -32,7 +32,7 @@ function ScrollableParent(props) {
|
|
|
32
32
|
scrollableRef.current.appendChild(scrollableEl);
|
|
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
|
-
...Css_1.Css.pl(context.pl).pr(context.pr)
|
|
35
|
+
...Css_1.Css.pl(context.pl).pr(context.pr).$,
|
|
36
36
|
...(!hasScrollableContent ? { ...Css_1.Css.overflowAuto.$, ...exports.scrollContainerBottomPadding } : undefined),
|
|
37
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));
|
|
38
38
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type Sizes = "sm" | "md" | "lg";
|
|
2
|
+
export declare type LoadingSkeletonProps = {
|
|
3
|
+
rows?: number;
|
|
4
|
+
columns?: number;
|
|
5
|
+
size?: Sizes;
|
|
6
|
+
randomizeWidths?: boolean;
|
|
7
|
+
contrast?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function LoadingSkeleton({ rows, columns, size, randomizeWidths, contrast, }: LoadingSkeletonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoadingSkeleton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const Css_1 = require("../Css");
|
|
6
|
+
function LoadingSkeleton({ rows = 1, columns = 1, size = "md", randomizeWidths = false, contrast = false, }) {
|
|
7
|
+
const cellArray = [...Array(columns)];
|
|
8
|
+
const rowArray = [...Array(rows)];
|
|
9
|
+
const rowHeight = sizeToPixels[size];
|
|
10
|
+
const rowCells = (rowNumber) => {
|
|
11
|
+
const flexGrowForCell = randomizeWidths ? getRandomizedFlexBasisByRowIndex(rowNumber) : 1;
|
|
12
|
+
return cellArray.map((_, i) => ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.br4
|
|
13
|
+
.add("animation", "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite")
|
|
14
|
+
.add("flexGrow", flexGrowForCell)
|
|
15
|
+
.bgGray300.if(contrast).bgGray700.$ }, `row-${rowNumber}-cell-${i}`)));
|
|
16
|
+
};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ "aria-label": "Loading" }, { children: rowArray.map((_, i) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.df.childGap1.mb1.hPx(rowHeight).$ }, { children: rowCells(i) }), `row-${i}`))) }), void 0));
|
|
18
|
+
}
|
|
19
|
+
exports.LoadingSkeleton = LoadingSkeleton;
|
|
20
|
+
/** Create the illusion of random widths by cycling through a list of widths that look nice in order */
|
|
21
|
+
function getRandomizedFlexBasisByRowIndex(rowIndex) {
|
|
22
|
+
const randomizedFlexBasisValues = [0.65, 0.8, 0.75, 0.9, 0.8, 0.85, 0.8, 0.95];
|
|
23
|
+
const valueIndex = rowIndex % randomizedFlexBasisValues.length;
|
|
24
|
+
return randomizedFlexBasisValues[valueIndex];
|
|
25
|
+
}
|
|
26
|
+
const sizeToPixels = {
|
|
27
|
+
sm: 16,
|
|
28
|
+
md: 24,
|
|
29
|
+
lg: 32,
|
|
30
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __exportStar(require("./Icon"), exports);
|
|
|
31
31
|
__exportStar(require("./IconButton"), exports);
|
|
32
32
|
__exportStar(require("./Layout"), exports);
|
|
33
33
|
__exportStar(require("./Loader"), exports);
|
|
34
|
+
__exportStar(require("./LoadingSkeleton"), exports);
|
|
34
35
|
__exportStar(require("./Modal"), exports);
|
|
35
36
|
__exportStar(require("./Modal/useModal"), exports);
|
|
36
37
|
var NavLink_1 = require("./NavLink");
|