@homebound/beam 2.199.2 → 2.200.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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { OverlayTriggerProps } from "./internal/OverlayTrigger";
|
|
3
|
+
export interface ButtonModalProps extends Pick<OverlayTriggerProps, "trigger" | "placement" | "disabled" | "tooltip"> {
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
title?: string;
|
|
6
|
+
storybookDefaultOpen?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ButtonModal(props: ButtonModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_aria_1 = require("react-aria");
|
|
7
|
+
const react_stately_1 = require("react-stately");
|
|
8
|
+
const OverlayTrigger_1 = require("./internal/OverlayTrigger");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const ContextualModal_1 = require("./internal/ContextualModal");
|
|
11
|
+
function ButtonModal(props) {
|
|
12
|
+
const { storybookDefaultOpen, trigger, disabled, content, title } = props;
|
|
13
|
+
const state = (0, react_stately_1.useMenuTriggerState)({ isOpen: storybookDefaultOpen });
|
|
14
|
+
const buttonRef = (0, react_1.useRef)(null);
|
|
15
|
+
const { menuTriggerProps } = (0, react_aria_1.useMenuTrigger)({ isDisabled: !!disabled }, state, buttonRef);
|
|
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));
|
|
18
|
+
}
|
|
19
|
+
exports.ButtonModal = ButtonModal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextualModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_aria_1 = require("react-aria");
|
|
6
|
+
const Css_1 = require("../../Css");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
function ContextualModal(props) {
|
|
9
|
+
const { content, title } = props;
|
|
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));
|
|
12
|
+
}
|
|
13
|
+
exports.ContextualModal = ContextualModal;
|