@homebound/beam 2.156.0 → 2.157.1
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/ButtonMenu.d.ts +1 -0
- package/dist/components/Stepper.d.ts +2 -3
- package/dist/components/SuperDrawer/SuperDrawer.js +8 -8
- package/dist/components/SuperDrawer/SuperDrawerContent.js +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/internal/MenuItem.js +2 -1
- package/package.json +1 -1
|
@@ -4,10 +4,9 @@ export interface Step {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
value: string;
|
|
6
6
|
}
|
|
7
|
-
interface
|
|
7
|
+
export interface StepperProps {
|
|
8
8
|
steps: Step[];
|
|
9
9
|
currentStep: Step["value"];
|
|
10
10
|
onChange: (stepValue: string) => void;
|
|
11
11
|
}
|
|
12
|
-
export declare function Stepper({ steps, currentStep, onChange }:
|
|
13
|
-
export {};
|
|
12
|
+
export declare function Stepper({ steps, currentStep, onChange }: StepperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -33,6 +33,7 @@ const utils_1 = require("../../utils");
|
|
|
33
33
|
* above the SuperDrawer.
|
|
34
34
|
*/
|
|
35
35
|
function SuperDrawer() {
|
|
36
|
+
var _a, _b;
|
|
36
37
|
const { drawerContentStack: contentStack, modalState, modalBodyDiv, modalFooterDiv, modalHeaderDiv, } = (0, BeamContext_1.useBeamContext)();
|
|
37
38
|
const { closeDrawer } = (0, components_1.useSuperDrawer)();
|
|
38
39
|
const drawerHeaderRef = (0, react_3.useRef)(null);
|
|
@@ -48,17 +49,16 @@ function SuperDrawer() {
|
|
|
48
49
|
}
|
|
49
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
51
|
}, [modalBodyRef.current, modalFooterRef.current, modalState.current]);
|
|
51
|
-
if (contentStack.current.length === 0) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
52
|
// Get the latest element on the stack
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
// We use undefined, nullish operators and empty object here to allow AnimatePresence
|
|
54
|
+
// to animate the drawers exit transition when our stack is empty
|
|
55
|
+
const currentContent = (_a = contentStack.current[contentStack.current.length - 1]) === null || _a === void 0 ? void 0 : _a.opts;
|
|
56
|
+
const { content } = currentContent !== null && currentContent !== void 0 ? currentContent : {};
|
|
57
57
|
// Also get the first / non-detail element on the stack
|
|
58
|
-
const firstContent = contentStack.current[0].opts;
|
|
59
|
-
const { onPrevClick, onNextClick, titleRightContent, titleLeftContent, hideControls } = firstContent;
|
|
58
|
+
const firstContent = (_b = contentStack.current[0]) === null || _b === void 0 ? void 0 : _b.opts;
|
|
59
|
+
const { onPrevClick, onNextClick, titleRightContent, titleLeftContent, hideControls } = firstContent !== null && firstContent !== void 0 ? firstContent : {};
|
|
60
60
|
const isDetail = currentContent !== firstContent;
|
|
61
|
-
const title = currentContent.title || firstContent.title;
|
|
61
|
+
const title = content === undefined ? '' : currentContent.title || firstContent.title;
|
|
62
62
|
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: content && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Global, { styles: { body: Css_1.Css.overflowHidden.$ } }, void 0), (0, react_1.createElement)(framer_motion_1.motion.div, { ...testId,
|
|
63
63
|
// Key is required for framer-motion animations
|
|
64
64
|
key: "superDrawer",
|
|
@@ -15,10 +15,11 @@ const Css_1 = require("../../Css");
|
|
|
15
15
|
* that knows how to handle the title, prev/next link and the onClose handler.
|
|
16
16
|
*/
|
|
17
17
|
const SuperDrawerContent = ({ children, actions }) => {
|
|
18
|
+
var _a;
|
|
18
19
|
const { closeDrawerDetail } = (0, useSuperDrawer_1.useSuperDrawer)();
|
|
19
20
|
const { drawerContentStack: contentStack } = (0, BeamContext_1.useBeamContext)();
|
|
20
21
|
// Determine if the current element is a new content element or an detail element
|
|
21
|
-
const { kind } = contentStack.current[contentStack.current.length - 1];
|
|
22
|
+
const { kind } = (_a = contentStack.current[contentStack.current.length - 1]) !== null && _a !== void 0 ? _a : {};
|
|
22
23
|
function wrapWithMotionAndMaybeBack(children) {
|
|
23
24
|
if (kind === "open") {
|
|
24
25
|
return ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ css: Css_1.Css.p3.fg1.overflowAuto.$ }, { children: children }), "content"));
|
|
@@ -23,6 +23,7 @@ export { NavLink } from "./NavLink";
|
|
|
23
23
|
export { PresentationProvider } from "./PresentationContext";
|
|
24
24
|
export * from "./Snackbar";
|
|
25
25
|
export * from "./Stepper";
|
|
26
|
+
export type { Step, StepperProps } from "./Stepper";
|
|
26
27
|
export * from "./SuperDrawer";
|
|
27
28
|
export * from "./Table";
|
|
28
29
|
export { TabContent, Tabs, TabsWithContent } from "./Tabs";
|
|
@@ -14,7 +14,7 @@ const defaultTestId_1 = require("../../utils/defaultTestId");
|
|
|
14
14
|
function MenuItemImpl(props) {
|
|
15
15
|
const { item, state, onClose } = props;
|
|
16
16
|
const menuItem = item.value;
|
|
17
|
-
const { disabled: isDisabled, onClick, label } = menuItem;
|
|
17
|
+
const { disabled: isDisabled, onClick, label, destructive } = menuItem;
|
|
18
18
|
const isFocused = state.selectionManager.focusedKey === item.key;
|
|
19
19
|
const ref = (0, react_1.useRef)(null);
|
|
20
20
|
const history = (0, react_router_1.useHistory)();
|
|
@@ -43,6 +43,7 @@ function MenuItemImpl(props) {
|
|
|
43
43
|
...(!isDisabled && isHovered ? Css_1.Css.bgGray100.$ : {}),
|
|
44
44
|
...(isFocused ? Css_1.Css.add("boxShadow", `inset 0 0 0 1px ${Css_1.Palette.LightBlue700}`).$ : {}),
|
|
45
45
|
...(isDisabled ? Css_1.Css.gray500.cursorNotAllowed.$ : {}),
|
|
46
|
+
...(destructive ? Css_1.Css.red600.$ : {}),
|
|
46
47
|
} }, tid[(0, defaultTestId_1.defaultTestId)(menuItem.label)], { children: maybeWrapInLink(onClick, isIconMenuItem(menuItem) ? ((0, jsx_runtime_1.jsx)(IconMenuItem, Object.assign({}, menuItem), void 0)) : isImageMenuItem(menuItem) ? ((0, jsx_runtime_1.jsx)(ImageMenuItem, Object.assign({}, menuItem), void 0)) : (label), isDisabled) }), void 0));
|
|
47
48
|
}
|
|
48
49
|
exports.MenuItemImpl = MenuItemImpl;
|