@alfalab/core-components-base-modal 5.3.0 → 5.4.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.
- package/Component.d.ts +9 -1
- package/Component.js +8 -4
- package/cssm/Component.d.ts +9 -1
- package/cssm/Component.js +7 -3
- package/esm/Component.d.ts +9 -1
- package/esm/Component.js +8 -4
- package/esm/index.css +13 -13
- package/index.css +13 -13
- package/modern/Component.d.ts +9 -1
- package/modern/Component.js +8 -4
- package/modern/index.css +13 -13
- package/package.json +1 -1
- package/src/Component.tsx +34 -3
package/Component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react-transition-group" />
|
|
2
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react-transition-group" />
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react";
|
|
5
5
|
import { TransitionProps } from 'react-transition-group/Transition';
|
|
@@ -71,6 +71,14 @@ type BaseModalProps = {
|
|
|
71
71
|
* Дополнительный класс
|
|
72
72
|
*/
|
|
73
73
|
contentClassName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Дополнительные пропсы на обертку контента
|
|
76
|
+
*/
|
|
77
|
+
contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
78
|
+
/**
|
|
79
|
+
* Дополнительные пропсы на компонентную обертку контента
|
|
80
|
+
*/
|
|
81
|
+
componentDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
74
82
|
/**
|
|
75
83
|
* Дополнительный класс для обертки (Modal)
|
|
76
84
|
*/
|
package/Component.js
CHANGED
|
@@ -23,7 +23,7 @@ var FocusLock__default = /*#__PURE__*/_interopDefaultCompat(FocusLock);
|
|
|
23
23
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
24
24
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
25
25
|
|
|
26
|
-
var styles = {"component":"base-
|
|
26
|
+
var styles = {"component":"base-modal__component_vq09z","wrapper":"base-modal__wrapper_vq09z","content":"base-modal__content_vq09z","hidden":"base-modal__hidden_vq09z","backdrop":"base-modal__backdrop_vq09z","appear":"base-modal__appear_vq09z","enter":"base-modal__enter_vq09z","appearActive":"base-modal__appearActive_vq09z","enterActive":"base-modal__enterActive_vq09z","exit":"base-modal__exit_vq09z","exitActive":"base-modal__exitActive_vq09z","exitDone":"base-modal__exitDone_vq09z"};
|
|
27
27
|
require('./index.css')
|
|
28
28
|
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
@@ -43,7 +43,7 @@ var BaseModalContext = React__default.default.createContext({
|
|
|
43
43
|
onClose: function () { return null; },
|
|
44
44
|
});
|
|
45
45
|
var BaseModal = React.forwardRef(function (_a, ref) {
|
|
46
|
-
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.disableBlockingScroll, disableBlockingScroll = _k === void 0 ? false : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, 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, _m = _a.zIndex, zIndex = _m === void 0 ? coreComponentsStack.stackingOrder.MODAL : _m, _o = _a.componentRef, componentRef = _o === void 0 ? null : _o, _p = _a.usePortal, usePortal = _p === void 0 ? true : _p;
|
|
46
|
+
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.disableBlockingScroll, disableBlockingScroll = _k === void 0 ? false : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, className = _a.className, contentClassName = _a.contentClassName, contentProps = _a.contentProps, componentDivProps = _a.componentDivProps, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _m = _a.zIndex, zIndex = _m === void 0 ? coreComponentsStack.stackingOrder.MODAL : _m, _o = _a.componentRef, componentRef = _o === void 0 ? null : _o, _p = _a.usePortal, usePortal = _p === void 0 ? true : _p;
|
|
47
47
|
var _q = React.useState(null), exited = _q[0], setExited = _q[1];
|
|
48
48
|
var _r = React.useState(false), hasScroll = _r[0], setHasScroll = _r[1];
|
|
49
49
|
var _s = React.useState(false), hasHeader = _s[0], setHasHeader = _s[1];
|
|
@@ -248,8 +248,12 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
248
248
|
zIndex: computedZIndex,
|
|
249
249
|
} },
|
|
250
250
|
React__default.default.createElement(reactTransitionGroup.CSSTransition, tslib.__assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
251
|
-
React__default.default.createElement("div", { className: cn__default.default(styles.component, className), ref: mergeRefs__default.default([
|
|
252
|
-
|
|
251
|
+
React__default.default.createElement("div", tslib.__assign({}, componentDivProps, { className: cn__default.default(styles.component, className, componentDivProps === null || componentDivProps === void 0 ? void 0 : componentDivProps.className), ref: mergeRefs__default.default([
|
|
252
|
+
componentRef,
|
|
253
|
+
componentNodeRef,
|
|
254
|
+
(componentDivProps === null || componentDivProps === void 0 ? void 0 : componentDivProps.ref) || null,
|
|
255
|
+
]) }),
|
|
256
|
+
React__default.default.createElement("div", tslib.__assign({}, contentProps, { className: cn__default.default(styles.content, contentClassName, contentProps === null || contentProps === void 0 ? void 0 : contentProps.className) }), children)))))));
|
|
253
257
|
})); };
|
|
254
258
|
if (!shouldRender)
|
|
255
259
|
return null;
|
package/cssm/Component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react-transition-group" />
|
|
2
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react-transition-group" />
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react";
|
|
5
5
|
import { TransitionProps } from 'react-transition-group/Transition';
|
|
@@ -71,6 +71,14 @@ type BaseModalProps = {
|
|
|
71
71
|
* Дополнительный класс
|
|
72
72
|
*/
|
|
73
73
|
contentClassName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Дополнительные пропсы на обертку контента
|
|
76
|
+
*/
|
|
77
|
+
contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
78
|
+
/**
|
|
79
|
+
* Дополнительные пропсы на компонентную обертку контента
|
|
80
|
+
*/
|
|
81
|
+
componentDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
74
82
|
/**
|
|
75
83
|
* Дополнительный класс для обертки (Modal)
|
|
76
84
|
*/
|
package/cssm/Component.js
CHANGED
|
@@ -42,7 +42,7 @@ var BaseModalContext = React__default.default.createContext({
|
|
|
42
42
|
onClose: function () { return null; },
|
|
43
43
|
});
|
|
44
44
|
var BaseModal = React.forwardRef(function (_a, ref) {
|
|
45
|
-
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.disableBlockingScroll, disableBlockingScroll = _k === void 0 ? false : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, 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, _m = _a.zIndex, zIndex = _m === void 0 ? coreComponentsStack.stackingOrder.MODAL : _m, _o = _a.componentRef, componentRef = _o === void 0 ? null : _o, _p = _a.usePortal, usePortal = _p === void 0 ? true : _p;
|
|
45
|
+
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.disableBlockingScroll, disableBlockingScroll = _k === void 0 ? false : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, className = _a.className, contentClassName = _a.contentClassName, contentProps = _a.contentProps, componentDivProps = _a.componentDivProps, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _m = _a.zIndex, zIndex = _m === void 0 ? coreComponentsStack.stackingOrder.MODAL : _m, _o = _a.componentRef, componentRef = _o === void 0 ? null : _o, _p = _a.usePortal, usePortal = _p === void 0 ? true : _p;
|
|
46
46
|
var _q = React.useState(null), exited = _q[0], setExited = _q[1];
|
|
47
47
|
var _r = React.useState(false), hasScroll = _r[0], setHasScroll = _r[1];
|
|
48
48
|
var _s = React.useState(false), hasHeader = _s[0], setHasHeader = _s[1];
|
|
@@ -247,8 +247,12 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
247
247
|
zIndex: computedZIndex,
|
|
248
248
|
} },
|
|
249
249
|
React__default.default.createElement(reactTransitionGroup.CSSTransition, tslib.__assign({ appear: true, timeout: 200, classNames: styles__default.default }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
250
|
-
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, className), ref: mergeRefs__default.default([
|
|
251
|
-
|
|
250
|
+
React__default.default.createElement("div", tslib.__assign({}, componentDivProps, { className: cn__default.default(styles__default.default.component, className, componentDivProps === null || componentDivProps === void 0 ? void 0 : componentDivProps.className), ref: mergeRefs__default.default([
|
|
251
|
+
componentRef,
|
|
252
|
+
componentNodeRef,
|
|
253
|
+
(componentDivProps === null || componentDivProps === void 0 ? void 0 : componentDivProps.ref) || null,
|
|
254
|
+
]) }),
|
|
255
|
+
React__default.default.createElement("div", tslib.__assign({}, contentProps, { className: cn__default.default(styles__default.default.content, contentClassName, contentProps === null || contentProps === void 0 ? void 0 : contentProps.className) }), children)))))));
|
|
252
256
|
})); };
|
|
253
257
|
if (!shouldRender)
|
|
254
258
|
return null;
|
package/esm/Component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react-transition-group" />
|
|
2
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react-transition-group" />
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react";
|
|
5
5
|
import { TransitionProps } from 'react-transition-group/Transition';
|
|
@@ -71,6 +71,14 @@ type BaseModalProps = {
|
|
|
71
71
|
* Дополнительный класс
|
|
72
72
|
*/
|
|
73
73
|
contentClassName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Дополнительные пропсы на обертку контента
|
|
76
|
+
*/
|
|
77
|
+
contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
78
|
+
/**
|
|
79
|
+
* Дополнительные пропсы на компонентную обертку контента
|
|
80
|
+
*/
|
|
81
|
+
componentDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
74
82
|
/**
|
|
75
83
|
* Дополнительный класс для обертки (Modal)
|
|
76
84
|
*/
|
package/esm/Component.js
CHANGED
|
@@ -12,7 +12,7 @@ import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerS
|
|
|
12
12
|
import './matches-polyfill.js';
|
|
13
13
|
import '@alfalab/core-components-global-store/esm';
|
|
14
14
|
|
|
15
|
-
var styles = {"component":"base-
|
|
15
|
+
var styles = {"component":"base-modal__component_vq09z","wrapper":"base-modal__wrapper_vq09z","content":"base-modal__content_vq09z","hidden":"base-modal__hidden_vq09z","backdrop":"base-modal__backdrop_vq09z","appear":"base-modal__appear_vq09z","enter":"base-modal__enter_vq09z","appearActive":"base-modal__appearActive_vq09z","enterActive":"base-modal__enterActive_vq09z","exit":"base-modal__exit_vq09z","exitActive":"base-modal__exitActive_vq09z","exitDone":"base-modal__exitDone_vq09z"};
|
|
16
16
|
require('./index.css')
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
@@ -32,7 +32,7 @@ var BaseModalContext = React.createContext({
|
|
|
32
32
|
onClose: function () { return null; },
|
|
33
33
|
});
|
|
34
34
|
var BaseModal = forwardRef(function (_a, ref) {
|
|
35
|
-
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.disableBlockingScroll, disableBlockingScroll = _k === void 0 ? false : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, 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, _m = _a.zIndex, zIndex = _m === void 0 ? stackingOrder.MODAL : _m, _o = _a.componentRef, componentRef = _o === void 0 ? null : _o, _p = _a.usePortal, usePortal = _p === void 0 ? true : _p;
|
|
35
|
+
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.disableBlockingScroll, disableBlockingScroll = _k === void 0 ? false : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, className = _a.className, contentClassName = _a.contentClassName, contentProps = _a.contentProps, componentDivProps = _a.componentDivProps, wrapperClassName = _a.wrapperClassName, onBackdropClick = _a.onBackdropClick, onClose = _a.onClose, onEscapeKeyDown = _a.onEscapeKeyDown, onMount = _a.onMount, onUnmount = _a.onUnmount, dataTestId = _a.dataTestId, _m = _a.zIndex, zIndex = _m === void 0 ? stackingOrder.MODAL : _m, _o = _a.componentRef, componentRef = _o === void 0 ? null : _o, _p = _a.usePortal, usePortal = _p === void 0 ? true : _p;
|
|
36
36
|
var _q = useState(null), exited = _q[0], setExited = _q[1];
|
|
37
37
|
var _r = useState(false), hasScroll = _r[0], setHasScroll = _r[1];
|
|
38
38
|
var _s = useState(false), hasHeader = _s[0], setHasHeader = _s[1];
|
|
@@ -237,8 +237,12 @@ var BaseModal = forwardRef(function (_a, ref) {
|
|
|
237
237
|
zIndex: computedZIndex,
|
|
238
238
|
} },
|
|
239
239
|
React.createElement(CSSTransition, __assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
240
|
-
React.createElement("div", { className: cn(styles.component, className), ref: mergeRefs([
|
|
241
|
-
|
|
240
|
+
React.createElement("div", __assign({}, componentDivProps, { className: cn(styles.component, className, componentDivProps === null || componentDivProps === void 0 ? void 0 : componentDivProps.className), ref: mergeRefs([
|
|
241
|
+
componentRef,
|
|
242
|
+
componentNodeRef,
|
|
243
|
+
(componentDivProps === null || componentDivProps === void 0 ? void 0 : componentDivProps.ref) || null,
|
|
244
|
+
]) }),
|
|
245
|
+
React.createElement("div", __assign({}, contentProps, { className: cn(styles.content, contentClassName, contentProps === null || contentProps === void 0 ? void 0 : contentProps.className) }), children)))))));
|
|
242
246
|
})); };
|
|
243
247
|
if (!shouldRender)
|
|
244
248
|
return null;
|
package/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 184a3 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
18
|
-
} .base-
|
|
18
|
+
} .base-modal__component_vq09z {
|
|
19
19
|
position: relative;
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
background: var(--color-light-bg-primary);
|
|
22
22
|
margin: auto;
|
|
23
23
|
flex-shrink: 0;
|
|
24
|
-
} .base-
|
|
24
|
+
} .base-modal__wrapper_vq09z {
|
|
25
25
|
position: fixed;
|
|
26
26
|
top: 0;
|
|
27
27
|
left: 0;
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
align-items: center;
|
|
35
35
|
outline: 0;
|
|
36
|
-
} .base-
|
|
36
|
+
} .base-modal__content_vq09z {
|
|
37
37
|
width: 100%;
|
|
38
38
|
height: 100%;
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
flex: 1;
|
|
42
|
-
} .base-
|
|
42
|
+
} .base-modal__hidden_vq09z {
|
|
43
43
|
display: none;
|
|
44
|
-
} .base-
|
|
44
|
+
} .base-modal__backdrop_vq09z {
|
|
45
45
|
z-index: 0;
|
|
46
|
-
} .base-
|
|
47
|
-
.base-
|
|
46
|
+
} .base-modal__appear_vq09z,
|
|
47
|
+
.base-modal__enter_vq09z {
|
|
48
48
|
opacity: 0;
|
|
49
|
-
} .base-
|
|
50
|
-
.base-
|
|
49
|
+
} .base-modal__appearActive_vq09z,
|
|
50
|
+
.base-modal__enterActive_vq09z {
|
|
51
51
|
opacity: 1;
|
|
52
52
|
transition: opacity 200ms ease-in;
|
|
53
|
-
} .base-
|
|
53
|
+
} .base-modal__exit_vq09z {
|
|
54
54
|
opacity: 1;
|
|
55
|
-
} .base-
|
|
56
|
-
.base-
|
|
55
|
+
} .base-modal__exitActive_vq09z,
|
|
56
|
+
.base-modal__exitDone_vq09z {
|
|
57
57
|
opacity: 0;
|
|
58
58
|
transition: opacity 200ms ease-out;
|
|
59
59
|
}
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 184a3 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
18
|
-
} .base-
|
|
18
|
+
} .base-modal__component_vq09z {
|
|
19
19
|
position: relative;
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
background: var(--color-light-bg-primary);
|
|
22
22
|
margin: auto;
|
|
23
23
|
flex-shrink: 0;
|
|
24
|
-
} .base-
|
|
24
|
+
} .base-modal__wrapper_vq09z {
|
|
25
25
|
position: fixed;
|
|
26
26
|
top: 0;
|
|
27
27
|
left: 0;
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
align-items: center;
|
|
35
35
|
outline: 0;
|
|
36
|
-
} .base-
|
|
36
|
+
} .base-modal__content_vq09z {
|
|
37
37
|
width: 100%;
|
|
38
38
|
height: 100%;
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
flex: 1;
|
|
42
|
-
} .base-
|
|
42
|
+
} .base-modal__hidden_vq09z {
|
|
43
43
|
display: none;
|
|
44
|
-
} .base-
|
|
44
|
+
} .base-modal__backdrop_vq09z {
|
|
45
45
|
z-index: 0;
|
|
46
|
-
} .base-
|
|
47
|
-
.base-
|
|
46
|
+
} .base-modal__appear_vq09z,
|
|
47
|
+
.base-modal__enter_vq09z {
|
|
48
48
|
opacity: 0;
|
|
49
|
-
} .base-
|
|
50
|
-
.base-
|
|
49
|
+
} .base-modal__appearActive_vq09z,
|
|
50
|
+
.base-modal__enterActive_vq09z {
|
|
51
51
|
opacity: 1;
|
|
52
52
|
transition: opacity 200ms ease-in;
|
|
53
|
-
} .base-
|
|
53
|
+
} .base-modal__exit_vq09z {
|
|
54
54
|
opacity: 1;
|
|
55
|
-
} .base-
|
|
56
|
-
.base-
|
|
55
|
+
} .base-modal__exitActive_vq09z,
|
|
56
|
+
.base-modal__exitDone_vq09z {
|
|
57
57
|
opacity: 0;
|
|
58
58
|
transition: opacity 200ms ease-out;
|
|
59
59
|
}
|
package/modern/Component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react-transition-group" />
|
|
2
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react-transition-group" />
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react";
|
|
5
5
|
import { TransitionProps } from 'react-transition-group/Transition';
|
|
@@ -71,6 +71,14 @@ type BaseModalProps = {
|
|
|
71
71
|
* Дополнительный класс
|
|
72
72
|
*/
|
|
73
73
|
contentClassName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Дополнительные пропсы на обертку контента
|
|
76
|
+
*/
|
|
77
|
+
contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
78
|
+
/**
|
|
79
|
+
* Дополнительные пропсы на компонентную обертку контента
|
|
80
|
+
*/
|
|
81
|
+
componentDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
74
82
|
/**
|
|
75
83
|
* Дополнительный класс для обертки (Modal)
|
|
76
84
|
*/
|
package/modern/Component.js
CHANGED
|
@@ -11,7 +11,7 @@ import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerS
|
|
|
11
11
|
import './matches-polyfill.js';
|
|
12
12
|
import '@alfalab/core-components-global-store/modern';
|
|
13
13
|
|
|
14
|
-
const styles = {"component":"base-
|
|
14
|
+
const styles = {"component":"base-modal__component_vq09z","wrapper":"base-modal__wrapper_vq09z","content":"base-modal__content_vq09z","hidden":"base-modal__hidden_vq09z","backdrop":"base-modal__backdrop_vq09z","appear":"base-modal__appear_vq09z","enter":"base-modal__enter_vq09z","appearActive":"base-modal__appearActive_vq09z","enterActive":"base-modal__enterActive_vq09z","exit":"base-modal__exit_vq09z","exitActive":"base-modal__exitActive_vq09z","exitDone":"base-modal__exitDone_vq09z"};
|
|
15
15
|
require('./index.css')
|
|
16
16
|
|
|
17
17
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
@@ -31,7 +31,7 @@ const BaseModalContext = React.createContext({
|
|
|
31
31
|
setHasFooter: () => null,
|
|
32
32
|
onClose: () => null,
|
|
33
33
|
});
|
|
34
|
-
const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrapper', Backdrop: Backdrop$1 = Backdrop, backdropProps = {}, transitionProps = {}, disableBackdropClick, disableAutoFocus = false, disableFocusLock = false, disableEscapeKeyDown = false, disableRestoreFocus = false, disableBlockingScroll = false, keepMounted = false, className, contentClassName, wrapperClassName, onBackdropClick, onClose, onEscapeKeyDown, onMount, onUnmount, dataTestId, zIndex = stackingOrder.MODAL, componentRef = null, usePortal = true, }, ref) => {
|
|
34
|
+
const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrapper', Backdrop: Backdrop$1 = Backdrop, backdropProps = {}, transitionProps = {}, disableBackdropClick, disableAutoFocus = false, disableFocusLock = false, disableEscapeKeyDown = false, disableRestoreFocus = false, disableBlockingScroll = false, keepMounted = false, className, contentClassName, contentProps, componentDivProps, wrapperClassName, onBackdropClick, onClose, onEscapeKeyDown, onMount, onUnmount, dataTestId, zIndex = stackingOrder.MODAL, componentRef = null, usePortal = true, }, ref) => {
|
|
35
35
|
const [exited, setExited] = useState(null);
|
|
36
36
|
const [hasScroll, setHasScroll] = useState(false);
|
|
37
37
|
const [hasHeader, setHasHeader] = useState(false);
|
|
@@ -233,8 +233,12 @@ const BaseModal = forwardRef(({ open, container, children, scrollHandler = 'wrap
|
|
|
233
233
|
zIndex: computedZIndex,
|
|
234
234
|
} },
|
|
235
235
|
React.createElement(CSSTransition, { appear: true, timeout: 200, classNames: styles, ...transitionProps, in: open, onEntered: handleEntered, onExited: handleExited },
|
|
236
|
-
React.createElement("div", { className: cn(styles.component, className), ref: mergeRefs([
|
|
237
|
-
|
|
236
|
+
React.createElement("div", { ...componentDivProps, className: cn(styles.component, className, componentDivProps?.className), ref: mergeRefs([
|
|
237
|
+
componentRef,
|
|
238
|
+
componentNodeRef,
|
|
239
|
+
componentDivProps?.ref || null,
|
|
240
|
+
]) },
|
|
241
|
+
React.createElement("div", { ...contentProps, className: cn(styles.content, contentClassName, contentProps?.className) }, children)))))))));
|
|
238
242
|
if (!shouldRender)
|
|
239
243
|
return null;
|
|
240
244
|
return usePortal ? (React.createElement(Portal, { getPortalContainer: container, immediateMount: true }, renderContent())) : (renderContent());
|
package/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 184a3 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
18
|
-
} .base-
|
|
18
|
+
} .base-modal__component_vq09z {
|
|
19
19
|
position: relative;
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
background: var(--color-light-bg-primary);
|
|
22
22
|
margin: auto;
|
|
23
23
|
flex-shrink: 0;
|
|
24
|
-
} .base-
|
|
24
|
+
} .base-modal__wrapper_vq09z {
|
|
25
25
|
position: fixed;
|
|
26
26
|
top: 0;
|
|
27
27
|
left: 0;
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
align-items: center;
|
|
35
35
|
outline: 0;
|
|
36
|
-
} .base-
|
|
36
|
+
} .base-modal__content_vq09z {
|
|
37
37
|
width: 100%;
|
|
38
38
|
height: 100%;
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
flex: 1;
|
|
42
|
-
} .base-
|
|
42
|
+
} .base-modal__hidden_vq09z {
|
|
43
43
|
display: none;
|
|
44
|
-
} .base-
|
|
44
|
+
} .base-modal__backdrop_vq09z {
|
|
45
45
|
z-index: 0;
|
|
46
|
-
} .base-
|
|
47
|
-
.base-
|
|
46
|
+
} .base-modal__appear_vq09z,
|
|
47
|
+
.base-modal__enter_vq09z {
|
|
48
48
|
opacity: 0;
|
|
49
|
-
} .base-
|
|
50
|
-
.base-
|
|
49
|
+
} .base-modal__appearActive_vq09z,
|
|
50
|
+
.base-modal__enterActive_vq09z {
|
|
51
51
|
opacity: 1;
|
|
52
52
|
transition: opacity 200ms ease-in;
|
|
53
|
-
} .base-
|
|
53
|
+
} .base-modal__exit_vq09z {
|
|
54
54
|
opacity: 1;
|
|
55
|
-
} .base-
|
|
56
|
-
.base-
|
|
55
|
+
} .base-modal__exitActive_vq09z,
|
|
56
|
+
.base-modal__exitDone_vq09z {
|
|
57
57
|
opacity: 0;
|
|
58
58
|
transition: opacity 200ms ease-out;
|
|
59
59
|
}
|
package/package.json
CHANGED
package/src/Component.tsx
CHANGED
|
@@ -118,6 +118,19 @@ export type BaseModalProps = {
|
|
|
118
118
|
*/
|
|
119
119
|
contentClassName?: string;
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Дополнительные пропсы на обертку контента
|
|
123
|
+
*/
|
|
124
|
+
contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Дополнительные пропсы на компонентную обертку контента
|
|
128
|
+
*/
|
|
129
|
+
componentDivProps?: React.DetailedHTMLProps<
|
|
130
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
131
|
+
HTMLDivElement
|
|
132
|
+
>;
|
|
133
|
+
|
|
121
134
|
/**
|
|
122
135
|
* Дополнительный класс для обертки (Modal)
|
|
123
136
|
*/
|
|
@@ -237,6 +250,8 @@ export const BaseModal = forwardRef<HTMLDivElement, BaseModalProps>(
|
|
|
237
250
|
keepMounted = false,
|
|
238
251
|
className,
|
|
239
252
|
contentClassName,
|
|
253
|
+
contentProps,
|
|
254
|
+
componentDivProps,
|
|
240
255
|
wrapperClassName,
|
|
241
256
|
onBackdropClick,
|
|
242
257
|
onClose,
|
|
@@ -549,10 +564,26 @@ export const BaseModal = forwardRef<HTMLDivElement, BaseModalProps>(
|
|
|
549
564
|
onExited={handleExited}
|
|
550
565
|
>
|
|
551
566
|
<div
|
|
552
|
-
|
|
553
|
-
|
|
567
|
+
{...componentDivProps}
|
|
568
|
+
className={cn(
|
|
569
|
+
styles.component,
|
|
570
|
+
className,
|
|
571
|
+
componentDivProps?.className,
|
|
572
|
+
)}
|
|
573
|
+
ref={mergeRefs([
|
|
574
|
+
componentRef,
|
|
575
|
+
componentNodeRef,
|
|
576
|
+
componentDivProps?.ref || null,
|
|
577
|
+
])}
|
|
554
578
|
>
|
|
555
|
-
<div
|
|
579
|
+
<div
|
|
580
|
+
{...contentProps}
|
|
581
|
+
className={cn(
|
|
582
|
+
styles.content,
|
|
583
|
+
contentClassName,
|
|
584
|
+
contentProps?.className,
|
|
585
|
+
)}
|
|
586
|
+
>
|
|
556
587
|
{children}
|
|
557
588
|
</div>
|
|
558
589
|
</div>
|