@homebound/beam 2.347.0 → 2.347.2
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/Css.d.ts +3 -1
- package/dist/Css.js +2 -2
- package/dist/components/Chips.d.ts +1 -0
- package/dist/components/Chips.js +2 -2
- package/dist/components/Pagination.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/inputs/TextFieldBase.js +18 -6
- package/dist/inputs/hooks/useGrowingTextField.js +7 -2
- package/dist/inputs/internal/ComboBoxInput.js +12 -3
- package/package.json +1 -1
package/dist/Css.d.ts
CHANGED
|
@@ -4244,7 +4244,7 @@ declare class CssBuilder<T extends Properties> {
|
|
|
4244
4244
|
} & {
|
|
4245
4245
|
backgroundColor: import("csstype").Property.BackgroundColor | undefined;
|
|
4246
4246
|
}>;
|
|
4247
|
-
/** Sets `position: "absolute"; overflow: "hidden"; clip: "inset(50%)"; clipPath: ""; border: 0; height: "1px"; margin: "-1px"; width: "1px"; padding: 0; whiteSpace: "nowrap"`. */
|
|
4247
|
+
/** Sets `position: "absolute"; overflow: "hidden"; clip: "inset(50%)"; clipPath: ""; border: 0; height: "1px"; margin: "-1px"; width: "1px"; padding: 0; whiteSpace: "nowrap"; opacity: 0`. */
|
|
4248
4248
|
get visuallyHidden(): CssBuilder<T & {
|
|
4249
4249
|
position: import("csstype").Property.Position | undefined;
|
|
4250
4250
|
} & {
|
|
@@ -4265,6 +4265,8 @@ declare class CssBuilder<T extends Properties> {
|
|
|
4265
4265
|
padding: import("csstype").Property.Padding<string | 0> | undefined;
|
|
4266
4266
|
} & {
|
|
4267
4267
|
whiteSpace: import("csstype").Property.WhiteSpace | undefined;
|
|
4268
|
+
} & {
|
|
4269
|
+
opacity: import("csstype").Property.Opacity | undefined;
|
|
4268
4270
|
}>;
|
|
4269
4271
|
/** Sets `content: "''"`. */
|
|
4270
4272
|
get contentEmpty(): CssBuilder<T & {
|
package/dist/Css.js
CHANGED
|
@@ -3778,9 +3778,9 @@ class CssBuilder {
|
|
|
3778
3778
|
return this.add("position", "fixed").add("top", 0).add("bottom", 0).add("left", 0).add("right", 0).add("display", "flex").add("alignItems", "center").add("justifyContent", "center").add("backgroundColor", "rgba(36,36,36,0.2)");
|
|
3779
3779
|
}
|
|
3780
3780
|
// visuallyHidden
|
|
3781
|
-
/** Sets `position: "absolute"; overflow: "hidden"; clip: "inset(50%)"; clipPath: ""; border: 0; height: "1px"; margin: "-1px"; width: "1px"; padding: 0; whiteSpace: "nowrap"`. */
|
|
3781
|
+
/** Sets `position: "absolute"; overflow: "hidden"; clip: "inset(50%)"; clipPath: ""; border: 0; height: "1px"; margin: "-1px"; width: "1px"; padding: 0; whiteSpace: "nowrap"; opacity: 0`. */
|
|
3782
3782
|
get visuallyHidden() {
|
|
3783
|
-
return this.add("position", "absolute").add("overflow", "hidden").add("clip", "inset(50%)").add("clipPath", "").add("border", 0).add("height", "1px").add("margin", "-1px").add("width", "1px").add("padding", 0).add("whiteSpace", "nowrap");
|
|
3783
|
+
return this.add("position", "absolute").add("overflow", "hidden").add("clip", "inset(50%)").add("clipPath", "").add("border", 0).add("height", "1px").add("margin", "-1px").add("width", "1px").add("padding", 0).add("whiteSpace", "nowrap").add("opacity", 0);
|
|
3784
3784
|
}
|
|
3785
3785
|
// contentEmpty
|
|
3786
3786
|
/** Sets `content: "''"`. */
|
|
@@ -8,6 +8,7 @@ export interface ChipsProps<X> {
|
|
|
8
8
|
values: string[] | ChipValue[];
|
|
9
9
|
xss?: X;
|
|
10
10
|
compact?: boolean;
|
|
11
|
+
wrap?: boolean;
|
|
11
12
|
}
|
|
12
13
|
/** Renders a list of `Chip`s, with wrapping & appropriate margin between each `Chip`. */
|
|
13
14
|
export declare function Chips<X extends Only<ChipsXss, X>>(props: ChipsProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/dist/components/Chips.js
CHANGED
|
@@ -7,8 +7,8 @@ const PresentationContext_1 = require("./PresentationContext");
|
|
|
7
7
|
const Css_1 = require("../Css");
|
|
8
8
|
/** Renders a list of `Chip`s, with wrapping & appropriate margin between each `Chip`. */
|
|
9
9
|
function Chips(props) {
|
|
10
|
-
const { wrap } = (0, PresentationContext_1.usePresentationContext)();
|
|
11
|
-
const { values, compact, xss = {} } = props;
|
|
10
|
+
const { wrap: presentationWrap } = (0, PresentationContext_1.usePresentationContext)();
|
|
11
|
+
const { values, compact, xss = {}, wrap = presentationWrap } = props;
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)("div", { css: {
|
|
13
13
|
...Css_1.Css.df.aifs.gap1.whiteSpace("normal").$,
|
|
14
14
|
...(wrap !== false ? Css_1.Css.add({ flexWrap: "wrap" }).$ : {}),
|
|
@@ -29,7 +29,7 @@ function Pagination(props) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const tid = (0, utils_1.useTestIds)(props, "pagination");
|
|
32
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.bGray200.bt.xs.gray500.px2.pt2.$, ...tid, children: [(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.df.mya.mr2.$, ...tid.pageSizeLabel, children: "Page size:" }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.wPx(
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.bGray200.bt.xs.gray500.px2.pt2.$, ...tid, children: [(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.df.mya.mr2.$, ...tid.pageSizeLabel, children: "Page size:" }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.wPx(78).$, children: (0, jsx_runtime_1.jsx)(inputs_1.SelectField, { compact: true, label: "Page Size", labelStyle: "hidden", options: exports.pageOptions, value: pageSize, onSelect: (val) => set({ pageNumber: 1, pageSize: val }), ...tid.pageSize }) }), (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.mla.mya.df.$, children: [(0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.mya.mr2.$, ...tid.pageInfoLabel, children: [first, " ", showLast ? `- ${last}` : "", " of ", totalCount] }), (0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "chevronLeft", color: hasPrevPage ? Css_1.Palette.Blue700 : Css_1.Palette.Gray200, onClick: () => set({ pageNumber: pageNumber - 1, pageSize }), disabled: !hasPrevPage, ...tid.previousIcon }), (0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "chevronRight", color: hasNextPage ? Css_1.Palette.Blue700 : Css_1.Palette.Gray200, onClick: () => set({ pageNumber: pageNumber + 1, pageSize }), disabled: !hasNextPage, ...tid.nextIcon })] })] }));
|
|
33
33
|
}
|
|
34
34
|
exports.Pagination = Pagination;
|
|
35
35
|
function toLimitAndOffset(page) {
|
package/dist/components/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __exportStar(require("./IconButton"), exports);
|
|
|
48
48
|
__exportStar(require("./Layout"), exports);
|
|
49
49
|
__exportStar(require("./Loader"), exports);
|
|
50
50
|
__exportStar(require("./LoadingSkeleton"), exports);
|
|
51
|
+
__exportStar(require("./MaxLines"), exports);
|
|
51
52
|
__exportStar(require("./Modal"), exports);
|
|
52
53
|
__exportStar(require("./Modal/useModal"), exports);
|
|
53
54
|
var NavLink_1 = require("./NavLink");
|
|
@@ -44,10 +44,7 @@ function TextFieldBase(props) {
|
|
|
44
44
|
container: Css_1.Css.df.fdc.w100.maxw(fieldMaxWidth).relative.if(labelStyle === "left").maxw100.fdr.gap2.jcsb.aic.$,
|
|
45
45
|
inputWrapper: {
|
|
46
46
|
...Css_1.Css[typeScale].df.aic.br4.px1.w100
|
|
47
|
-
.
|
|
48
|
-
.if(compact)
|
|
49
|
-
.hPx(compactFieldHeight - maybeSmaller).$,
|
|
50
|
-
...Css_1.Css.bgColor(bgColor)
|
|
47
|
+
.bgColor(bgColor)
|
|
51
48
|
.gray900.if(contrast)
|
|
52
49
|
.white.if(labelStyle === "left").w50.$,
|
|
53
50
|
// When borderless then perceived vertical alignments are misaligned. As there is no longer a border, then the field looks oddly indented.
|
|
@@ -59,6 +56,15 @@ function TextFieldBase(props) {
|
|
|
59
56
|
: Css_1.Css.bGray300.if(contrast).bGray700.$),
|
|
60
57
|
// Do not add borders to compound fields. A compound field is responsible for drawing its own borders
|
|
61
58
|
...(!compound ? Css_1.Css.ba.$ : {}),
|
|
59
|
+
// When multiline is true, then we want to allow the field to grow to the height of the content, but not shrink below the minHeight
|
|
60
|
+
// Otherwise, set fixed heights values accordingly.
|
|
61
|
+
...(multiline
|
|
62
|
+
? Css_1.Css.mhPx(fieldHeight - maybeSmaller)
|
|
63
|
+
.if(compact)
|
|
64
|
+
.mhPx(compactFieldHeight - maybeSmaller).$
|
|
65
|
+
: Css_1.Css.hPx(fieldHeight - maybeSmaller)
|
|
66
|
+
.if(compact)
|
|
67
|
+
.hPx(compactFieldHeight - maybeSmaller).$),
|
|
62
68
|
},
|
|
63
69
|
inputWrapperReadOnly: {
|
|
64
70
|
...Css_1.Css[typeScale].df.aic.w100.gray900.if(contrast).white.if(labelStyle === "left").w50.$,
|
|
@@ -121,8 +127,14 @@ function TextFieldBase(props) {
|
|
|
121
127
|
// Only show error styles if the field is not disabled, following the pattern that the error message is also hidden
|
|
122
128
|
...(errorMsg && !inputProps.disabled ? fieldStyles.error : {}),
|
|
123
129
|
...Css_1.Css.if(multiline).aifs.overflowHidden.mhPx(textAreaMinHeight).$,
|
|
124
|
-
}, ...hoverProps, ref: inputWrapRef, onClick: unfocusedPlaceholder ? handleUnfocusedPlaceholderClick : undefined, children: [labelStyle === "inline" && label && ((0, jsx_runtime_1.jsx)(Label_1.InlineLabel, { multiline: multiline, labelProps: labelProps, label: label, ...tid.label })), startAdornment && (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.df.aic.asc.fs0.br4.pr1.$, children: startAdornment }), unfocusedPlaceholder && ((0, jsx_runtime_1.jsx)("div", {
|
|
125
|
-
|
|
130
|
+
}, ...hoverProps, ref: inputWrapRef, onClick: unfocusedPlaceholder ? handleUnfocusedPlaceholderClick : undefined, children: [labelStyle === "inline" && label && ((0, jsx_runtime_1.jsx)(Label_1.InlineLabel, { multiline: multiline, labelProps: labelProps, label: label, ...tid.label })), startAdornment && (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.df.aic.asc.fs0.br4.pr1.$, children: startAdornment }), unfocusedPlaceholder && ((0, jsx_runtime_1.jsx)("div", {
|
|
131
|
+
// Setting -1 tabIndex as this is a scrollable container, which is focusable by default.
|
|
132
|
+
// However, we want the user's focus to move to the field element, which will hide this container.
|
|
133
|
+
tabIndex: -1, ...tid.unfocusedPlaceholderContainer, css: {
|
|
134
|
+
...Css_1.Css.df.asc.w100.maxhPx(74).overflowAuto.$,
|
|
135
|
+
...fieldStyles.input,
|
|
136
|
+
...(showHover ? fieldStyles.hover : {}),
|
|
137
|
+
...(inputProps.disabled ? fieldStyles.disabled : {}),
|
|
126
138
|
...(isFocused && Css_1.Css.visuallyHidden.$),
|
|
127
139
|
}, children: unfocusedPlaceholder })), (0, jsx_runtime_1.jsx)(ElementType, { ...(0, react_aria_1.mergeProps)(inputProps, { onBlur, onFocus: onFocusChained, onChange: onDomChange }, { "aria-invalid": Boolean(errorMsg), ...(labelStyle === "hidden" ? { "aria-label": label } : {}) }), ...(errorMsg ? { "aria-errormessage": errorMessageId } : {}), ref: fieldRef, rows: multiline ? 1 : undefined, css: {
|
|
128
140
|
...fieldStyles.input,
|
|
@@ -22,8 +22,13 @@ function useGrowingTextField({ inputRef, inputWrapRef, value, disabled }) {
|
|
|
22
22
|
}
|
|
23
23
|
}, [inputRef, disabled, inputWrapRef]);
|
|
24
24
|
(0, utils_1.useLayoutEffect)(() => {
|
|
25
|
-
if (disabled)
|
|
25
|
+
if (disabled) {
|
|
26
|
+
// reset the height property if it was flipped to disabled
|
|
27
|
+
if (inputWrapRef.current) {
|
|
28
|
+
inputWrapRef.current.style.removeProperty("height");
|
|
29
|
+
}
|
|
26
30
|
return;
|
|
31
|
+
}
|
|
27
32
|
if (inputRef.current) {
|
|
28
33
|
// Temp hack until we can figure out a better way to ensure proper measurements when rendered through a portal (i.e. Modals)
|
|
29
34
|
if (inputRef.current.scrollHeight === 0) {
|
|
@@ -32,6 +37,6 @@ function useGrowingTextField({ inputRef, inputWrapRef, value, disabled }) {
|
|
|
32
37
|
}
|
|
33
38
|
onHeightChange();
|
|
34
39
|
}
|
|
35
|
-
}, [onHeightChange, value, inputRef, disabled]);
|
|
40
|
+
}, [onHeightChange, value, inputRef, disabled, inputWrapRef]);
|
|
36
41
|
}
|
|
37
42
|
exports.useGrowingTextField = useGrowingTextField;
|
|
@@ -11,6 +11,7 @@ const TextFieldBase_1 = require("../TextFieldBase");
|
|
|
11
11
|
const TreeSelectField_1 = require("../TreeSelectField/TreeSelectField");
|
|
12
12
|
const utils_1 = require("../TreeSelectField/utils");
|
|
13
13
|
const utils_2 = require("../../utils");
|
|
14
|
+
const useGrowingTextField_1 = require("../hooks/useGrowingTextField");
|
|
14
15
|
function ComboBoxInput(props) {
|
|
15
16
|
const { inputProps, buttonProps, buttonRef, errorMsg, state, fieldDecoration, onBlur, onFocus, selectedOptions, selectedOptionsLabels, getOptionValue, getOptionLabel, sizeToContent = false, contrast = false, nothingSelectedText, resetField, isTree, listBoxRef, inputRef, inputWrapRef, multiline = false, ...otherProps } = props;
|
|
16
17
|
const { wrap = false } = (0, PresentationContext_1.usePresentationContext)();
|
|
@@ -20,13 +21,21 @@ function ComboBoxInput(props) {
|
|
|
20
21
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
21
22
|
const isMultiSelect = state.selectionManager.selectionMode === "multiple";
|
|
22
23
|
const showNumSelection = isMultiSelect && state.selectionManager.selectedKeys.size > 1;
|
|
23
|
-
// Show selections as chips
|
|
24
|
-
const
|
|
24
|
+
// Show selections as chips when using multiselect when unfocused
|
|
25
|
+
const showChipSelection = isMultiSelect && state.selectionManager.selectedKeys.size > 0;
|
|
25
26
|
// For MultiSelect only show the `fieldDecoration` when input is not in focus.
|
|
26
27
|
const showFieldDecoration = (!isMultiSelect || (isMultiSelect && !isFocused)) && fieldDecoration && selectedOptions.length === 1;
|
|
27
28
|
const multilineProps = allowWrap ? { textAreaMinHeight: 0, multiline: true } : {};
|
|
28
29
|
const chipLabels = isTree ? selectedOptionsLabels || [] : selectedOptions.map((o) => getOptionLabel(o));
|
|
29
|
-
|
|
30
|
+
(0, useGrowingTextField_1.useGrowingTextField)({
|
|
31
|
+
// This says: When using a multiselect, then only enable the growing textfield when we are focused on it.
|
|
32
|
+
// Because otherwise, we're not displaying the input element that dictates the height (we're displaying <Chips/>). This would cause incorrect calculations
|
|
33
|
+
disabled: (isMultiSelect && (!allowWrap || !isFocused)) || (!isMultiSelect && !allowWrap),
|
|
34
|
+
inputRef,
|
|
35
|
+
inputWrapRef,
|
|
36
|
+
value: inputProps.value,
|
|
37
|
+
});
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(TextFieldBase_1.TextFieldBase, { ...otherProps, ...multilineProps, unfocusedPlaceholder: showChipSelection && (0, jsx_runtime_1.jsx)(components_1.Chips, { compact: otherProps.compact, values: chipLabels, wrap: allowWrap }), inputRef: inputRef, inputWrapRef: inputWrapRef, errorMsg: errorMsg, contrast: contrast, xss: otherProps.labelStyle !== "inline" && !inputProps.readOnly ? Css_1.Css.fw5.$ : {}, startAdornment: (showNumSelection && ((0, jsx_runtime_1.jsx)(components_1.Tooltip, { title: (0, jsx_runtime_1.jsx)(SelectedOptionBullets, { labels: chipLabels }), children: (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.wPx(16).hPx(16).fs0.br100.bgBlue700.white.tinySb.df.aic.jcc.$, "data-testid": "selectedOptionsCount", children: isTree ? selectedOptionsLabels === null || selectedOptionsLabels === void 0 ? void 0 : selectedOptionsLabels.length : state.selectionManager.selectedKeys.size }) }))) ||
|
|
30
39
|
(showFieldDecoration && fieldDecoration(selectedOptions[0])), endAdornment: !inputProps.readOnly && ((0, jsx_runtime_1.jsx)("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, css: {
|
|
31
40
|
...Css_1.Css.br4.outline0.gray700.if(contrast).gray400.$,
|
|
32
41
|
...(inputProps.disabled ? Css_1.Css.cursorNotAllowed.gray400.if(contrast).gray600.$ : {}),
|