@homebound/beam 2.105.1 → 2.105.5
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/Layout/ScrollableParent.js +1 -4
- package/dist/components/Table/GridTable.d.ts +4 -1
- package/dist/components/Table/GridTable.js +10 -1
- package/dist/components/Table/styles.js +1 -1
- package/dist/components/Tooltip.d.ts +4 -2
- package/dist/components/Tooltip.js +4 -1
- package/dist/inputs/TextField.d.ts +3 -1
- package/package.json +1 -1
|
@@ -31,10 +31,7 @@ function ScrollableParent(props) {
|
|
|
31
31
|
(0, react_1.useEffect)(() => {
|
|
32
32
|
scrollableRef.current.appendChild(scrollableEl);
|
|
33
33
|
}, [scrollableEl]);
|
|
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: Css_1.Css.pl(context.pl)
|
|
35
|
-
.pr(context.pr)
|
|
36
|
-
.if(!hasScrollableContent)
|
|
37
|
-
.h100.overflowAuto.addIn("&", Css_1.Css.if(!hasScrollableContent).add("overflow", "overlay").$).$ }, { children: children }), void 0), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.pl(context.pl).pr(context.pr).addIn("&", Css_1.Css.add("overflow", "overlay").$).$, ref: scrollableRef }, void 0)] }), void 0) }), void 0));
|
|
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: Css_1.Css.pl(context.pl).pr(context.pr).if(!hasScrollableContent).h100.overflowAuto.$ }, { 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
35
|
}
|
|
39
36
|
exports.ScrollableParent = ScrollableParent;
|
|
40
37
|
function useScrollableParent() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { MutableRefObject, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { PresentationContextProps, PresentationFieldProps } from "../PresentationContext";
|
|
3
3
|
import { GridRowLookup } from "./GridRowLookup";
|
|
4
|
-
import { Margin, Only, Properties, Xss } from "../../Css";
|
|
4
|
+
import { Margin, Only, Properties, Typography, Xss } from "../../Css";
|
|
5
5
|
export declare type Kinded = {
|
|
6
6
|
kind: string;
|
|
7
7
|
};
|
|
@@ -225,6 +225,8 @@ export declare type GridColumn<R extends Kinded, S = {}> = {
|
|
|
225
225
|
* - The default value is `1fr`
|
|
226
226
|
*/
|
|
227
227
|
w?: number | string;
|
|
228
|
+
/** The minimum width the column can shrink to */
|
|
229
|
+
mw?: string;
|
|
228
230
|
/** The column's default alignment for each cell. */
|
|
229
231
|
align?: GridCellAlignment;
|
|
230
232
|
/** Whether the column can be sorted (if client-side sorting). Defaults to true if sorting client-side. */
|
|
@@ -268,6 +270,7 @@ export declare type GridCellContent = {
|
|
|
268
270
|
/** Whether to indent the cell. */
|
|
269
271
|
indent?: 1 | 2;
|
|
270
272
|
colspan?: number;
|
|
273
|
+
typeScale?: Typography;
|
|
271
274
|
};
|
|
272
275
|
declare type MaybeFn<T> = T | (() => T);
|
|
273
276
|
/**
|
|
@@ -438,6 +438,12 @@ function GridRow(props) {
|
|
|
438
438
|
let currentColspan = 1;
|
|
439
439
|
const rowNode = ((0, jsx_runtime_1.jsx)(Row, Object.assign({ css: rowCss }, others, { "data-gridrow": true }, { children: columns.map((column, columnIndex) => {
|
|
440
440
|
var _a;
|
|
441
|
+
if (column.mw) {
|
|
442
|
+
// Validate the column's minWidth definition if set.
|
|
443
|
+
if (!column.mw.endsWith("px") && !column.mw.endsWith("%")) {
|
|
444
|
+
throw new Error("Beam Table column min-width definition only supports px or percentage values");
|
|
445
|
+
}
|
|
446
|
+
}
|
|
441
447
|
// Decrement colspan count and skip if greater than 1.
|
|
442
448
|
if (currentColspan > 1) {
|
|
443
449
|
currentColspan -= 1;
|
|
@@ -473,13 +479,16 @@ function GridRow(props) {
|
|
|
473
479
|
...getIndentationCss(style, rowStyle, columnIndex, maybeContent),
|
|
474
480
|
// Then apply any header-specific override
|
|
475
481
|
...(isHeader && style.headerCellCss),
|
|
476
|
-
//
|
|
482
|
+
// The specific cell's css (if any from GridCellContent)
|
|
477
483
|
...rowStyleCellCss,
|
|
484
|
+
// Add any cell specific style overrides
|
|
485
|
+
...(isGridCellContent(maybeContent) && maybeContent.typeScale ? Css_1.Css[maybeContent.typeScale].$ : {}),
|
|
478
486
|
// Define the width of the column on each cell. Supports col spans.
|
|
479
487
|
...(columnSizes && {
|
|
480
488
|
width: `calc(${columnSizes
|
|
481
489
|
.slice(maybeNestedCardColumnIndex, maybeNestedCardColumnIndex + currentColspan)
|
|
482
490
|
.join(" + ")})`,
|
|
491
|
+
...(column.mw ? Css_1.Css.mw(column.mw).$ : {}),
|
|
483
492
|
}),
|
|
484
493
|
};
|
|
485
494
|
const renderFn = (rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.renderCell) || (rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.rowLink)
|
|
@@ -52,7 +52,7 @@ exports.beamFlexibleStyle = {
|
|
|
52
52
|
cellCss: Css_1.Css.xs.bgWhite.aic.p2.boxShadow(`inset 0 -1px 0 ${Css_1.Palette.Gray100}`).$,
|
|
53
53
|
presentationSettings: { borderless: false, typeScale: "xs", wrap: true },
|
|
54
54
|
};
|
|
55
|
-
exports.beamGroupRowStyle = Css_1.Css.
|
|
55
|
+
exports.beamGroupRowStyle = Css_1.Css.xsEm
|
|
56
56
|
.mhPx(56)
|
|
57
57
|
.gray700.bgGray100.boxShadow(`inset 0 -1px 0 ${Css_1.Palette.Gray200}`).$;
|
|
58
58
|
exports.beamTotalsRowStyle = Css_1.Css.gray700.smEm.hPx(40).mb1.bgWhite.boxShadow("none").$;
|
|
@@ -2,13 +2,15 @@ import { ReactElement, ReactNode } from "react";
|
|
|
2
2
|
interface TooltipProps {
|
|
3
3
|
/** The content that shows up when hovered */
|
|
4
4
|
title: ReactNode;
|
|
5
|
-
children:
|
|
5
|
+
children: ReactNode;
|
|
6
6
|
placement?: Placement;
|
|
7
7
|
delay?: number;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare function Tooltip(props: TooltipProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
11
|
export declare type Placement = "top" | "bottom" | "left" | "right" | "auto";
|
|
12
|
-
export declare function maybeTooltip(props: TooltipProps
|
|
12
|
+
export declare function maybeTooltip(props: Omit<TooltipProps, "children"> & {
|
|
13
|
+
children: ReactElement;
|
|
14
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
15
|
export declare function resolveTooltip(disabled?: boolean | ReactNode, tooltip?: ReactNode, readOnly?: boolean | ReactNode): ReactNode | undefined;
|
|
14
16
|
export {};
|
|
@@ -27,13 +27,15 @@ const react_dom_1 = require("react-dom");
|
|
|
27
27
|
const react_popper_1 = require("react-popper");
|
|
28
28
|
const react_stately_1 = require("react-stately");
|
|
29
29
|
const Css_1 = require("../Css");
|
|
30
|
+
const utils_1 = require("../utils");
|
|
30
31
|
function Tooltip(props) {
|
|
31
32
|
const { placement, children, title, disabled, delay = 0 } = props;
|
|
32
33
|
const state = (0, react_stately_1.useTooltipTriggerState)({ delay, isDisabled: disabled });
|
|
33
34
|
const triggerRef = react_1.default.useRef(null);
|
|
34
35
|
const { triggerProps, tooltipProps: _tooltipProps } = (0, react_aria_1.useTooltipTrigger)({ isDisabled: disabled }, state, triggerRef);
|
|
35
36
|
const { tooltipProps } = (0, react_aria_1.useTooltip)(_tooltipProps, state);
|
|
36
|
-
|
|
37
|
+
const tid = (0, utils_1.useTestIds)(props, "tooltip");
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ ref: triggerRef }, triggerProps, (!state.isOpen && typeof title === "string" ? { title } : {}), tid, { children: children }), void 0), state.isOpen && ((0, jsx_runtime_1.jsx)(Popper, Object.assign({}, (0, react_aria_1.mergeProps)(_tooltipProps, tooltipProps), { triggerRef: triggerRef, content: title, placement: placement }), void 0))] }, void 0));
|
|
37
39
|
}
|
|
38
40
|
exports.Tooltip = Tooltip;
|
|
39
41
|
function Popper({ triggerRef, content, placement = "auto" }) {
|
|
@@ -49,6 +51,7 @@ function Popper({ triggerRef, content, placement = "auto" }) {
|
|
|
49
51
|
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: popperRef, style: styles.popper }, attributes.popper, { css: Css_1.Css.maxw("320px").bgGray900.white.px1.py("4px").br4.xs.z999.$ }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: setArrowRef, style: { ...styles.arrow }, id: "arrow" }, void 0), content] }), void 0), document.body);
|
|
50
52
|
}
|
|
51
53
|
// Helper function to conditionally wrap component with Tooltip if necessary.
|
|
54
|
+
// `maybeTooltip` requires that the `children` prop be a ReactElement, even though <Tooltip /> allows for ReactNode.
|
|
52
55
|
function maybeTooltip(props) {
|
|
53
56
|
return props.title ? (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({}, props), void 0) : props.children;
|
|
54
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutableRefObject } from "react";
|
|
1
|
+
import { MutableRefObject, ReactNode } from "react";
|
|
2
2
|
import { Only } from "../Css";
|
|
3
3
|
import { BeamTextFieldProps, TextFieldXss } from "../interfaces";
|
|
4
4
|
import { Callback } from "../types";
|
|
@@ -8,6 +8,8 @@ export interface TextFieldProps<X> extends BeamTextFieldProps<X> {
|
|
|
8
8
|
clearable?: boolean;
|
|
9
9
|
api?: MutableRefObject<TextFieldApi | undefined>;
|
|
10
10
|
onEnter?: Callback;
|
|
11
|
+
endAdornment?: ReactNode;
|
|
12
|
+
startAdornment?: ReactNode;
|
|
11
13
|
}
|
|
12
14
|
export declare function TextField<X extends Only<TextFieldXss, X>>(props: TextFieldProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
15
|
export declare type TextFieldApi = {
|