@homebound/beam 2.272.2 → 2.273.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/IconButton.d.ts +2 -0
- package/dist/components/IconButton.js +2 -1
- package/dist/components/Table/GridTableApi.d.ts +2 -0
- package/dist/components/Table/GridTableApi.js +3 -0
- package/dist/components/Table/utils/TableState.d.ts +1 -0
- package/dist/components/Table/utils/TableState.js +4 -0
- package/dist/components/internal/MenuItem.js +3 -2
- package/dist/components/internal/MenuSection.js +1 -1
- package/dist/components/internal/OverlayTrigger.js +3 -1
- package/package.json +1 -1
|
@@ -18,6 +18,8 @@ export interface IconButtonProps extends BeamButtonProps, BeamFocusableProps {
|
|
|
18
18
|
contrast?: boolean;
|
|
19
19
|
/** Denotes if this button is used to download a resource. Uses the anchor tag with the `download` attribute */
|
|
20
20
|
download?: boolean;
|
|
21
|
+
/** Provides label for screen readers - Will become a required soon */
|
|
22
|
+
label?: string;
|
|
21
23
|
}
|
|
22
24
|
export declare function IconButton(props: IconButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
23
25
|
export declare const iconButtonStylesHover: {
|
|
@@ -11,7 +11,7 @@ const utils_1 = require("../utils");
|
|
|
11
11
|
const getInteractiveElement_1 = require("../utils/getInteractiveElement");
|
|
12
12
|
const useTestIds_1 = require("../utils/useTestIds");
|
|
13
13
|
function IconButton(props) {
|
|
14
|
-
const { onClick: onPress, disabled, color, icon, autoFocus, inc, buttonRef, tooltip, menuTriggerProps, openInNew, compact = false, contrast = false, download = false, forceFocusStyles = false, } = props;
|
|
14
|
+
const { onClick: onPress, disabled, color, icon, autoFocus, inc, buttonRef, tooltip, menuTriggerProps, openInNew, compact = false, contrast = false, download = false, forceFocusStyles = false, label, } = props;
|
|
15
15
|
const isDisabled = !!disabled;
|
|
16
16
|
const ariaProps = { onPress, isDisabled, autoFocus, ...menuTriggerProps };
|
|
17
17
|
const ref = (0, useGetRef_1.useGetRef)(buttonRef);
|
|
@@ -39,6 +39,7 @@ function IconButton(props) {
|
|
|
39
39
|
className: typeof onPress === "string" ? components_1.navLink : undefined,
|
|
40
40
|
ref: ref,
|
|
41
41
|
css: styles,
|
|
42
|
+
"aria-label": label,
|
|
42
43
|
};
|
|
43
44
|
const buttonContent = ((0, jsx_runtime_1.jsx)(components_1.Icon, { icon: icon, color: color || (isDisabled ? Css_1.Palette.Gray400 : iconColor), inc: compact ? 2 : inc }));
|
|
44
45
|
// If we're disabled b/c of a non-boolean ReactNode, or the caller specified tooltip text, then show it in a tooltip
|
|
@@ -42,6 +42,7 @@ export type GridTableApi<R extends Kinded> = {
|
|
|
42
42
|
isCollapsedRow: (id: string) => boolean;
|
|
43
43
|
setVisibleColumns: (ids: string[]) => void;
|
|
44
44
|
getVisibleColumnIds: () => string[];
|
|
45
|
+
refetchExpandedColumns: () => void;
|
|
45
46
|
};
|
|
46
47
|
export declare class GridTableApiImpl<R extends Kinded> implements GridTableApi<R> {
|
|
47
48
|
readonly tableState: TableState;
|
|
@@ -59,4 +60,5 @@ export declare class GridTableApiImpl<R extends Kinded> implements GridTableApi<
|
|
|
59
60
|
isCollapsedRow(id: string): boolean;
|
|
60
61
|
setVisibleColumns(ids: string[]): void;
|
|
61
62
|
getVisibleColumnIds(): string[];
|
|
63
|
+
refetchExpandedColumns(): void;
|
|
62
64
|
}
|
|
@@ -47,6 +47,7 @@ export declare class TableState {
|
|
|
47
47
|
get sortState(): SortState | undefined;
|
|
48
48
|
setRows(rows: GridDataRow<any>[]): void;
|
|
49
49
|
setColumns(columns: GridColumnWithId<any>[], visibleColumnsStorageKey: string | undefined): void;
|
|
50
|
+
refetchExpandedColumns(): void;
|
|
50
51
|
/** Determines which columns to expand immediately vs async */
|
|
51
52
|
parseAndUpdateExpandedColumns(columnsToExpand: GridColumnWithId<any>[]): Promise<void>;
|
|
52
53
|
/** Updates the state of which columns are expanded */
|
|
@@ -200,6 +200,10 @@ class TableState {
|
|
|
200
200
|
this.columns = columns;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
refetchExpandedColumns() {
|
|
204
|
+
this.loadedColumns.clear();
|
|
205
|
+
this.parseAndUpdateExpandedColumns(this.columns.filter((c) => this.expandedColumnIds.includes(c.id)));
|
|
206
|
+
}
|
|
203
207
|
/** Determines which columns to expand immediately vs async */
|
|
204
208
|
async parseAndUpdateExpandedColumns(columnsToExpand) {
|
|
205
209
|
// Separate out which columns need to be loaded async vs which can be loaded immediately.
|
|
@@ -51,11 +51,12 @@ function MenuItemImpl(props) {
|
|
|
51
51
|
onClose,
|
|
52
52
|
}, state, ref);
|
|
53
53
|
return ((0, jsx_runtime_1.jsx)("li", { ...menuItemProps, ...hoverProps, ref: ref, css: {
|
|
54
|
-
...Css_1.Css.df.aic.py1.px2.cursorPointer.outline0.mh("42px").$,
|
|
54
|
+
...Css_1.Css.df.aic.py1.px2.cursorPointer.outline0.mh("42px").sm.$,
|
|
55
55
|
...(!isDisabled && isHovered ? (contrast ? Css_1.Css.bgGray800.$ : Css_1.Css.bgGray100.$) : {}),
|
|
56
56
|
...(isFocused ? Css_1.Css.add("boxShadow", `inset 0 0 0 1px ${Css_1.Palette.LightBlue700}`).$ : {}),
|
|
57
57
|
...(isDisabled ? Css_1.Css.gray500.cursorNotAllowed.$ : {}),
|
|
58
58
|
...(destructive ? Css_1.Css.red600.$ : {}),
|
|
59
|
+
...(isSelected ? Css_1.Css.fw5.$ : {}),
|
|
59
60
|
}, ...tid[(0, defaultTestId_1.defaultTestId)(menuItem.label)], children: (0, Tooltip_1.maybeTooltip)({
|
|
60
61
|
title: (0, Tooltip_1.resolveTooltip)(disabled),
|
|
61
62
|
placement: "right",
|
|
@@ -84,7 +85,7 @@ function maybeWrapInLink(onClick, content, disabled) {
|
|
|
84
85
|
if (disabled || typeof onClick !== "string") {
|
|
85
86
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: content });
|
|
86
87
|
}
|
|
87
|
-
return (0, utils_1.isAbsoluteUrl)(onClick) ? ((0, jsx_runtime_1.jsxs)("a", { href: onClick, target: "_blank", rel: "noopener noreferrer", className: "navLink", css: Css_1.Css.df.jcsb.w100.$, children: [content, (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.ml2.$, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "linkExternal" }) })] })) : ((0, jsx_runtime_1.jsx)(react_router_dom_1.NavLink, { to: onClick, className: "navLink", children: content }));
|
|
88
|
+
return (0, utils_1.isAbsoluteUrl)(onClick) ? ((0, jsx_runtime_1.jsxs)("a", { href: onClick, target: "_blank", rel: "noopener noreferrer", className: "navLink", css: Css_1.Css.df.aic.jcsb.w100.$, children: [content, (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.ml2.$, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "linkExternal" }) })] })) : ((0, jsx_runtime_1.jsx)(react_router_dom_1.NavLink, { to: onClick, className: "navLink", children: content }));
|
|
88
89
|
}
|
|
89
90
|
function isIconMenuItem(item) {
|
|
90
91
|
return item && typeof item === "object" && "icon" in item;
|
|
@@ -12,6 +12,6 @@ function MenuSectionImpl(props) {
|
|
|
12
12
|
const { separatorProps } = (0, react_aria_1.useSeparator)({ elementType: "li" });
|
|
13
13
|
const isPersistentSection = section.key !== state.collection.getFirstKey();
|
|
14
14
|
const tid = (0, utils_1.useTestIds)(props);
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isPersistentSection && (0, jsx_runtime_1.jsx)("li", { ...separatorProps, css: Css_1.Css.bt.bGray200.$ }), (0, jsx_runtime_1.jsx)("li", { ...itemProps, css: Css_1.Css.if(!isPersistentSection).overflowAuto.if(contrast).white.$, children: (0, jsx_runtime_1.jsx)("ul", { css: Css_1.Css.listReset.$, ...groupProps, ...tid[isPersistentSection ? "persistentItems" : "menuItems"], children: [...section.childNodes].map((item) => ((0, jsx_runtime_1.jsx)(internal_1.MenuItemImpl, { item: item, state: state, onClose: onClose, contrast: contrast, ...tid }, item.key))) }) })] }));
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isPersistentSection && (0, jsx_runtime_1.jsx)("li", { ...separatorProps, css: Css_1.Css.bt.bGray200.$ }), (0, jsx_runtime_1.jsx)("li", { ...itemProps, css: Css_1.Css.gray900.if(!isPersistentSection).overflowAuto.if(contrast).white.$, children: (0, jsx_runtime_1.jsx)("ul", { css: Css_1.Css.listReset.$, ...groupProps, ...tid[isPersistentSection ? "persistentItems" : "menuItems"], children: [...section.childNodes].map((item) => ((0, jsx_runtime_1.jsx)(internal_1.MenuItemImpl, { item: item, state: state, onClose: onClose, contrast: contrast, ...tid }, item.key))) }) })] }));
|
|
16
16
|
}
|
|
17
17
|
exports.MenuSectionImpl = MenuSectionImpl;
|
|
@@ -33,7 +33,9 @@ function OverlayTrigger(props) {
|
|
|
33
33
|
: isIconButton(trigger)
|
|
34
34
|
? trigger.icon
|
|
35
35
|
: trigger.name);
|
|
36
|
-
return (
|
|
36
|
+
return (
|
|
37
|
+
// Add `line-height: 0` to prevent the Icon button and Avatar buttons from inheriting the line-height, causing them to be taller than they should.
|
|
38
|
+
(0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.dib.add("lineHeight", 0).$, children: [isTextButton(trigger) ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: variant ? variant : "secondary", contrast: contrast, ...trigger, menuTriggerProps: menuTriggerProps, buttonRef: buttonRef, endAdornment: !hideEndAdornment ? (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: state.isOpen ? "chevronUp" : "chevronDown" }) : null, disabled: disabled, tooltip: tooltip, onClick: (_a = menuTriggerProps.onPress) !== null && _a !== void 0 ? _a : utils_1.noop, forceFocusStyles: showActiveBorder && state.isOpen, ...tid })) : isNavLinkButton(trigger) ? ((0, jsx_runtime_1.jsx)(NavLink_1.NavLink, { ...trigger, label: trigger.navLabel, disabled: !!disabled, contrast: contrast, menuTriggerProps: menuTriggerProps, buttonRef: buttonRef, ...tid })) : isIconButton(trigger) ? ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { ...trigger, menuTriggerProps: menuTriggerProps, buttonRef: buttonRef, ...tid, disabled: disabled, tooltip: tooltip, onClick: (_b = menuTriggerProps.onPress) !== null && _b !== void 0 ? _b : utils_1.noop, forceFocusStyles: showActiveBorder && state.isOpen })) : ((0, jsx_runtime_1.jsx)(AvatarButton_1.AvatarButton, { ...trigger, menuTriggerProps: menuTriggerProps, buttonRef: buttonRef, ...tid, disabled: disabled, tooltip: tooltip, onClick: (_c = menuTriggerProps.onPress) !== null && _c !== void 0 ? _c : utils_1.noop, forceFocusStyles: showActiveBorder && state.isOpen })), state.isOpen && ((0, jsx_runtime_1.jsx)(internal_1.Popover, { triggerRef: buttonRef, popoverRef: popoverRef, positionProps: positionProps, onClose: () => state.close(), isOpen: state.isOpen, children: children }))] }));
|
|
37
39
|
}
|
|
38
40
|
exports.OverlayTrigger = OverlayTrigger;
|
|
39
41
|
function isTextButton(trigger) {
|