@homebound/beam 2.183.2 → 2.184.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/Layout/ScrollableContent.d.ts +2 -0
- package/dist/components/Layout/ScrollableContent.js +7 -6
- package/dist/components/Layout/ScrollableParent.d.ts +2 -2
- package/dist/components/Layout/ScrollableParent.js +3 -3
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +7 -4
- package/dist/inputs/DateFields/DateFieldBase.js +1 -1
- package/dist/inputs/TextFieldBase.js +10 -5
- package/package.json +1 -1
|
@@ -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)(
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
|
|
25
|
+
...Css_1.Css.pr(pr).pl(pl).if(virtualized).pr0.h100.$,
|
|
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
|
|
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.
|
|
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;
|
package/dist/components/Tabs.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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. */
|
|
@@ -158,7 +158,7 @@ function DateFieldBase(props) {
|
|
|
158
158
|
setInputValue("");
|
|
159
159
|
onChange(undefined);
|
|
160
160
|
} }, void 0)) }, void 0));
|
|
161
|
-
const calendarButton = ((0, jsx_runtime_1.jsx)("button", Object.assign({ ref: buttonRef }, buttonProps, { disabled: isDisabled, css: Css_1.Css.if(isDisabled).cursorNotAllowed.$, tabIndex: -1 }, tid.calendarButton, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "calendar", color: Css_1.Palette.Gray700 }, void 0) }), void 0));
|
|
161
|
+
const calendarButton = ((0, jsx_runtime_1.jsx)("button", Object.assign({ ref: buttonRef }, buttonProps, { disabled: isDisabled, css: Css_1.Css.if(isDisabled).cursorNotAllowed.$, tabIndex: -1 }, tid.calendarButton, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "calendar", color: isDisabled ? Css_1.Palette.Gray400 : Css_1.Palette.Gray700 }, void 0) }), void 0));
|
|
162
162
|
const EndFieldButtons = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isRangeFilterField && clearButton, !hideCalendarIcon && calendarButton] }, void 0));
|
|
163
163
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextFieldBase_1.TextFieldBase, Object.assign({}, textFieldProps, { errorMsg: errorMsg, helperText: helperText, required: required, labelProps: labelProps, inputProps: { ...triggerProps, ...inputProps, size: inputSize }, inputRef: inputRef, inputWrapRef: inputWrapRef, inlineLabel: inlineLabel, onChange: (v) => {
|
|
164
164
|
// hide the calendar if the user is manually entering the date
|
|
@@ -33,6 +33,11 @@ function TextFieldBase(props) {
|
|
|
33
33
|
const maybeSmaller = compound ? 2 : 0;
|
|
34
34
|
const fieldHeight = 40;
|
|
35
35
|
const compactFieldHeight = 32;
|
|
36
|
+
const [bgColor, hoverBgColor, disabledBgColor] = contrast
|
|
37
|
+
? [Css_1.Palette.Gray700, Css_1.Palette.Gray600, Css_1.Palette.Gray700]
|
|
38
|
+
: borderless && !compound
|
|
39
|
+
? [Css_1.Palette.Gray100, Css_1.Palette.Gray200, Css_1.Palette.Gray200]
|
|
40
|
+
: [Css_1.Palette.White, Css_1.Palette.Gray100, Css_1.Palette.Gray100];
|
|
36
41
|
const fieldStyles = {
|
|
37
42
|
container: Css_1.Css.df.fdc.w100.maxw((0, Css_1.px)(550)).relative.$,
|
|
38
43
|
inputWrapper: {
|
|
@@ -40,7 +45,7 @@ function TextFieldBase(props) {
|
|
|
40
45
|
.hPx(fieldHeight - maybeSmaller)
|
|
41
46
|
.if(compact)
|
|
42
47
|
.hPx(compactFieldHeight - maybeSmaller).$,
|
|
43
|
-
...Css_1.Css.
|
|
48
|
+
...Css_1.Css.bgColor(bgColor).gray900.if(contrast).white.$,
|
|
44
49
|
// When borderless then perceived vertical alignments are misaligned. As there is no longer a border, then the field looks oddly indented.
|
|
45
50
|
// This typically happens in tables when a column has a mix of static text (i.e. "roll up" rows and table headers) and input fields.
|
|
46
51
|
// To remedy this perceived misalignment then we increase the width by the horizontal padding applied (16px), and set a negative margin left margin to re-center the field.
|
|
@@ -60,14 +65,14 @@ function TextFieldBase(props) {
|
|
|
60
65
|
.mhPx(compactFieldHeight - maybeSmaller).$),
|
|
61
66
|
},
|
|
62
67
|
input: {
|
|
63
|
-
...Css_1.Css.w100.mw0.outline0.fg1.if(multiline).br4.$,
|
|
68
|
+
...Css_1.Css.w100.mw0.outline0.fg1.bgColor(bgColor).if(multiline).br4.$,
|
|
64
69
|
// Not using Truss's inline `if` statement here because `addIn` properties do not respect the if statement.
|
|
65
|
-
...(
|
|
70
|
+
...(contrast && Css_1.Css.addIn("&::selection", Css_1.Css.bgGray800.$).$),
|
|
66
71
|
},
|
|
67
|
-
hover: Css_1.Css.
|
|
72
|
+
hover: Css_1.Css.bgColor(hoverBgColor).if(contrast).bGray600.$,
|
|
68
73
|
focus: Css_1.Css.bLightBlue700.if(contrast).bLightBlue500.$,
|
|
69
74
|
disabled: visuallyDisabled
|
|
70
|
-
? Css_1.Css.cursorNotAllowed.
|
|
75
|
+
? Css_1.Css.cursorNotAllowed.gray600.bgColor(disabledBgColor).if(contrast).gray500.$
|
|
71
76
|
: Css_1.Css.cursorNotAllowed.$,
|
|
72
77
|
error: Css_1.Css.bRed600.if(contrast).bRed400.$,
|
|
73
78
|
};
|