@adamjanicki/ui 1.8.1 → 1.8.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.
|
@@ -38,6 +38,10 @@ type Props = BoxProps & {
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
returnFocusOnEscape?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Props to pass to the outer box container
|
|
43
|
+
*/
|
|
44
|
+
wrapperBoxProps?: Omit<BoxProps, "children">;
|
|
41
45
|
};
|
|
42
46
|
declare const Modal: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
43
47
|
export default Modal;
|
|
@@ -27,18 +27,9 @@ import Layer from "../Layer";
|
|
|
27
27
|
import Button, { IconButton } from "../Button";
|
|
28
28
|
import Animated from "../Animated";
|
|
29
29
|
var Modal = React.forwardRef(function (_a, ref) {
|
|
30
|
-
var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, confirmButtonProps = _a.confirmButtonProps, cancelButtonProps = _a.cancelButtonProps, _b = _a.confirmLabel, confirmLabel = _b === void 0 ? "Ok" : _b, _c = _a.cancelLabel, cancelLabel = _c === void 0 ? "Cancel" : _c, returnFocusOnEscape = _a.returnFocusOnEscape, rest = __rest(_a, ["open", "onClose", "onConfirm", "confirmButtonProps", "cancelButtonProps", "confirmLabel", "cancelLabel", "returnFocusOnEscape"]);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
padding: "m",
|
|
34
|
-
gap: "m",
|
|
35
|
-
radius: "rounded",
|
|
36
|
-
maxWidth: "full",
|
|
37
|
-
shadow: "floating",
|
|
38
|
-
border: true,
|
|
39
|
-
color: "default",
|
|
40
|
-
backgroundColor: "default",
|
|
41
|
-
}, children: [_jsx(Box, { vfx: {
|
|
30
|
+
var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, confirmButtonProps = _a.confirmButtonProps, cancelButtonProps = _a.cancelButtonProps, _b = _a.confirmLabel, confirmLabel = _b === void 0 ? "Ok" : _b, _c = _a.cancelLabel, cancelLabel = _c === void 0 ? "Cancel" : _c, returnFocusOnEscape = _a.returnFocusOnEscape, wrapperBoxProps = _a.wrapperBoxProps, rest = __rest(_a, ["open", "onClose", "onConfirm", "confirmButtonProps", "cancelButtonProps", "confirmLabel", "cancelLabel", "returnFocusOnEscape", "wrapperBoxProps"]);
|
|
31
|
+
var _d = wrapperBoxProps || {}, wrapperBoxVfx = _d.vfx, wrapperBoxRest = __rest(_d, ["vfx"]);
|
|
32
|
+
return (_jsx(Animated, { vfx: { z: "max" }, visible: open, animateTo: { vfx: { opacity: "full" } }, animateFrom: { vfx: { opacity: "none" } }, children: _jsx(Layer, { onClose: onClose, returnFocusOnEscape: returnFocusOnEscape, children: _jsxs(Box, __assign({ role: "dialog", "aria-modal": "true" }, wrapperBoxRest, { vfx: __assign({ axis: "y", padding: "m", gap: "m", radius: "rounded", maxWidth: "full", shadow: "floating", border: true, color: "default", backgroundColor: "default" }, wrapperBoxVfx), children: [_jsx(Box, { vfx: {
|
|
42
33
|
axis: "x",
|
|
43
34
|
align: "center",
|
|
44
35
|
justify: "end",
|
|
@@ -52,6 +43,6 @@ var Modal = React.forwardRef(function (_a, ref) {
|
|
|
52
43
|
}, children: [_jsx(Button, __assign({ variant: "secondary" }, cancelButtonProps, { onClick: onClose, children: cancelLabel })), _jsx(Button, __assign({}, confirmButtonProps, { onClick: function () {
|
|
53
44
|
onConfirm();
|
|
54
45
|
onClose();
|
|
55
|
-
}, children: confirmLabel }))] })] }) }) }));
|
|
46
|
+
}, children: confirmLabel }))] })] })) }) }));
|
|
56
47
|
});
|
|
57
48
|
export default Modal;
|