@alfalab/core-components-base-modal 3.1.0 → 4.0.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/CHANGELOG.md +28 -0
- package/dist/Component.d.ts +6 -0
- package/dist/Component.js +23 -15
- package/dist/cssm/Component.d.ts +6 -0
- package/dist/cssm/Component.js +22 -14
- package/dist/esm/Component.d.ts +6 -0
- package/dist/esm/Component.js +23 -15
- package/dist/esm/index.css +13 -13
- package/dist/index.css +13 -13
- package/dist/modern/Component.d.ts +6 -0
- package/dist/modern/Component.js +17 -9
- package/dist/modern/index.css +13 -13
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-base-modal@3.2.0...@alfalab/core-components-base-modal@4.0.0) (2022-03-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **bottom-sheet:** update-bottom-sheet ([#1025](https://github.com/alfa-laboratory/core-components/issues/1025)) ([26fa9aa](https://github.com/alfa-laboratory/core-components/commit/26fa9aab68bebf0f7093a38bc0f18a9b596ccf37)), closes [#1032](https://github.com/alfa-laboratory/core-components/issues/1032)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **bottom-sheet:** Большое обновление стилей, множество дополнительных настроек
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [3.2.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-base-modal@3.1.0...@alfalab/core-components-base-modal@3.2.0) (2022-03-01)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **base-modal:** add component ref for base modal ([#1008](https://github.com/alfa-laboratory/core-components/issues/1008)) ([fb13dbd](https://github.com/alfa-laboratory/core-components/commit/fb13dbdf6352b10b80a74fa87edfcb1f54b76d5a))
|
|
28
|
+
* Исправить импорты в сторях. ([#998](https://github.com/alfa-laboratory/core-components/issues/998)) ([e6a654a](https://github.com/alfa-laboratory/core-components/commit/e6a654a0599451c7d149484cb61d8067eed083b7))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
6
34
|
# [3.1.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-base-modal@3.0.2...@alfalab/core-components-base-modal@3.1.0) (2022-01-17)
|
|
7
35
|
|
|
8
36
|
|
package/dist/Component.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ type BaseModalProps = {
|
|
|
108
108
|
* z-index компонента
|
|
109
109
|
*/
|
|
110
110
|
zIndex?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Реф, который должен быть установлен компонентной области
|
|
113
|
+
*/
|
|
114
|
+
componentRef?: MutableRefObject<HTMLDivElement | null>;
|
|
111
115
|
};
|
|
112
116
|
type BaseModalContext = {
|
|
113
117
|
hasFooter?: boolean;
|
|
@@ -115,6 +119,8 @@ type BaseModalContext = {
|
|
|
115
119
|
hasScroll?: boolean;
|
|
116
120
|
headerHighlighted?: boolean;
|
|
117
121
|
footerHighlighted?: boolean;
|
|
122
|
+
headerOffset?: number;
|
|
123
|
+
setHeaderOffset: (offset: number) => void;
|
|
118
124
|
contentRef: Ref<HTMLElement>;
|
|
119
125
|
setHasHeader: (exists: boolean) => void;
|
|
120
126
|
setHasFooter: (exists: boolean) => void;
|
package/dist/Component.js
CHANGED
|
@@ -48,7 +48,7 @@ var __assign = function () {
|
|
|
48
48
|
return __assign.apply(this, arguments);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
var styles = {"component":"base-
|
|
51
|
+
var styles = {"component":"base-modal__component_1rup9","wrapper":"base-modal__wrapper_1rup9","content":"base-modal__content_1rup9","hidden":"base-modal__hidden_1rup9","backdrop":"base-modal__backdrop_1rup9","appear":"base-modal__appear_1rup9","enter":"base-modal__enter_1rup9","appearActive":"base-modal__appearActive_1rup9","enterActive":"base-modal__enterActive_1rup9","exit":"base-modal__exit_1rup9","exitActive":"base-modal__exitActive_1rup9","exitDone":"base-modal__exitDone_1rup9"};
|
|
52
52
|
require('./index.css')
|
|
53
53
|
|
|
54
54
|
var BaseModalContext = React__default['default'].createContext({
|
|
@@ -57,20 +57,23 @@ var BaseModalContext = React__default['default'].createContext({
|
|
|
57
57
|
hasScroll: false,
|
|
58
58
|
headerHighlighted: false,
|
|
59
59
|
footerHighlighted: false,
|
|
60
|
+
headerOffset: 0,
|
|
61
|
+
setHeaderOffset: function () { return null; },
|
|
60
62
|
contentRef: function () { return null; },
|
|
61
63
|
setHasHeader: function () { return null; },
|
|
62
64
|
setHasFooter: function () { return null; },
|
|
63
65
|
onClose: function () { return null; },
|
|
64
66
|
});
|
|
65
67
|
var BaseModal = React.forwardRef(function (_a, ref) {
|
|
66
|
-
var open = _a.open, container = _a.container, children = _a.children, _b = _a.scrollHandler, scrollHandler = _b === void 0 ? 'wrapper' : _b, _c = _a.Backdrop, Backdrop = _c === void 0 ? coreComponentsBackdrop.Backdrop : _c, _d = _a.backdropProps, backdropProps = _d === void 0 ? {} : _d, _e = _a.transitionProps, transitionProps = _e === void 0 ? {} : _e, disableBackdropClick = _a.disableBackdropClick, _f = _a.disableAutoFocus, disableAutoFocus = _f === void 0 ? false : _f, _g = _a.disableFocusLock, disableFocusLock = _g === void 0 ? false : _g, _h = _a.disableEscapeKeyDown, disableEscapeKeyDown = _h === void 0 ? false : _h, _j = _a.disableRestoreFocus, disableRestoreFocus = _j === void 0 ? false : _j, _k = _a.keepMounted, keepMounted = _k === void 0 ? false : _k, className = _a.className, contentClassName = _a.contentClassName, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _l = _a.zIndex, zIndex = _l === void 0 ? coreComponentsStack.stackingOrder.MODAL : _l;
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
68
|
+
var open = _a.open, container = _a.container, children = _a.children, _b = _a.scrollHandler, scrollHandler = _b === void 0 ? 'wrapper' : _b, _c = _a.Backdrop, Backdrop = _c === void 0 ? coreComponentsBackdrop.Backdrop : _c, _d = _a.backdropProps, backdropProps = _d === void 0 ? {} : _d, _e = _a.transitionProps, transitionProps = _e === void 0 ? {} : _e, disableBackdropClick = _a.disableBackdropClick, _f = _a.disableAutoFocus, disableAutoFocus = _f === void 0 ? false : _f, _g = _a.disableFocusLock, disableFocusLock = _g === void 0 ? false : _g, _h = _a.disableEscapeKeyDown, disableEscapeKeyDown = _h === void 0 ? false : _h, _j = _a.disableRestoreFocus, disableRestoreFocus = _j === void 0 ? false : _j, _k = _a.keepMounted, keepMounted = _k === void 0 ? false : _k, className = _a.className, contentClassName = _a.contentClassName, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _l = _a.zIndex, zIndex = _l === void 0 ? coreComponentsStack.stackingOrder.MODAL : _l, _m = _a.componentRef, componentRef = _m === void 0 ? null : _m;
|
|
69
|
+
var _o = React.useState(!open), exited = _o[0], setExited = _o[1];
|
|
70
|
+
var _p = React.useState(false), hasScroll = _p[0], setHasScroll = _p[1];
|
|
71
|
+
var _q = React.useState(false), hasHeader = _q[0], setHasHeader = _q[1];
|
|
72
|
+
var _r = React.useState(false), hasFooter = _r[0], setHasFooter = _r[1];
|
|
73
|
+
var _s = React.useState(false), headerHighlighted = _s[0], setHeaderHighlighted = _s[1];
|
|
74
|
+
var _t = React.useState(false), footerHighlighted = _t[0], setFooterHighlighted = _t[1];
|
|
75
|
+
var _u = React.useState(0), headerOffset = _u[0], setHeaderOffset = _u[1];
|
|
76
|
+
var componentNodeRef = React.useRef(null);
|
|
74
77
|
var wrapperRef = React.useRef(null);
|
|
75
78
|
var scrollableNodeRef = React.useRef(null);
|
|
76
79
|
var contentNodeRef = React.useRef(null);
|
|
@@ -104,17 +107,18 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
104
107
|
}
|
|
105
108
|
}, [resizeObserver$1]);
|
|
106
109
|
var handleScroll = React.useCallback(function () {
|
|
107
|
-
if (!scrollableNodeRef.current || !
|
|
110
|
+
if (!scrollableNodeRef.current || !componentNodeRef.current)
|
|
108
111
|
return;
|
|
109
112
|
if (hasHeader) {
|
|
110
113
|
setHeaderHighlighted(!utils.isScrolledToTop(scrollableNodeRef.current) &&
|
|
111
|
-
|
|
114
|
+
componentNodeRef.current.getBoundingClientRect().top - headerOffset <= 0);
|
|
112
115
|
}
|
|
113
116
|
if (hasFooter) {
|
|
114
117
|
setFooterHighlighted(!utils.isScrolledToBottom(scrollableNodeRef.current) &&
|
|
115
|
-
|
|
118
|
+
componentNodeRef.current.getBoundingClientRect().bottom >=
|
|
119
|
+
window.innerHeight);
|
|
116
120
|
}
|
|
117
|
-
}, [hasFooter, hasHeader]);
|
|
121
|
+
}, [hasFooter, hasHeader, headerOffset]);
|
|
118
122
|
var handleClose = React.useCallback(function (event, reason) {
|
|
119
123
|
if (onClose) {
|
|
120
124
|
onClose(event, reason);
|
|
@@ -150,7 +154,7 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
150
154
|
if (scrollHandler === 'wrapper')
|
|
151
155
|
return wrapperRef.current;
|
|
152
156
|
if (scrollHandler === 'content')
|
|
153
|
-
return
|
|
157
|
+
return componentNodeRef.current;
|
|
154
158
|
return scrollHandler.current || wrapperRef.current;
|
|
155
159
|
}, [scrollHandler]);
|
|
156
160
|
var handleEntered = React.useCallback(function (node, isAppearing) {
|
|
@@ -209,6 +213,8 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
209
213
|
hasScroll: hasScroll,
|
|
210
214
|
headerHighlighted: headerHighlighted,
|
|
211
215
|
footerHighlighted: footerHighlighted,
|
|
216
|
+
headerOffset: headerOffset,
|
|
217
|
+
setHeaderOffset: setHeaderOffset,
|
|
212
218
|
contentRef: contentRef,
|
|
213
219
|
setHasHeader: setHasHeader,
|
|
214
220
|
setHasFooter: setHasFooter,
|
|
@@ -220,6 +226,8 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
220
226
|
hasScroll,
|
|
221
227
|
headerHighlighted,
|
|
222
228
|
footerHighlighted,
|
|
229
|
+
headerOffset,
|
|
230
|
+
setHeaderOffset,
|
|
223
231
|
handleClose,
|
|
224
232
|
]);
|
|
225
233
|
if (!shouldRender)
|
|
@@ -238,7 +246,7 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
238
246
|
zIndex: computedZIndex,
|
|
239
247
|
} },
|
|
240
248
|
React__default['default'].createElement(reactTransitionGroup.CSSTransition, __assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
241
|
-
React__default['default'].createElement("div", { className: cn__default['default'](styles.component, className), ref: componentRef },
|
|
249
|
+
React__default['default'].createElement("div", { className: cn__default['default'](styles.component, className), ref: mergeRefs__default['default']([componentRef, componentNodeRef]) },
|
|
242
250
|
React__default['default'].createElement("div", { className: cn__default['default'](styles.content, contentClassName) }, children))))))));
|
|
243
251
|
}));
|
|
244
252
|
});
|
package/dist/cssm/Component.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ type BaseModalProps = {
|
|
|
108
108
|
* z-index компонента
|
|
109
109
|
*/
|
|
110
110
|
zIndex?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Реф, который должен быть установлен компонентной области
|
|
113
|
+
*/
|
|
114
|
+
componentRef?: MutableRefObject<HTMLDivElement | null>;
|
|
111
115
|
};
|
|
112
116
|
type BaseModalContext = {
|
|
113
117
|
hasFooter?: boolean;
|
|
@@ -115,6 +119,8 @@ type BaseModalContext = {
|
|
|
115
119
|
hasScroll?: boolean;
|
|
116
120
|
headerHighlighted?: boolean;
|
|
117
121
|
footerHighlighted?: boolean;
|
|
122
|
+
headerOffset?: number;
|
|
123
|
+
setHeaderOffset: (offset: number) => void;
|
|
118
124
|
contentRef: Ref<HTMLElement>;
|
|
119
125
|
setHasHeader: (exists: boolean) => void;
|
|
120
126
|
setHasFooter: (exists: boolean) => void;
|
package/dist/cssm/Component.js
CHANGED
|
@@ -56,20 +56,23 @@ var BaseModalContext = React__default['default'].createContext({
|
|
|
56
56
|
hasScroll: false,
|
|
57
57
|
headerHighlighted: false,
|
|
58
58
|
footerHighlighted: false,
|
|
59
|
+
headerOffset: 0,
|
|
60
|
+
setHeaderOffset: function () { return null; },
|
|
59
61
|
contentRef: function () { return null; },
|
|
60
62
|
setHasHeader: function () { return null; },
|
|
61
63
|
setHasFooter: function () { return null; },
|
|
62
64
|
onClose: function () { return null; },
|
|
63
65
|
});
|
|
64
66
|
var BaseModal = React.forwardRef(function (_a, ref) {
|
|
65
|
-
var open = _a.open, container = _a.container, children = _a.children, _b = _a.scrollHandler, scrollHandler = _b === void 0 ? 'wrapper' : _b, _c = _a.Backdrop, Backdrop = _c === void 0 ? coreComponentsBackdrop.Backdrop : _c, _d = _a.backdropProps, backdropProps = _d === void 0 ? {} : _d, _e = _a.transitionProps, transitionProps = _e === void 0 ? {} : _e, disableBackdropClick = _a.disableBackdropClick, _f = _a.disableAutoFocus, disableAutoFocus = _f === void 0 ? false : _f, _g = _a.disableFocusLock, disableFocusLock = _g === void 0 ? false : _g, _h = _a.disableEscapeKeyDown, disableEscapeKeyDown = _h === void 0 ? false : _h, _j = _a.disableRestoreFocus, disableRestoreFocus = _j === void 0 ? false : _j, _k = _a.keepMounted, keepMounted = _k === void 0 ? false : _k, className = _a.className, contentClassName = _a.contentClassName, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _l = _a.zIndex, zIndex = _l === void 0 ? coreComponentsStack.stackingOrder.MODAL : _l;
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
67
|
+
var open = _a.open, container = _a.container, children = _a.children, _b = _a.scrollHandler, scrollHandler = _b === void 0 ? 'wrapper' : _b, _c = _a.Backdrop, Backdrop = _c === void 0 ? coreComponentsBackdrop.Backdrop : _c, _d = _a.backdropProps, backdropProps = _d === void 0 ? {} : _d, _e = _a.transitionProps, transitionProps = _e === void 0 ? {} : _e, disableBackdropClick = _a.disableBackdropClick, _f = _a.disableAutoFocus, disableAutoFocus = _f === void 0 ? false : _f, _g = _a.disableFocusLock, disableFocusLock = _g === void 0 ? false : _g, _h = _a.disableEscapeKeyDown, disableEscapeKeyDown = _h === void 0 ? false : _h, _j = _a.disableRestoreFocus, disableRestoreFocus = _j === void 0 ? false : _j, _k = _a.keepMounted, keepMounted = _k === void 0 ? false : _k, className = _a.className, contentClassName = _a.contentClassName, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _l = _a.zIndex, zIndex = _l === void 0 ? coreComponentsStack.stackingOrder.MODAL : _l, _m = _a.componentRef, componentRef = _m === void 0 ? null : _m;
|
|
68
|
+
var _o = React.useState(!open), exited = _o[0], setExited = _o[1];
|
|
69
|
+
var _p = React.useState(false), hasScroll = _p[0], setHasScroll = _p[1];
|
|
70
|
+
var _q = React.useState(false), hasHeader = _q[0], setHasHeader = _q[1];
|
|
71
|
+
var _r = React.useState(false), hasFooter = _r[0], setHasFooter = _r[1];
|
|
72
|
+
var _s = React.useState(false), headerHighlighted = _s[0], setHeaderHighlighted = _s[1];
|
|
73
|
+
var _t = React.useState(false), footerHighlighted = _t[0], setFooterHighlighted = _t[1];
|
|
74
|
+
var _u = React.useState(0), headerOffset = _u[0], setHeaderOffset = _u[1];
|
|
75
|
+
var componentNodeRef = React.useRef(null);
|
|
73
76
|
var wrapperRef = React.useRef(null);
|
|
74
77
|
var scrollableNodeRef = React.useRef(null);
|
|
75
78
|
var contentNodeRef = React.useRef(null);
|
|
@@ -103,17 +106,18 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
103
106
|
}
|
|
104
107
|
}, [resizeObserver$1]);
|
|
105
108
|
var handleScroll = React.useCallback(function () {
|
|
106
|
-
if (!scrollableNodeRef.current || !
|
|
109
|
+
if (!scrollableNodeRef.current || !componentNodeRef.current)
|
|
107
110
|
return;
|
|
108
111
|
if (hasHeader) {
|
|
109
112
|
setHeaderHighlighted(!utils.isScrolledToTop(scrollableNodeRef.current) &&
|
|
110
|
-
|
|
113
|
+
componentNodeRef.current.getBoundingClientRect().top - headerOffset <= 0);
|
|
111
114
|
}
|
|
112
115
|
if (hasFooter) {
|
|
113
116
|
setFooterHighlighted(!utils.isScrolledToBottom(scrollableNodeRef.current) &&
|
|
114
|
-
|
|
117
|
+
componentNodeRef.current.getBoundingClientRect().bottom >=
|
|
118
|
+
window.innerHeight);
|
|
115
119
|
}
|
|
116
|
-
}, [hasFooter, hasHeader]);
|
|
120
|
+
}, [hasFooter, hasHeader, headerOffset]);
|
|
117
121
|
var handleClose = React.useCallback(function (event, reason) {
|
|
118
122
|
if (onClose) {
|
|
119
123
|
onClose(event, reason);
|
|
@@ -149,7 +153,7 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
149
153
|
if (scrollHandler === 'wrapper')
|
|
150
154
|
return wrapperRef.current;
|
|
151
155
|
if (scrollHandler === 'content')
|
|
152
|
-
return
|
|
156
|
+
return componentNodeRef.current;
|
|
153
157
|
return scrollHandler.current || wrapperRef.current;
|
|
154
158
|
}, [scrollHandler]);
|
|
155
159
|
var handleEntered = React.useCallback(function (node, isAppearing) {
|
|
@@ -208,6 +212,8 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
208
212
|
hasScroll: hasScroll,
|
|
209
213
|
headerHighlighted: headerHighlighted,
|
|
210
214
|
footerHighlighted: footerHighlighted,
|
|
215
|
+
headerOffset: headerOffset,
|
|
216
|
+
setHeaderOffset: setHeaderOffset,
|
|
211
217
|
contentRef: contentRef,
|
|
212
218
|
setHasHeader: setHasHeader,
|
|
213
219
|
setHasFooter: setHasFooter,
|
|
@@ -219,6 +225,8 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
219
225
|
hasScroll,
|
|
220
226
|
headerHighlighted,
|
|
221
227
|
footerHighlighted,
|
|
228
|
+
headerOffset,
|
|
229
|
+
setHeaderOffset,
|
|
222
230
|
handleClose,
|
|
223
231
|
]);
|
|
224
232
|
if (!shouldRender)
|
|
@@ -237,7 +245,7 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
237
245
|
zIndex: computedZIndex,
|
|
238
246
|
} },
|
|
239
247
|
React__default['default'].createElement(reactTransitionGroup.CSSTransition, __assign({ appear: true, timeout: 200, classNames: styles__default['default'] }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
240
|
-
React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, className), ref: componentRef },
|
|
248
|
+
React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, className), ref: mergeRefs__default['default']([componentRef, componentNodeRef]) },
|
|
241
249
|
React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].content, contentClassName) }, children))))))));
|
|
242
250
|
}));
|
|
243
251
|
});
|
package/dist/esm/Component.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ type BaseModalProps = {
|
|
|
108
108
|
* z-index компонента
|
|
109
109
|
*/
|
|
110
110
|
zIndex?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Реф, который должен быть установлен компонентной области
|
|
113
|
+
*/
|
|
114
|
+
componentRef?: MutableRefObject<HTMLDivElement | null>;
|
|
111
115
|
};
|
|
112
116
|
type BaseModalContext = {
|
|
113
117
|
hasFooter?: boolean;
|
|
@@ -115,6 +119,8 @@ type BaseModalContext = {
|
|
|
115
119
|
hasScroll?: boolean;
|
|
116
120
|
headerHighlighted?: boolean;
|
|
117
121
|
footerHighlighted?: boolean;
|
|
122
|
+
headerOffset?: number;
|
|
123
|
+
setHeaderOffset: (offset: number) => void;
|
|
118
124
|
contentRef: Ref<HTMLElement>;
|
|
119
125
|
setHasHeader: (exists: boolean) => void;
|
|
120
126
|
setHasFooter: (exists: boolean) => void;
|
package/dist/esm/Component.js
CHANGED
|
@@ -37,7 +37,7 @@ var __assign = function () {
|
|
|
37
37
|
return __assign.apply(this, arguments);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
var styles = {"component":"base-
|
|
40
|
+
var styles = {"component":"base-modal__component_1rup9","wrapper":"base-modal__wrapper_1rup9","content":"base-modal__content_1rup9","hidden":"base-modal__hidden_1rup9","backdrop":"base-modal__backdrop_1rup9","appear":"base-modal__appear_1rup9","enter":"base-modal__enter_1rup9","appearActive":"base-modal__appearActive_1rup9","enterActive":"base-modal__enterActive_1rup9","exit":"base-modal__exit_1rup9","exitActive":"base-modal__exitActive_1rup9","exitDone":"base-modal__exitDone_1rup9"};
|
|
41
41
|
require('./index.css')
|
|
42
42
|
|
|
43
43
|
var BaseModalContext = React.createContext({
|
|
@@ -46,20 +46,23 @@ var BaseModalContext = React.createContext({
|
|
|
46
46
|
hasScroll: false,
|
|
47
47
|
headerHighlighted: false,
|
|
48
48
|
footerHighlighted: false,
|
|
49
|
+
headerOffset: 0,
|
|
50
|
+
setHeaderOffset: function () { return null; },
|
|
49
51
|
contentRef: function () { return null; },
|
|
50
52
|
setHasHeader: function () { return null; },
|
|
51
53
|
setHasFooter: function () { return null; },
|
|
52
54
|
onClose: function () { return null; },
|
|
53
55
|
});
|
|
54
56
|
var BaseModal = forwardRef(function (_a, ref) {
|
|
55
|
-
var open = _a.open, container = _a.container, children = _a.children, _b = _a.scrollHandler, scrollHandler = _b === void 0 ? 'wrapper' : _b, _c = _a.Backdrop, Backdrop$1 = _c === void 0 ? Backdrop : _c, _d = _a.backdropProps, backdropProps = _d === void 0 ? {} : _d, _e = _a.transitionProps, transitionProps = _e === void 0 ? {} : _e, disableBackdropClick = _a.disableBackdropClick, _f = _a.disableAutoFocus, disableAutoFocus = _f === void 0 ? false : _f, _g = _a.disableFocusLock, disableFocusLock = _g === void 0 ? false : _g, _h = _a.disableEscapeKeyDown, disableEscapeKeyDown = _h === void 0 ? false : _h, _j = _a.disableRestoreFocus, disableRestoreFocus = _j === void 0 ? false : _j, _k = _a.keepMounted, keepMounted = _k === void 0 ? false : _k, className = _a.className, contentClassName = _a.contentClassName, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _l = _a.zIndex, zIndex = _l === void 0 ? stackingOrder.MODAL : _l;
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var
|
|
57
|
+
var open = _a.open, container = _a.container, children = _a.children, _b = _a.scrollHandler, scrollHandler = _b === void 0 ? 'wrapper' : _b, _c = _a.Backdrop, Backdrop$1 = _c === void 0 ? Backdrop : _c, _d = _a.backdropProps, backdropProps = _d === void 0 ? {} : _d, _e = _a.transitionProps, transitionProps = _e === void 0 ? {} : _e, disableBackdropClick = _a.disableBackdropClick, _f = _a.disableAutoFocus, disableAutoFocus = _f === void 0 ? false : _f, _g = _a.disableFocusLock, disableFocusLock = _g === void 0 ? false : _g, _h = _a.disableEscapeKeyDown, disableEscapeKeyDown = _h === void 0 ? false : _h, _j = _a.disableRestoreFocus, disableRestoreFocus = _j === void 0 ? false : _j, _k = _a.keepMounted, keepMounted = _k === void 0 ? false : _k, className = _a.className, contentClassName = _a.contentClassName, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _l = _a.zIndex, zIndex = _l === void 0 ? stackingOrder.MODAL : _l, _m = _a.componentRef, componentRef = _m === void 0 ? null : _m;
|
|
58
|
+
var _o = useState(!open), exited = _o[0], setExited = _o[1];
|
|
59
|
+
var _p = useState(false), hasScroll = _p[0], setHasScroll = _p[1];
|
|
60
|
+
var _q = useState(false), hasHeader = _q[0], setHasHeader = _q[1];
|
|
61
|
+
var _r = useState(false), hasFooter = _r[0], setHasFooter = _r[1];
|
|
62
|
+
var _s = useState(false), headerHighlighted = _s[0], setHeaderHighlighted = _s[1];
|
|
63
|
+
var _t = useState(false), footerHighlighted = _t[0], setFooterHighlighted = _t[1];
|
|
64
|
+
var _u = useState(0), headerOffset = _u[0], setHeaderOffset = _u[1];
|
|
65
|
+
var componentNodeRef = useRef(null);
|
|
63
66
|
var wrapperRef = useRef(null);
|
|
64
67
|
var scrollableNodeRef = useRef(null);
|
|
65
68
|
var contentNodeRef = useRef(null);
|
|
@@ -93,17 +96,18 @@ var BaseModal = forwardRef(function (_a, ref) {
|
|
|
93
96
|
}
|
|
94
97
|
}, [resizeObserver]);
|
|
95
98
|
var handleScroll = useCallback(function () {
|
|
96
|
-
if (!scrollableNodeRef.current || !
|
|
99
|
+
if (!scrollableNodeRef.current || !componentNodeRef.current)
|
|
97
100
|
return;
|
|
98
101
|
if (hasHeader) {
|
|
99
102
|
setHeaderHighlighted(!isScrolledToTop(scrollableNodeRef.current) &&
|
|
100
|
-
|
|
103
|
+
componentNodeRef.current.getBoundingClientRect().top - headerOffset <= 0);
|
|
101
104
|
}
|
|
102
105
|
if (hasFooter) {
|
|
103
106
|
setFooterHighlighted(!isScrolledToBottom(scrollableNodeRef.current) &&
|
|
104
|
-
|
|
107
|
+
componentNodeRef.current.getBoundingClientRect().bottom >=
|
|
108
|
+
window.innerHeight);
|
|
105
109
|
}
|
|
106
|
-
}, [hasFooter, hasHeader]);
|
|
110
|
+
}, [hasFooter, hasHeader, headerOffset]);
|
|
107
111
|
var handleClose = useCallback(function (event, reason) {
|
|
108
112
|
if (onClose) {
|
|
109
113
|
onClose(event, reason);
|
|
@@ -139,7 +143,7 @@ var BaseModal = forwardRef(function (_a, ref) {
|
|
|
139
143
|
if (scrollHandler === 'wrapper')
|
|
140
144
|
return wrapperRef.current;
|
|
141
145
|
if (scrollHandler === 'content')
|
|
142
|
-
return
|
|
146
|
+
return componentNodeRef.current;
|
|
143
147
|
return scrollHandler.current || wrapperRef.current;
|
|
144
148
|
}, [scrollHandler]);
|
|
145
149
|
var handleEntered = useCallback(function (node, isAppearing) {
|
|
@@ -198,6 +202,8 @@ var BaseModal = forwardRef(function (_a, ref) {
|
|
|
198
202
|
hasScroll: hasScroll,
|
|
199
203
|
headerHighlighted: headerHighlighted,
|
|
200
204
|
footerHighlighted: footerHighlighted,
|
|
205
|
+
headerOffset: headerOffset,
|
|
206
|
+
setHeaderOffset: setHeaderOffset,
|
|
201
207
|
contentRef: contentRef,
|
|
202
208
|
setHasHeader: setHasHeader,
|
|
203
209
|
setHasFooter: setHasFooter,
|
|
@@ -209,6 +215,8 @@ var BaseModal = forwardRef(function (_a, ref) {
|
|
|
209
215
|
hasScroll,
|
|
210
216
|
headerHighlighted,
|
|
211
217
|
footerHighlighted,
|
|
218
|
+
headerOffset,
|
|
219
|
+
setHeaderOffset,
|
|
212
220
|
handleClose,
|
|
213
221
|
]);
|
|
214
222
|
if (!shouldRender)
|
|
@@ -227,7 +235,7 @@ var BaseModal = forwardRef(function (_a, ref) {
|
|
|
227
235
|
zIndex: computedZIndex,
|
|
228
236
|
} },
|
|
229
237
|
React.createElement(CSSTransition, __assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
230
|
-
React.createElement("div", { className: cn(styles.component, className), ref: componentRef },
|
|
238
|
+
React.createElement("div", { className: cn(styles.component, className), ref: mergeRefs([componentRef, componentNodeRef]) },
|
|
231
239
|
React.createElement("div", { className: cn(styles.content, contentClassName) }, children))))))));
|
|
232
240
|
}));
|
|
233
241
|
});
|
package/dist/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1shy2 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
}
|
|
13
|
-
.base-
|
|
13
|
+
.base-modal__component_1rup9 {
|
|
14
14
|
position: relative;
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
background: var(--color-light-bg-primary);
|
|
17
17
|
margin: auto;
|
|
18
18
|
flex-shrink: 0;
|
|
19
19
|
}
|
|
20
|
-
.base-
|
|
20
|
+
.base-modal__wrapper_1rup9 {
|
|
21
21
|
position: fixed;
|
|
22
22
|
top: 0;
|
|
23
23
|
left: 0;
|
|
@@ -30,33 +30,33 @@
|
|
|
30
30
|
align-items: center;
|
|
31
31
|
outline: 0;
|
|
32
32
|
}
|
|
33
|
-
.base-
|
|
33
|
+
.base-modal__content_1rup9 {
|
|
34
34
|
width: 100%;
|
|
35
35
|
height: 100%;
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: column;
|
|
38
38
|
flex: 1;
|
|
39
39
|
}
|
|
40
|
-
.base-
|
|
40
|
+
.base-modal__hidden_1rup9 {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
.base-
|
|
43
|
+
.base-modal__backdrop_1rup9 {
|
|
44
44
|
z-index: 0;
|
|
45
45
|
}
|
|
46
|
-
.base-
|
|
47
|
-
.base-
|
|
46
|
+
.base-modal__appear_1rup9,
|
|
47
|
+
.base-modal__enter_1rup9 {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
50
|
-
.base-
|
|
51
|
-
.base-
|
|
50
|
+
.base-modal__appearActive_1rup9,
|
|
51
|
+
.base-modal__enterActive_1rup9 {
|
|
52
52
|
opacity: 1;
|
|
53
53
|
transition: opacity 200ms ease-in;
|
|
54
54
|
}
|
|
55
|
-
.base-
|
|
55
|
+
.base-modal__exit_1rup9 {
|
|
56
56
|
opacity: 1;
|
|
57
57
|
}
|
|
58
|
-
.base-
|
|
59
|
-
.base-
|
|
58
|
+
.base-modal__exitActive_1rup9,
|
|
59
|
+
.base-modal__exitDone_1rup9 {
|
|
60
60
|
opacity: 0;
|
|
61
61
|
transition: opacity 200ms ease-out;
|
|
62
62
|
}
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1shy2 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
}
|
|
13
|
-
.base-
|
|
13
|
+
.base-modal__component_1rup9 {
|
|
14
14
|
position: relative;
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
background: var(--color-light-bg-primary);
|
|
17
17
|
margin: auto;
|
|
18
18
|
flex-shrink: 0;
|
|
19
19
|
}
|
|
20
|
-
.base-
|
|
20
|
+
.base-modal__wrapper_1rup9 {
|
|
21
21
|
position: fixed;
|
|
22
22
|
top: 0;
|
|
23
23
|
left: 0;
|
|
@@ -30,33 +30,33 @@
|
|
|
30
30
|
align-items: center;
|
|
31
31
|
outline: 0;
|
|
32
32
|
}
|
|
33
|
-
.base-
|
|
33
|
+
.base-modal__content_1rup9 {
|
|
34
34
|
width: 100%;
|
|
35
35
|
height: 100%;
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: column;
|
|
38
38
|
flex: 1;
|
|
39
39
|
}
|
|
40
|
-
.base-
|
|
40
|
+
.base-modal__hidden_1rup9 {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
.base-
|
|
43
|
+
.base-modal__backdrop_1rup9 {
|
|
44
44
|
z-index: 0;
|
|
45
45
|
}
|
|
46
|
-
.base-
|
|
47
|
-
.base-
|
|
46
|
+
.base-modal__appear_1rup9,
|
|
47
|
+
.base-modal__enter_1rup9 {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
50
|
-
.base-
|
|
51
|
-
.base-
|
|
50
|
+
.base-modal__appearActive_1rup9,
|
|
51
|
+
.base-modal__enterActive_1rup9 {
|
|
52
52
|
opacity: 1;
|
|
53
53
|
transition: opacity 200ms ease-in;
|
|
54
54
|
}
|
|
55
|
-
.base-
|
|
55
|
+
.base-modal__exit_1rup9 {
|
|
56
56
|
opacity: 1;
|
|
57
57
|
}
|
|
58
|
-
.base-
|
|
59
|
-
.base-
|
|
58
|
+
.base-modal__exitActive_1rup9,
|
|
59
|
+
.base-modal__exitDone_1rup9 {
|
|
60
60
|
opacity: 0;
|
|
61
61
|
transition: opacity 200ms ease-out;
|
|
62
62
|
}
|
|
@@ -108,6 +108,10 @@ type BaseModalProps = {
|
|
|
108
108
|
* z-index компонента
|
|
109
109
|
*/
|
|
110
110
|
zIndex?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Реф, который должен быть установлен компонентной области
|
|
113
|
+
*/
|
|
114
|
+
componentRef?: MutableRefObject<HTMLDivElement | null>;
|
|
111
115
|
};
|
|
112
116
|
type BaseModalContext = {
|
|
113
117
|
hasFooter?: boolean;
|
|
@@ -115,6 +119,8 @@ type BaseModalContext = {
|
|
|
115
119
|
hasScroll?: boolean;
|
|
116
120
|
headerHighlighted?: boolean;
|
|
117
121
|
footerHighlighted?: boolean;
|
|
122
|
+
headerOffset?: number;
|
|
123
|
+
setHeaderOffset: (offset: number) => void;
|
|
118
124
|
contentRef: Ref<HTMLElement>;
|
|
119
125
|
setHasHeader: (exists: boolean) => void;
|
|
120
126
|
setHasFooter: (exists: boolean) => void;
|
package/dist/modern/Component.js
CHANGED
|
@@ -10,7 +10,7 @@ import { stackingOrder, Stack } from '@alfalab/core-components-stack/dist/modern
|
|
|
10
10
|
import '@alfalab/core-components-global-store/dist/modern';
|
|
11
11
|
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js';
|
|
12
12
|
|
|
13
|
-
var styles = {"component":"base-
|
|
13
|
+
var styles = {"component":"base-modal__component_1rup9","wrapper":"base-modal__wrapper_1rup9","content":"base-modal__content_1rup9","hidden":"base-modal__hidden_1rup9","backdrop":"base-modal__backdrop_1rup9","appear":"base-modal__appear_1rup9","enter":"base-modal__enter_1rup9","appearActive":"base-modal__appearActive_1rup9","enterActive":"base-modal__enterActive_1rup9","exit":"base-modal__exit_1rup9","exitActive":"base-modal__exitActive_1rup9","exitDone":"base-modal__exitDone_1rup9"};
|
|
14
14
|
require('./index.css')
|
|
15
15
|
|
|
16
16
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
@@ -20,19 +20,22 @@ const BaseModalContext = React.createContext({
|
|
|
20
20
|
hasScroll: false,
|
|
21
21
|
headerHighlighted: false,
|
|
22
22
|
footerHighlighted: false,
|
|
23
|
+
headerOffset: 0,
|
|
24
|
+
setHeaderOffset: () => null,
|
|
23
25
|
contentRef: () => null,
|
|
24
26
|
setHasHeader: () => null,
|
|
25
27
|
setHasFooter: () => null,
|
|
26
28
|
onClose: () => null,
|
|
27
29
|
});
|
|
28
|
-
const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrapper', Backdrop: Backdrop$1 = Backdrop, backdropProps = {}, transitionProps = {}, disableBackdropClick, disableAutoFocus = false, disableFocusLock = false, disableEscapeKeyDown = false, disableRestoreFocus = false, keepMounted = false, className, contentClassName, wrapperClassName, onBackdropClick, onClose, onEscapeKeyDown, onMount, onUnmount, dataTestId, zIndex = stackingOrder.MODAL, }, ref) => {
|
|
30
|
+
const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrapper', Backdrop: Backdrop$1 = Backdrop, backdropProps = {}, transitionProps = {}, disableBackdropClick, disableAutoFocus = false, disableFocusLock = false, disableEscapeKeyDown = false, disableRestoreFocus = false, keepMounted = false, className, contentClassName, wrapperClassName, onBackdropClick, onClose, onEscapeKeyDown, onMount, onUnmount, dataTestId, zIndex = stackingOrder.MODAL, componentRef = null, }, ref) => {
|
|
29
31
|
const [exited, setExited] = useState(!open);
|
|
30
32
|
const [hasScroll, setHasScroll] = useState(false);
|
|
31
33
|
const [hasHeader, setHasHeader] = useState(false);
|
|
32
34
|
const [hasFooter, setHasFooter] = useState(false);
|
|
33
35
|
const [headerHighlighted, setHeaderHighlighted] = useState(false);
|
|
34
36
|
const [footerHighlighted, setFooterHighlighted] = useState(false);
|
|
35
|
-
const
|
|
37
|
+
const [headerOffset, setHeaderOffset] = useState(0);
|
|
38
|
+
const componentNodeRef = useRef(null);
|
|
36
39
|
const wrapperRef = useRef(null);
|
|
37
40
|
const scrollableNodeRef = useRef(null);
|
|
38
41
|
const contentNodeRef = useRef(null);
|
|
@@ -66,17 +69,18 @@ const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrap
|
|
|
66
69
|
}
|
|
67
70
|
}, [resizeObserver]);
|
|
68
71
|
const handleScroll = useCallback(() => {
|
|
69
|
-
if (!scrollableNodeRef.current || !
|
|
72
|
+
if (!scrollableNodeRef.current || !componentNodeRef.current)
|
|
70
73
|
return;
|
|
71
74
|
if (hasHeader) {
|
|
72
75
|
setHeaderHighlighted(!isScrolledToTop(scrollableNodeRef.current) &&
|
|
73
|
-
|
|
76
|
+
componentNodeRef.current.getBoundingClientRect().top - headerOffset <= 0);
|
|
74
77
|
}
|
|
75
78
|
if (hasFooter) {
|
|
76
79
|
setFooterHighlighted(!isScrolledToBottom(scrollableNodeRef.current) &&
|
|
77
|
-
|
|
80
|
+
componentNodeRef.current.getBoundingClientRect().bottom >=
|
|
81
|
+
window.innerHeight);
|
|
78
82
|
}
|
|
79
|
-
}, [hasFooter, hasHeader]);
|
|
83
|
+
}, [hasFooter, hasHeader, headerOffset]);
|
|
80
84
|
const handleClose = useCallback((event, reason) => {
|
|
81
85
|
if (onClose) {
|
|
82
86
|
onClose(event, reason);
|
|
@@ -112,7 +116,7 @@ const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrap
|
|
|
112
116
|
if (scrollHandler === 'wrapper')
|
|
113
117
|
return wrapperRef.current;
|
|
114
118
|
if (scrollHandler === 'content')
|
|
115
|
-
return
|
|
119
|
+
return componentNodeRef.current;
|
|
116
120
|
return scrollHandler.current || wrapperRef.current;
|
|
117
121
|
}, [scrollHandler]);
|
|
118
122
|
const handleEntered = useCallback((node, isAppearing) => {
|
|
@@ -171,6 +175,8 @@ const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrap
|
|
|
171
175
|
hasScroll,
|
|
172
176
|
headerHighlighted,
|
|
173
177
|
footerHighlighted,
|
|
178
|
+
headerOffset,
|
|
179
|
+
setHeaderOffset,
|
|
174
180
|
contentRef,
|
|
175
181
|
setHasHeader,
|
|
176
182
|
setHasFooter,
|
|
@@ -182,6 +188,8 @@ const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrap
|
|
|
182
188
|
hasScroll,
|
|
183
189
|
headerHighlighted,
|
|
184
190
|
footerHighlighted,
|
|
191
|
+
headerOffset,
|
|
192
|
+
setHeaderOffset,
|
|
185
193
|
handleClose,
|
|
186
194
|
]);
|
|
187
195
|
if (!shouldRender)
|
|
@@ -198,7 +206,7 @@ const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrap
|
|
|
198
206
|
zIndex: computedZIndex,
|
|
199
207
|
} },
|
|
200
208
|
React.createElement(CSSTransition, Object.assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
201
|
-
React.createElement("div", { className: cn(styles.component, className), ref: componentRef },
|
|
209
|
+
React.createElement("div", { className: cn(styles.component, className), ref: mergeRefs([componentRef, componentNodeRef]) },
|
|
202
210
|
React.createElement("div", { className: cn(styles.content, contentClassName) }, children))))))))));
|
|
203
211
|
});
|
|
204
212
|
|
package/dist/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1shy2 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
}
|
|
13
|
-
.base-
|
|
13
|
+
.base-modal__component_1rup9 {
|
|
14
14
|
position: relative;
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
background: var(--color-light-bg-primary);
|
|
17
17
|
margin: auto;
|
|
18
18
|
flex-shrink: 0;
|
|
19
19
|
}
|
|
20
|
-
.base-
|
|
20
|
+
.base-modal__wrapper_1rup9 {
|
|
21
21
|
position: fixed;
|
|
22
22
|
top: 0;
|
|
23
23
|
left: 0;
|
|
@@ -30,33 +30,33 @@
|
|
|
30
30
|
align-items: center;
|
|
31
31
|
outline: 0;
|
|
32
32
|
}
|
|
33
|
-
.base-
|
|
33
|
+
.base-modal__content_1rup9 {
|
|
34
34
|
width: 100%;
|
|
35
35
|
height: 100%;
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: column;
|
|
38
38
|
flex: 1;
|
|
39
39
|
}
|
|
40
|
-
.base-
|
|
40
|
+
.base-modal__hidden_1rup9 {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
.base-
|
|
43
|
+
.base-modal__backdrop_1rup9 {
|
|
44
44
|
z-index: 0;
|
|
45
45
|
}
|
|
46
|
-
.base-
|
|
47
|
-
.base-
|
|
46
|
+
.base-modal__appear_1rup9,
|
|
47
|
+
.base-modal__enter_1rup9 {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
50
|
-
.base-
|
|
51
|
-
.base-
|
|
50
|
+
.base-modal__appearActive_1rup9,
|
|
51
|
+
.base-modal__enterActive_1rup9 {
|
|
52
52
|
opacity: 1;
|
|
53
53
|
transition: opacity 200ms ease-in;
|
|
54
54
|
}
|
|
55
|
-
.base-
|
|
55
|
+
.base-modal__exit_1rup9 {
|
|
56
56
|
opacity: 1;
|
|
57
57
|
}
|
|
58
|
-
.base-
|
|
59
|
-
.base-
|
|
58
|
+
.base-modal__exitActive_1rup9,
|
|
59
|
+
.base-modal__exitDone_1rup9 {
|
|
60
60
|
opacity: 0;
|
|
61
61
|
transition: opacity 200ms ease-out;
|
|
62
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-base-modal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "BaseModal component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alfalab/core-components-backdrop": "^2.0.
|
|
18
|
+
"@alfalab/core-components-backdrop": "^2.0.2",
|
|
19
19
|
"@alfalab/core-components-global-store": "^1.1.0",
|
|
20
20
|
"@alfalab/core-components-portal": "^2.0.1",
|
|
21
21
|
"@alfalab/core-components-stack": "^3.0.1",
|
|
22
|
-
"classnames": "
|
|
23
|
-
"react-focus-lock": "
|
|
24
|
-
"react-merge-refs": "
|
|
25
|
-
"react-transition-group": "
|
|
26
|
-
"resize-observer": "
|
|
22
|
+
"classnames": "2.2.6",
|
|
23
|
+
"react-focus-lock": "2.5.0",
|
|
24
|
+
"react-merge-refs": "1.1.0",
|
|
25
|
+
"react-transition-group": "4.4.1",
|
|
26
|
+
"resize-observer": "1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/react-transition-group": "^4.2.4"
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^16.9.0 || ^17.0.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "0363f194b7d8e6d2949795b8f0570262d7028aff"
|
|
35
35
|
}
|