@itcase/ui 1.3.14 → 1.3.15
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
4
5
|
var clsx = require('clsx');
|
|
5
6
|
var ReactDrawer = require('react-modern-drawer');
|
|
6
7
|
|
|
@@ -15,14 +16,17 @@ var drawerConfig = {
|
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
18
|
function Drawer(props) {
|
|
18
|
-
var children = props.children, direction = props.direction, isOpenModal = props.isOpenModal, after = props.after, before = props.before, className = props.className,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
var children = props.children, direction = props.direction, isOpenModal = props.isOpenModal, after = props.after, before = props.before, className = props.className, dataTour = props.dataTour, enableOverlay = props.enableOverlay, size = props.size, type = props.type, onClickClose = props.onClickClose, onClose = props.onClose;
|
|
20
|
+
var prevIsOpenModalRef = React.useRef(null);
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
if (onClose && prevIsOpenModalRef.current === true && !isOpenModal) {
|
|
23
|
+
onClose();
|
|
24
|
+
}
|
|
25
|
+
prevIsOpenModalRef.current = Boolean(isOpenModal);
|
|
26
|
+
}, [isOpenModal, onClose]);
|
|
23
27
|
return (jsxRuntime.jsxs(ReactDrawer, { className: clsx('drawer', type && "drawer_type_".concat(type), className, dataTour && "data-tour-".concat(dataTour)), direction: direction || 'right', enableOverlay: enableOverlay, lockBackgroundScroll: false,
|
|
24
28
|
// @ts-expect-error
|
|
25
|
-
open: isOpenModal, overlayClassName: "drawer__overlay", size: size || 600, onClose:
|
|
29
|
+
open: isOpenModal, overlayClassName: "drawer__overlay", size: size || 600, onClose: onClickClose, children: [before && jsxRuntime.jsx("div", { className: "drawer__before", children: before }), children && jsxRuntime.jsx("div", { className: "drawer__wrapper", children: children }), after && jsxRuntime.jsx("div", { className: "drawer__after", children: after })] }));
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
exports.Drawer = Drawer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import ReactDrawer from 'react-modern-drawer';
|
|
4
5
|
|
|
@@ -13,14 +14,17 @@ var drawerConfig = {
|
|
|
13
14
|
},
|
|
14
15
|
};
|
|
15
16
|
function Drawer(props) {
|
|
16
|
-
var children = props.children, direction = props.direction, isOpenModal = props.isOpenModal, after = props.after, before = props.before, className = props.className,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
var children = props.children, direction = props.direction, isOpenModal = props.isOpenModal, after = props.after, before = props.before, className = props.className, dataTour = props.dataTour, enableOverlay = props.enableOverlay, size = props.size, type = props.type, onClickClose = props.onClickClose, onClose = props.onClose;
|
|
18
|
+
var prevIsOpenModalRef = useRef(null);
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
if (onClose && prevIsOpenModalRef.current === true && !isOpenModal) {
|
|
21
|
+
onClose();
|
|
22
|
+
}
|
|
23
|
+
prevIsOpenModalRef.current = Boolean(isOpenModal);
|
|
24
|
+
}, [isOpenModal, onClose]);
|
|
21
25
|
return (jsxs(ReactDrawer, { className: clsx('drawer', type && "drawer_type_".concat(type), className, dataTour && "data-tour-".concat(dataTour)), direction: direction || 'right', enableOverlay: enableOverlay, lockBackgroundScroll: false,
|
|
22
26
|
// @ts-expect-error
|
|
23
|
-
open: isOpenModal, overlayClassName: "drawer__overlay", size: size || 600, onClose:
|
|
27
|
+
open: isOpenModal, overlayClassName: "drawer__overlay", size: size || 600, onClose: onClickClose, children: [before && jsx("div", { className: "drawer__before", children: before }), children && jsx("div", { className: "drawer__wrapper", children: children }), after && jsx("div", { className: "drawer__after", children: after })] }));
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
export { Drawer, drawerAppearance, drawerConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"description": "UI components (Modal, Loader, Popup, etc)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@itcase/icons": "^1.0.18",
|
|
91
91
|
"clsx": "^2.1.1",
|
|
92
92
|
"date-fns": "^4.1.0",
|
|
93
|
-
"framer-motion": "^12.0.
|
|
93
|
+
"framer-motion": "^12.0.1",
|
|
94
94
|
"js-cookie": "^3.0.5",
|
|
95
95
|
"lodash": "^4.17.21",
|
|
96
96
|
"rc-slider": "^11.1.8",
|
|
@@ -121,7 +121,6 @@
|
|
|
121
121
|
"@commitlint/config-conventional": "^19.6.0",
|
|
122
122
|
"@itcase/icons": "^1.0.18",
|
|
123
123
|
"@itcase/lint": "^1.0.36",
|
|
124
|
-
"@itcase/ui": "^1.3.13",
|
|
125
124
|
"@lehoczky/postcss-fluid": "^1.0.3",
|
|
126
125
|
"@rollup/plugin-babel": "^6.0.4",
|
|
127
126
|
"@rollup/plugin-commonjs": "^28.0.2",
|