oolib 3.0.0 → 3.1.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.
@@ -27,6 +27,7 @@ export interface ModalProps {
27
27
  fitToContentHeight?: boolean;
28
28
  invert?: boolean;
29
29
  overflowVisible?: boolean;
30
+ hideBackdrop?: boolean;
30
31
  showActionPanel?: boolean;
31
32
  onCloseText?: string;
32
33
  onConfirm?: React.MouseEventHandler<HTMLButtonElement> | React.ReactNode;
@@ -51,6 +52,7 @@ export interface ModalProps {
51
52
  * @prop {boolean} [fitToContentHeight]: A boolean indicating whether the modal height should be adjusted based on its content. Defaults to false.
52
53
  * @prop {boolean} [invert]: A boolean indicating whether to invert the background color of the modal. Defaults to false.
53
54
  * @prop {boolean} [overflowVisible]: A boolean indicating whether the modal should render its overflow as visible. Defaults to false.
55
+ * @prop {boolean} [hideBackdrop]: A boolean indicating whether to make the modal's own backdrop transparent (the click-to-close layer is kept). Use when the caller renders its own backdrop behind the modal. Defaults to false.
54
56
  * @prop {boolean} [showActionPanel]: A boolean indicating whether to render the action panel. Defaults to false.
55
57
  * @prop {string} [onCloseText]: The text to be displayed in the close button. Defaults to "Close".
56
58
  * @prop {React.MouseEventHandler<HTMLButtonElement> | React.ReactNode} [onConfirm]: A callback function or node to be rendered instead of the confirm button.
@@ -69,6 +69,7 @@ var Divider_1 = require("../../Divider");
69
69
  * @prop {boolean} [fitToContentHeight]: A boolean indicating whether the modal height should be adjusted based on its content. Defaults to false.
70
70
  * @prop {boolean} [invert]: A boolean indicating whether to invert the background color of the modal. Defaults to false.
71
71
  * @prop {boolean} [overflowVisible]: A boolean indicating whether the modal should render its overflow as visible. Defaults to false.
72
+ * @prop {boolean} [hideBackdrop]: A boolean indicating whether to make the modal's own backdrop transparent (the click-to-close layer is kept). Use when the caller renders its own backdrop behind the modal. Defaults to false.
72
73
  * @prop {boolean} [showActionPanel]: A boolean indicating whether to render the action panel. Defaults to false.
73
74
  * @prop {string} [onCloseText]: The text to be displayed in the close button. Defaults to "Close".
74
75
  * @prop {React.MouseEventHandler<HTMLButtonElement> | React.ReactNode} [onConfirm]: A callback function or node to be rendered instead of the confirm button.
@@ -81,12 +82,12 @@ var Divider_1 = require("../../Divider");
81
82
  * @return {ReactElement} The rendered modal component.
82
83
  */
83
84
  var Modal = function (_a) {
84
- var title = _a.title, onClose = _a.onClose, children = _a.children, linkTo = _a.linkTo, _b = _a.desktopWidth, desktopWidth = _b === void 0 ? "80%" : _b, _c = _a.headerStyle, headerStyle = _c === void 0 ? "style1" : _c, subtitle = _a.subtitle, _d = _a.fitToContentHeight, fitToContentHeight = _d === void 0 ? false : _d, invert = _a.invert, overflowVisible = _a.overflowVisible, _e = _a.showActionPanel, showActionPanel = _e === void 0 ? false : _e, _f = _a.onCloseText, onCloseText = _f === void 0 ? "Close" : _f, onConfirm = _a.onConfirm, _g = _a.showCloseBtn, showCloseBtn = _g === void 0 ? true : _g, _h = _a.onConfirmText, onConfirmText = _h === void 0 ? "Confirm" : _h, _j = _a.showConfirmBtn, showConfirmBtn = _j === void 0 ? true : _j, _k = _a.alignActions, alignActions = _k === void 0 ? "right" : _k, _l = _a.disableHeader, disableHeader = _l === void 0 ? false : _l, _m = _a.dynamicHeaderHeight, dynamicHeaderHeight = _m === void 0 ? false : _m;
85
+ var title = _a.title, onClose = _a.onClose, children = _a.children, linkTo = _a.linkTo, _b = _a.desktopWidth, desktopWidth = _b === void 0 ? "80%" : _b, _c = _a.headerStyle, headerStyle = _c === void 0 ? "style1" : _c, subtitle = _a.subtitle, _d = _a.fitToContentHeight, fitToContentHeight = _d === void 0 ? false : _d, invert = _a.invert, overflowVisible = _a.overflowVisible, _e = _a.hideBackdrop, hideBackdrop = _e === void 0 ? false : _e, _f = _a.showActionPanel, showActionPanel = _f === void 0 ? false : _f, _g = _a.onCloseText, onCloseText = _g === void 0 ? "Close" : _g, onConfirm = _a.onConfirm, _h = _a.showCloseBtn, showCloseBtn = _h === void 0 ? true : _h, _j = _a.onConfirmText, onConfirmText = _j === void 0 ? "Confirm" : _j, _k = _a.showConfirmBtn, showConfirmBtn = _k === void 0 ? true : _k, _l = _a.alignActions, alignActions = _l === void 0 ? "right" : _l, _m = _a.disableHeader, disableHeader = _m === void 0 ? false : _m, _o = _a.dynamicHeaderHeight, dynamicHeaderHeight = _o === void 0 ? false : _o;
85
86
  var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
86
87
  var handleClose = function () { return onClose(); };
87
88
  var initAnimPos = { marginTop: "100dvh", opacity: 0 };
88
89
  var endAnimPos = { marginTop: 0, opacity: 1 };
89
- var _o = (0, react_1.useState)(endAnimPos), animPos = _o[0], setAnimPos = _o[1];
90
+ var _p = (0, react_1.useState)(endAnimPos), animPos = _p[0], setAnimPos = _p[1];
90
91
  (0, react_1.useEffect)(function () {
91
92
  document.body.style.overflow = "hidden";
92
93
  return function () { document.body.style.overflow = "unset"; };
@@ -116,7 +117,7 @@ var Modal = function (_a) {
116
117
  : onConfirm,
117
118
  showCloseBtn && react_1.default.createElement(Buttons_1.ButtonGhost, { onClick: onClose }, onCloseText)))))); };
