@alfalab/core-components-base-modal 5.0.6 → 5.0.7
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.js +18 -20
- package/cssm/Component.js +19 -21
- package/cssm/index.js +2 -4
- package/cssm/utils.d.ts +1 -1
- package/cssm/utils.js +1 -3
- package/esm/Component.js +2 -2
- package/esm/index.css +13 -13
- package/esm/index.js +2 -2
- package/esm/utils.d.ts +1 -1
- package/esm/utils.js +1 -1
- package/index.css +13 -13
- package/index.js +2 -4
- package/modern/Component.js +3 -3
- package/modern/index.css +13 -13
- package/modern/index.js +3 -3
- package/modern/utils.d.ts +1 -1
- package/package.json +5 -5
- package/utils.d.ts +1 -1
- package/utils.js +1 -3
package/Component.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var FocusLock = require('react-focus-lock');
|
|
7
5
|
var mergeRefs = require('react-merge-refs');
|
|
@@ -11,16 +9,16 @@ var cn = require('classnames');
|
|
|
11
9
|
var coreComponentsBackdrop = require('@alfalab/core-components-backdrop');
|
|
12
10
|
var coreComponentsPortal = require('@alfalab/core-components-portal');
|
|
13
11
|
var coreComponentsStack = require('@alfalab/core-components-stack');
|
|
14
|
-
require('@alfalab/core-components-global-store');
|
|
15
12
|
var utils = require('./utils.js');
|
|
16
13
|
require('./matches-polyfill.js');
|
|
14
|
+
require('@alfalab/core-components-global-store');
|
|
17
15
|
|
|
18
|
-
function
|
|
16
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
17
|
|
|
20
|
-
var React__default = /*#__PURE__*/
|
|
21
|
-
var FocusLock__default = /*#__PURE__*/
|
|
22
|
-
var mergeRefs__default = /*#__PURE__*/
|
|
23
|
-
var cn__default = /*#__PURE__*/
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
|
+
var FocusLock__default = /*#__PURE__*/_interopDefaultCompat(FocusLock);
|
|
20
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
21
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
24
22
|
|
|
25
23
|
/******************************************************************************
|
|
26
24
|
Copyright (c) Microsoft Corporation.
|
|
@@ -49,11 +47,11 @@ var __assign = function () {
|
|
|
49
47
|
return __assign.apply(this, arguments);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
var styles = {"component":"base-
|
|
50
|
+
var styles = {"component":"base-modal__component_uakct","wrapper":"base-modal__wrapper_uakct","content":"base-modal__content_uakct","hidden":"base-modal__hidden_uakct","backdrop":"base-modal__backdrop_uakct","appear":"base-modal__appear_uakct","enter":"base-modal__enter_uakct","appearActive":"base-modal__appearActive_uakct","enterActive":"base-modal__enterActive_uakct","exit":"base-modal__exit_uakct","exitActive":"base-modal__exitActive_uakct","exitDone":"base-modal__exitDone_uakct"};
|
|
53
51
|
require('./index.css')
|
|
54
52
|
|
|
55
53
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
56
|
-
var BaseModalContext = React__default
|
|
54
|
+
var BaseModalContext = React__default.default.createContext({
|
|
57
55
|
hasFooter: false,
|
|
58
56
|
hasHeader: false,
|
|
59
57
|
hasScroll: false,
|
|
@@ -257,24 +255,24 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
257
255
|
]);
|
|
258
256
|
if (!shouldRender)
|
|
259
257
|
return null;
|
|
260
|
-
return (React__default
|
|
258
|
+
return (React__default.default.createElement(coreComponentsStack.Stack, { value: zIndex }, function (computedZIndex) {
|
|
261
259
|
var _a;
|
|
262
|
-
return (React__default
|
|
263
|
-
React__default
|
|
264
|
-
React__default
|
|
265
|
-
Backdrop && (React__default
|
|
260
|
+
return (React__default.default.createElement(coreComponentsPortal.Portal, { getPortalContainer: container, immediateMount: true },
|
|
261
|
+
React__default.default.createElement(BaseModalContext.Provider, { value: contextValue },
|
|
262
|
+
React__default.default.createElement(FocusLock__default.default, { autoFocus: !disableAutoFocus, disabled: disableFocusLock || !open, returnFocus: !disableRestoreFocus },
|
|
263
|
+
Backdrop && (React__default.default.createElement(Backdrop, __assign({}, backdropProps, { className: cn__default.default(backdropProps.className, styles.backdrop), open: open, style: {
|
|
266
264
|
zIndex: computedZIndex,
|
|
267
265
|
} }))),
|
|
268
|
-
React__default
|
|
266
|
+
React__default.default.createElement("div", { role: 'dialog', className: cn__default.default(styles.wrapper, wrapperClassName, (_a = {},
|
|
269
267
|
_a[styles.hidden] = !open && isExited,
|
|
270
|
-
_a)), ref: mergeRefs__default
|
|
268
|
+
_a)), ref: mergeRefs__default.default([ref, wrapperRef]), onKeyDown: handleKeyDown, onMouseDown: handleBackdropMouseDown, onMouseUp: handleBackdropMouseUp,
|
|
271
269
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
272
270
|
tabIndex: 0, "data-test-id": dataTestId, style: {
|
|
273
271
|
zIndex: computedZIndex,
|
|
274
272
|
} },
|
|
275
|
-
React__default
|
|
276
|
-
React__default
|
|
277
|
-
React__default
|
|
273
|
+
React__default.default.createElement(reactTransitionGroup.CSSTransition, __assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
274
|
+
React__default.default.createElement("div", { className: cn__default.default(styles.component, className), ref: mergeRefs__default.default([componentRef, componentNodeRef]) },
|
|
275
|
+
React__default.default.createElement("div", { className: cn__default.default(styles.content, contentClassName) }, children))))))));
|
|
278
276
|
}));
|
|
279
277
|
});
|
|
280
278
|
|
package/cssm/Component.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var FocusLock = require('react-focus-lock');
|
|
7
5
|
var mergeRefs = require('react-merge-refs');
|
|
@@ -11,18 +9,18 @@ var cn = require('classnames');
|
|
|
11
9
|
var coreComponentsBackdrop = require('@alfalab/core-components-backdrop/cssm');
|
|
12
10
|
var coreComponentsPortal = require('@alfalab/core-components-portal/cssm');
|
|
13
11
|
var coreComponentsStack = require('@alfalab/core-components-stack/cssm');
|
|
14
|
-
require('@alfalab/core-components-global-store/cssm');
|
|
15
12
|
var utils = require('./utils.js');
|
|
16
13
|
var styles = require('./index.module.css');
|
|
17
14
|
require('./matches-polyfill.js');
|
|
15
|
+
require('@alfalab/core-components-global-store/cssm');
|
|
18
16
|
|
|
19
|
-
function
|
|
17
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
18
|
|
|
21
|
-
var React__default = /*#__PURE__*/
|
|
22
|
-
var FocusLock__default = /*#__PURE__*/
|
|
23
|
-
var mergeRefs__default = /*#__PURE__*/
|
|
24
|
-
var cn__default = /*#__PURE__*/
|
|
25
|
-
var styles__default = /*#__PURE__*/
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
20
|
+
var FocusLock__default = /*#__PURE__*/_interopDefaultCompat(FocusLock);
|
|
21
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
22
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
23
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
26
24
|
|
|
27
25
|
/******************************************************************************
|
|
28
26
|
Copyright (c) Microsoft Corporation.
|
|
@@ -52,7 +50,7 @@ var __assign = function () {
|
|
|
52
50
|
};
|
|
53
51
|
|
|
54
52
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
55
|
-
var BaseModalContext = React__default
|
|
53
|
+
var BaseModalContext = React__default.default.createContext({
|
|
56
54
|
hasFooter: false,
|
|
57
55
|
hasHeader: false,
|
|
58
56
|
hasScroll: false,
|
|
@@ -256,24 +254,24 @@ var BaseModal = React.forwardRef(function (_a, ref) {
|
|
|
256
254
|
]);
|
|
257
255
|
if (!shouldRender)
|
|
258
256
|
return null;
|
|
259
|
-
return (React__default
|
|
257
|
+
return (React__default.default.createElement(coreComponentsStack.Stack, { value: zIndex }, function (computedZIndex) {
|
|
260
258
|
var _a;
|
|
261
|
-
return (React__default
|
|
262
|
-
React__default
|
|
263
|
-
React__default
|
|
264
|
-
Backdrop && (React__default
|
|
259
|
+
return (React__default.default.createElement(coreComponentsPortal.Portal, { getPortalContainer: container, immediateMount: true },
|
|
260
|
+
React__default.default.createElement(BaseModalContext.Provider, { value: contextValue },
|
|
261
|
+
React__default.default.createElement(FocusLock__default.default, { autoFocus: !disableAutoFocus, disabled: disableFocusLock || !open, returnFocus: !disableRestoreFocus },
|
|
262
|
+
Backdrop && (React__default.default.createElement(Backdrop, __assign({}, backdropProps, { className: cn__default.default(backdropProps.className, styles__default.default.backdrop), open: open, style: {
|
|
265
263
|
zIndex: computedZIndex,
|
|
266
264
|
} }))),
|
|
267
|
-
React__default
|
|
268
|
-
_a[styles__default
|
|
269
|
-
_a)), ref: mergeRefs__default
|
|
265
|
+
React__default.default.createElement("div", { role: 'dialog', className: cn__default.default(styles__default.default.wrapper, wrapperClassName, (_a = {},
|
|
266
|
+
_a[styles__default.default.hidden] = !open && isExited,
|
|
267
|
+
_a)), ref: mergeRefs__default.default([ref, wrapperRef]), onKeyDown: handleKeyDown, onMouseDown: handleBackdropMouseDown, onMouseUp: handleBackdropMouseUp,
|
|
270
268
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
271
269
|
tabIndex: 0, "data-test-id": dataTestId, style: {
|
|
272
270
|
zIndex: computedZIndex,
|
|
273
271
|
} },
|
|
274
|
-
React__default
|
|
275
|
-
React__default
|
|
276
|
-
React__default
|
|
272
|
+
React__default.default.createElement(reactTransitionGroup.CSSTransition, __assign({ appear: true, timeout: 200, classNames: styles__default.default }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }),
|
|
273
|
+
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, className), ref: mergeRefs__default.default([componentRef, componentNodeRef]) },
|
|
274
|
+
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.content, contentClassName) }, children))))))));
|
|
277
275
|
}));
|
|
278
276
|
});
|
|
279
277
|
|
package/cssm/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var Component = require('./Component.js');
|
|
4
|
+
var utils = require('./utils.js');
|
|
6
5
|
require('react');
|
|
7
6
|
require('react-focus-lock');
|
|
8
7
|
require('react-merge-refs');
|
|
@@ -12,10 +11,9 @@ require('classnames');
|
|
|
12
11
|
require('@alfalab/core-components-backdrop/cssm');
|
|
13
12
|
require('@alfalab/core-components-portal/cssm');
|
|
14
13
|
require('@alfalab/core-components-stack/cssm');
|
|
15
|
-
require('@alfalab/core-components-global-store/cssm');
|
|
16
|
-
var utils = require('./utils.js');
|
|
17
14
|
require('./index.module.css');
|
|
18
15
|
require('./matches-polyfill.js');
|
|
16
|
+
require('@alfalab/core-components-global-store/cssm');
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
|
package/cssm/utils.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ declare function isScrolledToBottom(target: HTMLElement): boolean;
|
|
|
3
3
|
declare function hasScrollbar(target: HTMLElement): boolean;
|
|
4
4
|
declare const getScrollbarSize: () => number;
|
|
5
5
|
declare const restoreContainerStyles: (container: HTMLElement) => void;
|
|
6
|
-
declare const handleContainer: (container?: HTMLElement
|
|
6
|
+
declare const handleContainer: (container?: HTMLElement) => void;
|
|
7
7
|
export { isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer };
|
package/cssm/utils.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var coreComponentsGlobalStore = require('@alfalab/core-components-global-store/cssm');
|
|
6
4
|
|
|
7
5
|
function isScrolledToTop(target) {
|
|
@@ -80,7 +78,7 @@ var handleContainer = function (container) {
|
|
|
80
78
|
});
|
|
81
79
|
// Вычисляем стили, чтобы получить реальный `padding` c шириной сколлбара
|
|
82
80
|
// eslint-disable-next-line no-param-reassign
|
|
83
|
-
container.style.paddingRight = getPaddingRight(container) + scrollbarSize
|
|
81
|
+
container.style.paddingRight = "".concat(getPaddingRight(container) + scrollbarSize, "px");
|
|
84
82
|
}
|
|
85
83
|
var parent = container.parentElement;
|
|
86
84
|
var scrollContainer =
|
package/esm/Component.js
CHANGED
|
@@ -7,9 +7,9 @@ import cn from 'classnames';
|
|
|
7
7
|
import { Backdrop } from '@alfalab/core-components-backdrop/esm';
|
|
8
8
|
import { Portal } from '@alfalab/core-components-portal/esm';
|
|
9
9
|
import { stackingOrder, Stack } from '@alfalab/core-components-stack/esm';
|
|
10
|
-
import '@alfalab/core-components-global-store/esm';
|
|
11
10
|
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar, getScrollbarSize } from './utils.js';
|
|
12
11
|
import './matches-polyfill.js';
|
|
12
|
+
import '@alfalab/core-components-global-store/esm';
|
|
13
13
|
|
|
14
14
|
/******************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
@@ -38,7 +38,7 @@ var __assign = function () {
|
|
|
38
38
|
return __assign.apply(this, arguments);
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
var styles = {"component":"base-
|
|
41
|
+
var styles = {"component":"base-modal__component_uakct","wrapper":"base-modal__wrapper_uakct","content":"base-modal__content_uakct","hidden":"base-modal__hidden_uakct","backdrop":"base-modal__backdrop_uakct","appear":"base-modal__appear_uakct","enter":"base-modal__enter_uakct","appearActive":"base-modal__appearActive_uakct","enterActive":"base-modal__enterActive_uakct","exit":"base-modal__exit_uakct","exitActive":"base-modal__exitActive_uakct","exitDone":"base-modal__exitDone_uakct"};
|
|
42
42
|
require('./index.css')
|
|
43
43
|
|
|
44
44
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
package/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 2wz55 */
|
|
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_uakct {
|
|
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_uakct {
|
|
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_uakct {
|
|
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_uakct {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
.base-
|
|
43
|
+
.base-modal__backdrop_uakct {
|
|
44
44
|
z-index: 0;
|
|
45
45
|
}
|
|
46
|
-
.base-
|
|
47
|
-
.base-
|
|
46
|
+
.base-modal__appear_uakct,
|
|
47
|
+
.base-modal__enter_uakct {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
50
|
-
.base-
|
|
51
|
-
.base-
|
|
50
|
+
.base-modal__appearActive_uakct,
|
|
51
|
+
.base-modal__enterActive_uakct {
|
|
52
52
|
opacity: 1;
|
|
53
53
|
transition: opacity 200ms ease-in;
|
|
54
54
|
}
|
|
55
|
-
.base-
|
|
55
|
+
.base-modal__exit_uakct {
|
|
56
56
|
opacity: 1;
|
|
57
57
|
}
|
|
58
|
-
.base-
|
|
59
|
-
.base-
|
|
58
|
+
.base-modal__exitActive_uakct,
|
|
59
|
+
.base-modal__exitDone_uakct {
|
|
60
60
|
opacity: 0;
|
|
61
61
|
transition: opacity 200ms ease-out;
|
|
62
62
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { BaseModal, BaseModalContext } from './Component.js';
|
|
2
|
+
export { getScrollbarSize, handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import 'react-focus-lock';
|
|
4
5
|
import 'react-merge-refs';
|
|
@@ -8,6 +9,5 @@ import 'classnames';
|
|
|
8
9
|
import '@alfalab/core-components-backdrop/esm';
|
|
9
10
|
import '@alfalab/core-components-portal/esm';
|
|
10
11
|
import '@alfalab/core-components-stack/esm';
|
|
11
|
-
import '@alfalab/core-components-global-store/esm';
|
|
12
|
-
export { getScrollbarSize, handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
|
|
13
12
|
import './matches-polyfill.js';
|
|
13
|
+
import '@alfalab/core-components-global-store/esm';
|
package/esm/utils.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ declare function isScrolledToBottom(target: HTMLElement): boolean;
|
|
|
3
3
|
declare function hasScrollbar(target: HTMLElement): boolean;
|
|
4
4
|
declare const getScrollbarSize: () => number;
|
|
5
5
|
declare const restoreContainerStyles: (container: HTMLElement) => void;
|
|
6
|
-
declare const handleContainer: (container?: HTMLElement
|
|
6
|
+
declare const handleContainer: (container?: HTMLElement) => void;
|
|
7
7
|
export { isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer };
|
package/esm/utils.js
CHANGED
|
@@ -76,7 +76,7 @@ var handleContainer = function (container) {
|
|
|
76
76
|
});
|
|
77
77
|
// Вычисляем стили, чтобы получить реальный `padding` c шириной сколлбара
|
|
78
78
|
// eslint-disable-next-line no-param-reassign
|
|
79
|
-
container.style.paddingRight = getPaddingRight(container) + scrollbarSize
|
|
79
|
+
container.style.paddingRight = "".concat(getPaddingRight(container) + scrollbarSize, "px");
|
|
80
80
|
}
|
|
81
81
|
var parent = container.parentElement;
|
|
82
82
|
var scrollContainer =
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 2wz55 */
|
|
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_uakct {
|
|
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_uakct {
|
|
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_uakct {
|
|
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_uakct {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
.base-
|
|
43
|
+
.base-modal__backdrop_uakct {
|
|
44
44
|
z-index: 0;
|
|
45
45
|
}
|
|
46
|
-
.base-
|
|
47
|
-
.base-
|
|
46
|
+
.base-modal__appear_uakct,
|
|
47
|
+
.base-modal__enter_uakct {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
50
|
-
.base-
|
|
51
|
-
.base-
|
|
50
|
+
.base-modal__appearActive_uakct,
|
|
51
|
+
.base-modal__enterActive_uakct {
|
|
52
52
|
opacity: 1;
|
|
53
53
|
transition: opacity 200ms ease-in;
|
|
54
54
|
}
|
|
55
|
-
.base-
|
|
55
|
+
.base-modal__exit_uakct {
|
|
56
56
|
opacity: 1;
|
|
57
57
|
}
|
|
58
|
-
.base-
|
|
59
|
-
.base-
|
|
58
|
+
.base-modal__exitActive_uakct,
|
|
59
|
+
.base-modal__exitDone_uakct {
|
|
60
60
|
opacity: 0;
|
|
61
61
|
transition: opacity 200ms ease-out;
|
|
62
62
|
}
|
package/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var Component = require('./Component.js');
|
|
4
|
+
var utils = require('./utils.js');
|
|
6
5
|
require('react');
|
|
7
6
|
require('react-focus-lock');
|
|
8
7
|
require('react-merge-refs');
|
|
@@ -12,9 +11,8 @@ require('classnames');
|
|
|
12
11
|
require('@alfalab/core-components-backdrop');
|
|
13
12
|
require('@alfalab/core-components-portal');
|
|
14
13
|
require('@alfalab/core-components-stack');
|
|
15
|
-
require('@alfalab/core-components-global-store');
|
|
16
|
-
var utils = require('./utils.js');
|
|
17
14
|
require('./matches-polyfill.js');
|
|
15
|
+
require('@alfalab/core-components-global-store');
|
|
18
16
|
|
|
19
17
|
|
|
20
18
|
|
package/modern/Component.js
CHANGED
|
@@ -6,12 +6,12 @@ import { ResizeObserver } from '@juggle/resize-observer';
|
|
|
6
6
|
import cn from 'classnames';
|
|
7
7
|
import { Backdrop } from '@alfalab/core-components-backdrop/modern';
|
|
8
8
|
import { Portal } from '@alfalab/core-components-portal/modern';
|
|
9
|
-
import {
|
|
10
|
-
import '@alfalab/core-components-global-store/modern';
|
|
9
|
+
import { Stack, stackingOrder } from '@alfalab/core-components-stack/modern';
|
|
11
10
|
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar, getScrollbarSize } from './utils.js';
|
|
12
11
|
import './matches-polyfill.js';
|
|
12
|
+
import '@alfalab/core-components-global-store/modern';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const styles = {"component":"base-modal__component_uakct","wrapper":"base-modal__wrapper_uakct","content":"base-modal__content_uakct","hidden":"base-modal__hidden_uakct","backdrop":"base-modal__backdrop_uakct","appear":"base-modal__appear_uakct","enter":"base-modal__enter_uakct","appearActive":"base-modal__appearActive_uakct","enterActive":"base-modal__enterActive_uakct","exit":"base-modal__exit_uakct","exitActive":"base-modal__exitActive_uakct","exitDone":"base-modal__exitDone_uakct"};
|
|
15
15
|
require('./index.css')
|
|
16
16
|
|
|
17
17
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
package/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 2wz55 */
|
|
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_uakct {
|
|
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_uakct {
|
|
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_uakct {
|
|
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_uakct {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
.base-
|
|
43
|
+
.base-modal__backdrop_uakct {
|
|
44
44
|
z-index: 0;
|
|
45
45
|
}
|
|
46
|
-
.base-
|
|
47
|
-
.base-
|
|
46
|
+
.base-modal__appear_uakct,
|
|
47
|
+
.base-modal__enter_uakct {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
50
|
-
.base-
|
|
51
|
-
.base-
|
|
50
|
+
.base-modal__appearActive_uakct,
|
|
51
|
+
.base-modal__enterActive_uakct {
|
|
52
52
|
opacity: 1;
|
|
53
53
|
transition: opacity 200ms ease-in;
|
|
54
54
|
}
|
|
55
|
-
.base-
|
|
55
|
+
.base-modal__exit_uakct {
|
|
56
56
|
opacity: 1;
|
|
57
57
|
}
|
|
58
|
-
.base-
|
|
59
|
-
.base-
|
|
58
|
+
.base-modal__exitActive_uakct,
|
|
59
|
+
.base-modal__exitDone_uakct {
|
|
60
60
|
opacity: 0;
|
|
61
61
|
transition: opacity 200ms ease-out;
|
|
62
62
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { BaseModal, BaseModalContext } from './Component.js';
|
|
2
|
+
export { getScrollbarSize, handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
|
|
1
3
|
import 'react';
|
|
2
4
|
import 'react-focus-lock';
|
|
3
5
|
import 'react-merge-refs';
|
|
@@ -7,7 +9,5 @@ import 'classnames';
|
|
|
7
9
|
import '@alfalab/core-components-backdrop/modern';
|
|
8
10
|
import '@alfalab/core-components-portal/modern';
|
|
9
11
|
import '@alfalab/core-components-stack/modern';
|
|
10
|
-
import '@alfalab/core-components-global-store/modern';
|
|
11
|
-
export { getScrollbarSize, handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
|
|
12
|
-
export { BaseModal, BaseModalContext } from './Component.js';
|
|
13
12
|
import './matches-polyfill.js';
|
|
13
|
+
import '@alfalab/core-components-global-store/modern';
|
package/modern/utils.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ declare function isScrolledToBottom(target: HTMLElement): boolean;
|
|
|
3
3
|
declare function hasScrollbar(target: HTMLElement): boolean;
|
|
4
4
|
declare const getScrollbarSize: () => number;
|
|
5
5
|
declare const restoreContainerStyles: (container: HTMLElement) => void;
|
|
6
|
-
declare const handleContainer: (container?: HTMLElement
|
|
6
|
+
declare const handleContainer: (container?: HTMLElement) => void;
|
|
7
7
|
export { isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-base-modal",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.7",
|
|
4
4
|
"description": "BaseModal component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"directory": "dist"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@alfalab/core-components-backdrop": "^3.0.
|
|
17
|
-
"@alfalab/core-components-global-store": "^2.0.
|
|
18
|
-
"@alfalab/core-components-portal": "^3.1.
|
|
19
|
-
"@alfalab/core-components-stack": "^4.0.
|
|
16
|
+
"@alfalab/core-components-backdrop": "^3.0.2",
|
|
17
|
+
"@alfalab/core-components-global-store": "^2.0.3",
|
|
18
|
+
"@alfalab/core-components-portal": "^3.1.2",
|
|
19
|
+
"@alfalab/core-components-stack": "^4.0.2",
|
|
20
20
|
"@juggle/resize-observer": "^3.3.1",
|
|
21
21
|
"classnames": "^2.3.1",
|
|
22
22
|
"react-focus-lock": "^2.9.1",
|
package/utils.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ declare function isScrolledToBottom(target: HTMLElement): boolean;
|
|
|
3
3
|
declare function hasScrollbar(target: HTMLElement): boolean;
|
|
4
4
|
declare const getScrollbarSize: () => number;
|
|
5
5
|
declare const restoreContainerStyles: (container: HTMLElement) => void;
|
|
6
|
-
declare const handleContainer: (container?: HTMLElement
|
|
6
|
+
declare const handleContainer: (container?: HTMLElement) => void;
|
|
7
7
|
export { isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer };
|
package/utils.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var coreComponentsGlobalStore = require('@alfalab/core-components-global-store');
|
|
6
4
|
|
|
7
5
|
function isScrolledToTop(target) {
|
|
@@ -80,7 +78,7 @@ var handleContainer = function (container) {
|
|
|
80
78
|
});
|
|
81
79
|
// Вычисляем стили, чтобы получить реальный `padding` c шириной сколлбара
|
|
82
80
|
// eslint-disable-next-line no-param-reassign
|
|
83
|
-
container.style.paddingRight = getPaddingRight(container) + scrollbarSize
|
|
81
|
+
container.style.paddingRight = "".concat(getPaddingRight(container) + scrollbarSize, "px");
|
|
84
82
|
}
|
|
85
83
|
var parent = container.parentElement;
|
|
86
84
|
var scrollContainer =
|