@homebound/beam 2.210.3 → 2.211.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.
|
@@ -2,7 +2,7 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import { OverlayTriggerProps } from "./internal/OverlayTrigger";
|
|
3
3
|
import { ButtonVariant } from "./Button";
|
|
4
4
|
export interface ButtonModalProps extends Pick<OverlayTriggerProps, "trigger" | "placement" | "disabled" | "tooltip" | "showActiveBorder"> {
|
|
5
|
-
content: ReactNode;
|
|
5
|
+
content: ReactNode | ((close: () => void) => ReactNode);
|
|
6
6
|
title?: string;
|
|
7
7
|
variant?: ButtonVariant;
|
|
8
8
|
storybookDefaultOpen?: boolean;
|
|
@@ -14,6 +14,6 @@ function ButtonModal(props) {
|
|
|
14
14
|
const buttonRef = (0, react_1.useRef)(null);
|
|
15
15
|
const { menuTriggerProps } = (0, react_aria_1.useMenuTrigger)({ isDisabled: !!disabled }, state, buttonRef);
|
|
16
16
|
const tid = (0, utils_1.useTestIds)(props, (0, OverlayTrigger_1.isTextButton)(trigger) ? trigger.label : (0, OverlayTrigger_1.isIconButton)(trigger) ? trigger.icon : trigger.name);
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger, Object.assign({}, props, { menuTriggerProps: menuTriggerProps, state: state, buttonRef: buttonRef }, tid, { children: (0, jsx_runtime_1.jsx)(ContextualModal_1.ContextualModal, { content: content, title: title }, void 0) }), void 0));
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger, Object.assign({}, props, { menuTriggerProps: menuTriggerProps, state: state, buttonRef: buttonRef }, tid, { children: (0, jsx_runtime_1.jsx)(ContextualModal_1.ContextualModal, { content: content, title: title, close: state.close }, void 0) }), void 0));
|
|
18
18
|
}
|
|
19
19
|
exports.ButtonModal = ButtonModal;
|
|
@@ -6,8 +6,8 @@ const react_aria_1 = require("react-aria");
|
|
|
6
6
|
const Css_1 = require("../../Css");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
function ContextualModal(props) {
|
|
9
|
-
const { content, title } = props;
|
|
9
|
+
const { content, title, close } = props;
|
|
10
10
|
const tid = (0, utils_1.useTestIds)(props, "popup");
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(react_aria_1.FocusScope, Object.assign({ restoreFocus: true, autoFocus: true }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.p3.df.fdc.gap3.bgWhite.bshModal.br4.maxh("inherit").overflowAuto.$ }, { children: [title && ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.lg.tc.$ }, tid.title, { children: title }), void 0)), (0, jsx_runtime_1.jsx)("div", Object.assign({}, tid.content, { children: content }), void 0)] }), void 0) }), void 0));
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_1.FocusScope, Object.assign({ restoreFocus: true, autoFocus: true }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.p3.df.fdc.gap3.bgWhite.bshModal.br4.maxh("inherit").overflowAuto.$ }, tid, { children: [title && ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.lg.tc.$ }, tid.title, { children: title }), void 0)), (0, jsx_runtime_1.jsx)("div", Object.assign({}, tid.content, { children: typeof content === "function" ? content(close) : content }), void 0)] }), void 0) }), void 0));
|
|
12
12
|
}
|
|
13
13
|
exports.ContextualModal = ContextualModal;
|
|
@@ -13,7 +13,7 @@ const Css_1 = require("../../Css");
|
|
|
13
13
|
const utils_1 = require("../../utils");
|
|
14
14
|
const defaultTestId_1 = require("../../utils/defaultTestId");
|
|
15
15
|
function OverlayTrigger(props) {
|
|
16
|
-
const { trigger, buttonRef, menuTriggerProps, placement, state, disabled, tooltip, children, variant, hideEndAdornment, showActiveBorder = false } = props;
|
|
16
|
+
const { trigger, buttonRef, menuTriggerProps, placement, state, disabled, tooltip, children, variant, hideEndAdornment, showActiveBorder = false, } = props;
|
|
17
17
|
const popoverRef = (0, react_1.useRef)(null);
|
|
18
18
|
const { overlayProps: positionProps } = (0, react_aria_1.useOverlayPosition)({
|
|
19
19
|
targetRef: buttonRef,
|