@homebound/beam 2.239.0 → 2.240.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.
- package/dist/components/Layout/ScrollableContent.js +3 -1
- package/dist/components/Layout/ScrollableParent.d.ts +0 -7
- package/dist/components/Layout/ScrollableParent.js +3 -8
- package/dist/inputs/NumberField.d.ts +1 -0
- package/dist/inputs/TextFieldBase.d.ts +1 -0
- package/dist/inputs/TextFieldBase.js +8 -6
- package/dist/inputs/Value.js +2 -3
- package/package.json +1 -1
|
@@ -32,7 +32,9 @@ function ScrollableContent(props) {
|
|
|
32
32
|
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { css: {
|
|
33
33
|
...Css_1.Css.h100.pr(pr).pl(pl).if(virtualized).pr0.$,
|
|
34
34
|
...(bgColor && Css_1.Css.bgColor(bgColor).$),
|
|
35
|
-
...(!omitBottomPadding && !virtualized &&
|
|
35
|
+
...(!omitBottomPadding && !virtualized && scrollContainerBottomPadding),
|
|
36
36
|
}, children: children }), scrollableEl);
|
|
37
37
|
}
|
|
38
38
|
exports.ScrollableContent = ScrollableContent;
|
|
39
|
+
// Styles to wrap around the scrollable content in order to give padding beneath the content within the scrollable container.
|
|
40
|
+
const scrollContainerBottomPadding = Css_1.Css.addIn("&:after", Css_1.Css.contentEmpty.db.h2.$).$;
|
|
@@ -36,11 +36,4 @@ interface ScrollableParentContextProviderProps {
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function ScrollableParent(props: PropsWithChildren<ScrollableParentContextProviderProps>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare function useScrollableParent(): ScrollableParentContextProps;
|
|
39
|
-
export declare const scrollContainerBottomPadding: {
|
|
40
|
-
content: import("csstype").Property.Content | undefined;
|
|
41
|
-
} & {
|
|
42
|
-
display: import("csstype").Property.Display | undefined;
|
|
43
|
-
} & {
|
|
44
|
-
height: import("csstype").Property.Height<string | 0> | undefined;
|
|
45
|
-
};
|
|
46
39
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useScrollableParent = exports.ScrollableParent = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Css_1 = require("../../Css");
|
|
@@ -39,7 +39,7 @@ function ScrollableParent(props) {
|
|
|
39
39
|
const scrollableEl = (0, react_1.useMemo)(() => {
|
|
40
40
|
const el = document.createElement("div");
|
|
41
41
|
// Ensure this wrapping div takes up the full height of its container
|
|
42
|
-
el.style.
|
|
42
|
+
el.style.flexGrow = "1";
|
|
43
43
|
return el;
|
|
44
44
|
}, []);
|
|
45
45
|
const [, setTick] = (0, react_1.useState)(0);
|
|
@@ -55,15 +55,10 @@ function ScrollableParent(props) {
|
|
|
55
55
|
(0, react_1.useEffect)(() => {
|
|
56
56
|
scrollableRef.current.appendChild(scrollableEl);
|
|
57
57
|
}, [scrollableEl]);
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, { value: context, children: (0, jsx_runtime_1.jsxs)(Tag, { css: { ...Css_1.Css.mh0.mw0.fg1.df.fdc.$, ...otherXss }, children: [(0, jsx_runtime_1.jsx)("div", { css: {
|
|
59
|
-
...Css_1.Css.pl(context.pl).pr(context.pr).$,
|
|
60
|
-
...(!hasScrollableContent ? { ...Css_1.Css.overflowAuto.h100.$, ...exports.scrollContainerBottomPadding } : undefined),
|
|
61
|
-
}, children: children }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.$, ref: scrollableRef })] }) }));
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, { value: context, children: (0, jsx_runtime_1.jsxs)(Tag, { css: { ...Css_1.Css.mh0.mw0.fg1.df.fdc.$, ...otherXss }, children: [(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.pl(context.pl).pr(context.pr).if(!hasScrollableContent).overflowAuto.h100.$, children: children }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.df.fdc.$, ref: scrollableRef })] }) }));
|
|
62
59
|
}
|
|
63
60
|
exports.ScrollableParent = ScrollableParent;
|
|
64
61
|
function useScrollableParent() {
|
|
65
62
|
return (0, react_1.useContext)(ScrollableParentContext);
|
|
66
63
|
}
|
|
67
64
|
exports.useScrollableParent = useScrollableParent;
|
|
68
|
-
// Styles to wrap around the scrollable content in order to give padding beneath the content within the scrollable container.
|
|
69
|
-
exports.scrollContainerBottomPadding = Css_1.Css.addIn("&:after", Css_1.Css.contentEmpty.db.h2.$).$;
|
|
@@ -34,6 +34,7 @@ export interface NumberFieldProps extends Pick<PresentationFieldProps, "labelSty
|
|
|
34
34
|
hideErrorMessage?: boolean;
|
|
35
35
|
borderless?: boolean;
|
|
36
36
|
sizeToContent?: boolean;
|
|
37
|
+
alwaysShowHelperText?: boolean;
|
|
37
38
|
}
|
|
38
39
|
export declare function NumberField(props: NumberFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
39
40
|
export declare function formatValue(value: number, factor: number, numFractionDigits: number | undefined, numIntegerDigits: number | undefined): number | undefined;
|
|
@@ -16,5 +16,6 @@ export interface TextFieldBaseProps<X> extends Pick<BeamTextFieldProps<X>, "labe
|
|
|
16
16
|
textAreaMinHeight?: number;
|
|
17
17
|
tooltip?: ReactNode;
|
|
18
18
|
hideErrorMessage?: boolean;
|
|
19
|
+
alwaysShowHelperText?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare function TextFieldBase<X extends Only<TextFieldXss, X>>(props: TextFieldBaseProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -18,7 +18,7 @@ const useTestIds_1 = require("../utils/useTestIds");
|
|
|
18
18
|
function TextFieldBase(props) {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
20
20
|
const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
|
|
21
|
-
const { label, required, labelProps, inputProps, inputRef, inputWrapRef, groupProps, compact = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact) !== null && _a !== void 0 ? _a : false, errorMsg, helperText, multiline = false, onChange, onBlur, onFocus, xss, endAdornment, startAdornment, labelStyle = (_b = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.labelStyle) !== null && _b !== void 0 ? _b : "above", contrast = false, borderless = (_c = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.borderless) !== null && _c !== void 0 ? _c : false, textAreaMinHeight = 96, clearable = false, tooltip, visuallyDisabled = (_d = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.visuallyDisabled) !== null && _d !== void 0 ? _d : true, errorInTooltip = (_e = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.errorInTooltip) !== null && _e !== void 0 ? _e : false, hideErrorMessage = false, } = props;
|
|
21
|
+
const { label, required, labelProps, inputProps, inputRef, inputWrapRef, groupProps, compact = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact) !== null && _a !== void 0 ? _a : false, errorMsg, helperText, multiline = false, onChange, onBlur, onFocus, xss, endAdornment, startAdornment, labelStyle = (_b = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.labelStyle) !== null && _b !== void 0 ? _b : "above", contrast = false, borderless = (_c = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.borderless) !== null && _c !== void 0 ? _c : false, textAreaMinHeight = 96, clearable = false, tooltip, visuallyDisabled = (_d = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.visuallyDisabled) !== null && _d !== void 0 ? _d : true, errorInTooltip = (_e = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.errorInTooltip) !== null && _e !== void 0 ? _e : false, hideErrorMessage = false, alwaysShowHelperText = false, } = props;
|
|
22
22
|
const typeScale = (_f = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.typeScale) !== null && _f !== void 0 ? _f : (inputProps.readOnly && labelStyle !== "hidden" ? "smMd" : "sm");
|
|
23
23
|
const internalProps = props.internalProps || {};
|
|
24
24
|
const { compound = false, forceFocus = false, forceHover = false } = internalProps;
|
|
@@ -123,11 +123,13 @@ function TextFieldBase(props) {
|
|
|
123
123
|
// Reset focus to input element
|
|
124
124
|
(_a = fieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
125
125
|
} })), errorInTooltip && errorMsg && !hideErrorMessage && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.df.aic.pl1.fs0.$, children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "error", color: Css_1.Palette.Red600, tooltip: errorMsg }) })), !multiline && endAdornment && (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.df.aic.pl1.fs0.$, children: endAdornment })] })),
|
|
126
|
-
}), labelStyle !== "left" &&
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
}), labelStyle !== "left" &&
|
|
127
|
+
(alwaysShowHelperText || (!compound && !inputProps.disabled && !inputProps.readOnly)) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [errorMsg && !errorInTooltip && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, { id: errorMessageId, errorMsg: errorMsg, hidden: hideErrorMessage, ...tid.errorMsg })), helperText && (0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { helperText: helperText, ...tid.helperText })] }))] }), labelStyle === "left" &&
|
|
128
|
+
(alwaysShowHelperText ||
|
|
129
|
+
(!compound &&
|
|
130
|
+
!inputProps.disabled &&
|
|
131
|
+
!inputProps.readOnly &&
|
|
132
|
+
((errorMsg && !errorInTooltip) || helperText))) && (
|
|
131
133
|
// Reduces the margin between the error/helper text and input field
|
|
132
134
|
(0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.mtPx(-8).$, children: [errorMsg && !errorInTooltip && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, { id: errorMessageId, errorMsg: errorMsg, hidden: hideErrorMessage, ...tid.errorMsg })), helperText && (0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { helperText: helperText, ...tid.helperText })] }))] }));
|
|
133
135
|
}
|
package/dist/inputs/Value.js
CHANGED
|
@@ -15,8 +15,7 @@ function keyToValue(key) {
|
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
17
|
else if (key.startsWith("__VALUE:boolean:")) {
|
|
18
|
-
|
|
19
|
-
return key.split(":")[2].startsWith("true");
|
|
18
|
+
return (key.split(":")[2] === "true");
|
|
20
19
|
}
|
|
21
20
|
else if (key.startsWith("__VALUE:number")) {
|
|
22
21
|
return Number(key.split(":")[2]);
|
|
@@ -40,7 +39,7 @@ function valueToKey(value) {
|
|
|
40
39
|
return `__VALUE:number:${value}`;
|
|
41
40
|
}
|
|
42
41
|
else if (typeof value === "boolean") {
|
|
43
|
-
return `__VALUE:boolean:${value}
|
|
42
|
+
return `__VALUE:boolean:${value}`;
|
|
44
43
|
}
|
|
45
44
|
else if (value === null) {
|
|
46
45
|
return "__VALUE:null";
|