118
119
  return ((0, react_dom_1.createPortal)(react_1.default.createElement(styled_1.StyledModalLargeBg, null,
119
- react_1.default.createElement(styled_1.StyledModalLargeBgColor, { initial: { opacity: initAnimPos.opacity }, animate: { opacity: animPos.opacity }, transition: {
120
+ react_1.default.createElement(styled_1.StyledModalLargeBgColor, { "$hideBackdrop": hideBackdrop, initial: { opacity: initAnimPos.opacity }, animate: { opacity: animPos.opacity }, transition: {
120
121
  type: "tween",
121
122
  ease: "easeOut",
122
123
  }, onClick: function () { return handleClose(); } }),
@@ -14,7 +14,9 @@ interface StyledActionButtonsWrapperProps {
14
14
  alignActions: alignActionsType;
15
15
  }
16
16
  export declare const StyledModalLargeBg: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
17
- export declare const StyledModalLargeBgColor: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
17
+ export declare const StyledModalLargeBgColor: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
18
+ $hideBackdrop?: boolean;
19
+ }, never>;
18
20
  export declare const StyledModalLargeContentWrapper: import("styled-components").StyledComponent<"div", any, StyledModalLargeContentWrapperProps, never>;
19
21
  export declare const StyledModalLargeHeader: import("styled-components").StyledComponent<"header", any, {
20
22
  invert?: boolean;
@@ -45,7 +45,10 @@ var framer_motion_1 = require("framer-motion");
45
45
  var styled_components_1 = __importStar(require("styled-components"));
46
46
  var black_opacity80 = themes_1.colors.black_opacity80, white = themes_1.colors.white;
47
47
  exports.StyledModalLargeBg = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100vw;\n height: 100%;\n position: fixed;\n left: 0;\n bottom: 0;\n z-index: 999999999;\n overflow-y: auto;\n overflow-x: hidden;\n ", " {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n"], ["\n width: 100vw;\n height: 100%;\n position: fixed;\n left: 0;\n bottom: 0;\n z-index: 999999999;\n overflow-y: auto;\n overflow-x: hidden;\n ", " {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n"])), (0, mixins_1.mediaQuery)("sm"));
48
- exports.StyledModalLargeBgColor = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n position: absolute;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100dvh;\n"], ["\n background: ", ";\n position: absolute;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100dvh;\n"])), black_opacity80);
48
+ exports.StyledModalLargeBgColor = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // $hideBackdrop keeps this layer (so click-outside-to-close still works) but\n // makes it transparent \u2014 for callers that render their own backdrop behind\n // the Modal and don't want a second tint stacked on top.\n background: ", ";\n position: absolute;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100dvh;\n"], ["\n // $hideBackdrop keeps this layer (so click-outside-to-close still works) but\n // makes it transparent \u2014 for callers that render their own backdrop behind\n // the Modal and don't want a second tint stacked on top.\n background: ", ";\n position: absolute;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100dvh;\n"])), function (_a) {
49
+ var $hideBackdrop = _a.$hideBackdrop;
50
+ return ($hideBackdrop ? "transparent" : black_opacity80);
51
+ });
49
52
  exports.StyledModalLargeContentWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 100%;\n margin-top: 4rem;\n background-color: ", ";\n ", "\n ", " {\n margin-top: 0;\n border: 2px solid ", ";\n width: ", ";\n /* min-height: 50dvh; */\n max-height: 90dvh;\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: 16px;\n margin: 0 auto;\n }\n"], ["\n width: 100%;\n margin-top: 4rem;\n background-color: ", ";\n ", "\n ", " {\n margin-top: 0;\n border: 2px solid ", ";\n width: ", ";\n /* min-height: 50dvh; */\n max-height: 90dvh;\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: 16px;\n margin: 0 auto;\n }\n"])), white, function (_a) {
50
53
  var takeFullScreenOnScroll = _a.takeFullScreenOnScroll;
51
54
  return takeFullScreenOnScroll
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",