@snack-uikit/modal 0.20.2-preview-02d918ac.0 → 0.20.2
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 +11 -0
- package/dist/cjs/components/Modal/Modal.js +21 -20
- package/dist/cjs/components/ModalCustom/ModalCustom.js +24 -15
- package/dist/cjs/helperComponents/Body/Body.js +4 -5
- package/dist/cjs/helperComponents/ButtonClose/ButtonClose.js +1 -3
- package/dist/cjs/helperComponents/Footer/Footer.js +5 -6
- package/dist/cjs/helperComponents/Header/Header.js +7 -8
- package/dist/cjs/helperComponents/OverlayElement/OverlayElement.js +8 -9
- package/dist/cjs/utils.js +6 -12
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## 0.20.2 (2026-07-03)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/link@0.18.3]($PUBLIC_PROJECT_URL/blob/master/packages/link/CHANGELOG.md)
|
|
10
|
+
* [@snack-uikit/tooltip@0.18.15]($PUBLIC_PROJECT_URL/blob/master/packages/tooltip/CHANGELOG.md)
|
|
11
|
+
* [@snack-uikit/truncate-string@0.7.14]($PUBLIC_PROJECT_URL/blob/master/packages/truncate-string/CHANGELOG.md)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.20.1 (2026-06-24)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -29,26 +29,27 @@ const utils_1 = require("../../utils");
|
|
|
29
29
|
const ModalCustom_1 = require("../ModalCustom");
|
|
30
30
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
31
31
|
function Modal(_a) {
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
var open = _a.open,
|
|
33
|
+
onClose = _a.onClose,
|
|
34
|
+
_a$size = _a.size,
|
|
35
|
+
size = _a$size === void 0 ? constants_1.SIZE.S : _a$size,
|
|
36
|
+
_a$mode = _a.mode,
|
|
37
|
+
mode = _a$mode === void 0 ? constants_1.MODE.Regular : _a$mode,
|
|
38
|
+
_a$align = _a.align,
|
|
39
|
+
align = _a$align === void 0 ? constants_1.ALIGN.Default : _a$align,
|
|
40
|
+
title = _a.title,
|
|
41
|
+
titleTooltip = _a.titleTooltip,
|
|
42
|
+
subtitle = _a.subtitle,
|
|
43
|
+
pictureProp = _a.picture,
|
|
44
|
+
content = _a.content,
|
|
45
|
+
approveButton = _a.approveButton,
|
|
46
|
+
cancelButton = _a.cancelButton,
|
|
47
|
+
additionalButton = _a.additionalButton,
|
|
48
|
+
disclaimer = _a.disclaimer,
|
|
49
|
+
truncate = _a.truncate,
|
|
50
|
+
className = _a.className,
|
|
51
|
+
loading = _a.loading,
|
|
52
|
+
loadingState = _a.loadingState,
|
|
52
53
|
rest = __rest(_a, ["open", "onClose", "size", "mode", "align", "title", "titleTooltip", "subtitle", "picture", "content", "approveButton", "cancelButton", "additionalButton", "disclaimer", "truncate", "className", "loading", "loadingState"]);
|
|
53
54
|
const aligns = (0, utils_1.getAlignProps)({
|
|
54
55
|
align,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
3
5
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
6
|
var t = {};
|
|
5
7
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -27,22 +29,29 @@ const helperComponents_1 = require("../../helperComponents");
|
|
|
27
29
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
28
30
|
const utils_2 = require("./utils");
|
|
29
31
|
function ModalCustom(_a) {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
var open = _a.open,
|
|
33
|
+
onClose = _a.onClose,
|
|
34
|
+
_a$size = _a.size,
|
|
35
|
+
size = _a$size === void 0 ? constants_1.SIZE.S : _a$size,
|
|
36
|
+
_a$mode = _a.mode,
|
|
37
|
+
mode = _a$mode === void 0 ? constants_1.MODE.Regular : _a$mode,
|
|
38
|
+
children = _a.children,
|
|
39
|
+
className = _a.className,
|
|
40
|
+
closeOnPopstate = _a.closeOnPopstate,
|
|
41
|
+
animationDuration = _a.animationDuration,
|
|
42
|
+
_a$animationDurationP = _a.animationDurationPercent,
|
|
43
|
+
animationDurationPercent = _a$animationDurationP === void 0 ? 0.4 : _a$animationDurationP,
|
|
41
44
|
rest = __rest(_a, ["open", "onClose", "size", "mode", "children", "className", "closeOnPopstate", "animationDuration", "animationDurationPercent"]);
|
|
42
45
|
const animDuration = animationDuration !== null && animationDuration !== void 0 ? animationDuration : 0;
|
|
43
46
|
const isAnimated = animDuration > 0;
|
|
44
|
-
const
|
|
45
|
-
|
|
47
|
+
const _ref = (0, react_1.useState)(open),
|
|
48
|
+
_ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
49
|
+
shouldRender = _ref2[0],
|
|
50
|
+
setShouldRender = _ref2[1];
|
|
51
|
+
const _ref3 = (0, react_1.useState)(constants_1.ANIMATION_STATE.Entering),
|
|
52
|
+
_ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
53
|
+
animationState = _ref4[0],
|
|
54
|
+
setAnimationState = _ref4[1];
|
|
46
55
|
(0, react_1.useEffect)(() => {
|
|
47
56
|
if (!isAnimated) return;
|
|
48
57
|
if (open) {
|
|
@@ -73,8 +82,8 @@ function ModalCustom(_a) {
|
|
|
73
82
|
}
|
|
74
83
|
const animDelay = Math.round(animDuration * animationDurationPercent);
|
|
75
84
|
const contentStyle = isAnimated ? {
|
|
76
|
-
'--_modal-anim-duration':
|
|
77
|
-
'--_modal-anim-delay':
|
|
85
|
+
'--_modal-anim-duration': "".concat(animDuration, "ms"),
|
|
86
|
+
'--_modal-anim-delay': "".concat(animDelay, "ms")
|
|
78
87
|
} : undefined;
|
|
79
88
|
return (0, jsx_runtime_1.jsxs)(react_modal_1.default, {
|
|
80
89
|
data: Object.assign(Object.assign({}, (0, utils_2.getDataTestAttributes)(rest)), {
|
|
@@ -24,11 +24,10 @@ const utils_1 = require("@snack-uikit/utils");
|
|
|
24
24
|
const constants_1 = require("../../constants");
|
|
25
25
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
26
26
|
function ModalBody(_a) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _a,
|
|
27
|
+
var content = _a.content,
|
|
28
|
+
_a$align = _a.align,
|
|
29
|
+
align = _a$align === void 0 ? constants_1.CONTENT_ALIGN.Default : _a$align,
|
|
30
|
+
className = _a.className,
|
|
32
31
|
rest = __rest(_a, ["content", "align", "className"]);
|
|
33
32
|
return (0, jsx_runtime_1.jsx)(scroll_1.Scroll, Object.assign({
|
|
34
33
|
size: 'm',
|
|
@@ -14,9 +14,7 @@ const icons_1 = require("@snack-uikit/icons");
|
|
|
14
14
|
const constants_1 = require("../../constants");
|
|
15
15
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
16
|
function ButtonClose(_ref) {
|
|
17
|
-
let
|
|
18
|
-
onClick
|
|
19
|
-
} = _ref;
|
|
17
|
+
let onClick = _ref.onClick;
|
|
20
18
|
return (0, jsx_runtime_1.jsx)("button", {
|
|
21
19
|
type: 'button',
|
|
22
20
|
className: styles_module_scss_1.default.buttonClose,
|
|
@@ -23,12 +23,11 @@ const utils_1 = require("@snack-uikit/utils");
|
|
|
23
23
|
const constants_1 = require("../../constants");
|
|
24
24
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
25
25
|
function ModalFooter(_a) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _a,
|
|
26
|
+
var actions = _a.actions,
|
|
27
|
+
disclaimer = _a.disclaimer,
|
|
28
|
+
_a$align = _a.align,
|
|
29
|
+
align = _a$align === void 0 ? constants_1.ALIGN.Default : _a$align,
|
|
30
|
+
className = _a.className,
|
|
32
31
|
rest = __rest(_a, ["actions", "disclaimer", "align", "className"]);
|
|
33
32
|
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
34
33
|
"data-align": align,
|
|
@@ -27,14 +27,13 @@ const constants_1 = require("../../constants");
|
|
|
27
27
|
const utils_2 = require("../../utils");
|
|
28
28
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
29
29
|
function ModalHeader(_a) {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _a,
|
|
30
|
+
var title = _a.title,
|
|
31
|
+
titleTooltip = _a.titleTooltip,
|
|
32
|
+
subtitle = _a.subtitle,
|
|
33
|
+
_a$align = _a.align,
|
|
34
|
+
align = _a$align === void 0 ? constants_1.CONTENT_ALIGN.Default : _a$align,
|
|
35
|
+
picture = _a.picture,
|
|
36
|
+
className = _a.className,
|
|
38
37
|
rest = __rest(_a, ["title", "titleTooltip", "subtitle", "align", "picture", "className"]);
|
|
39
38
|
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
40
39
|
className: (0, classnames_1.default)(styles_module_scss_1.default.header, className)
|
|
@@ -14,13 +14,12 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
14
14
|
const constants_1 = require("../../constants");
|
|
15
15
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
16
|
function OverlayElement(_ref) {
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
blur = false,
|
|
21
|
-
animationDuration,
|
|
22
|
-
animationState
|
|
23
|
-
} = _ref;
|
|
17
|
+
let onClose = _ref.onClose,
|
|
18
|
+
content = _ref.content,
|
|
19
|
+
_ref$blur = _ref.blur,
|
|
20
|
+
blur = _ref$blur === void 0 ? false : _ref$blur,
|
|
21
|
+
animationDuration = _ref.animationDuration,
|
|
22
|
+
animationState = _ref.animationState;
|
|
24
23
|
const handleClick = e => {
|
|
25
24
|
e.stopPropagation();
|
|
26
25
|
onClose();
|
|
@@ -31,8 +30,8 @@ function OverlayElement(_ref) {
|
|
|
31
30
|
const backdropDuration = animationDuration !== undefined ? Math.round(animationDuration * 0.625) : undefined;
|
|
32
31
|
const exitDelay = animationDuration !== undefined ? Math.round(animationDuration * 0.4) : 0;
|
|
33
32
|
const overlayStyle = animationDuration !== undefined ? {
|
|
34
|
-
'--_modal-anim-duration':
|
|
35
|
-
'--_modal-anim-exit-delay':
|
|
33
|
+
'--_modal-anim-duration': "".concat(backdropDuration, "ms"),
|
|
34
|
+
'--_modal-anim-exit-delay': "".concat(exitDelay, "ms")
|
|
36
35
|
} : undefined;
|
|
37
36
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
38
37
|
children: [(0, jsx_runtime_1.jsx)("div", {
|
package/dist/cjs/utils.js
CHANGED
|
@@ -26,10 +26,8 @@ const MAP_ALIGNS = {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
function getAlignProps(_ref) {
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
size
|
|
32
|
-
} = _ref;
|
|
29
|
+
let align = _ref.align,
|
|
30
|
+
size = _ref.size;
|
|
33
31
|
if (size === constants_1.SIZE.L) {
|
|
34
32
|
return MAP_ALIGNS[constants_1.ALIGN.Default];
|
|
35
33
|
}
|
|
@@ -39,10 +37,8 @@ function getAlignProps(_ref) {
|
|
|
39
37
|
return MAP_ALIGNS[align];
|
|
40
38
|
}
|
|
41
39
|
function getButtonsSize(_ref2) {
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
size
|
|
45
|
-
} = _ref2;
|
|
40
|
+
let align = _ref2.align,
|
|
41
|
+
size = _ref2.size;
|
|
46
42
|
switch (true) {
|
|
47
43
|
case align === constants_1.ALIGN.Vertical && size === constants_1.SIZE.S:
|
|
48
44
|
return 'l';
|
|
@@ -56,10 +52,8 @@ function isPictureImage(picture) {
|
|
|
56
52
|
return 'src' in picture;
|
|
57
53
|
}
|
|
58
54
|
function getPicture(_ref3) {
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
picture
|
|
62
|
-
} = _ref3;
|
|
55
|
+
let size = _ref3.size,
|
|
56
|
+
picture = _ref3.picture;
|
|
63
57
|
switch (size) {
|
|
64
58
|
case constants_1.SIZE.S:
|
|
65
59
|
return picture;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Modal",
|
|
7
|
-
"version": "0.20.2
|
|
7
|
+
"version": "0.20.2",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"@snack-uikit/button": "0.19.19",
|
|
40
40
|
"@snack-uikit/icon-predefined": "0.7.12",
|
|
41
41
|
"@snack-uikit/icons": "0.27.7",
|
|
42
|
-
"@snack-uikit/link": "0.18.3
|
|
42
|
+
"@snack-uikit/link": "0.18.3",
|
|
43
43
|
"@snack-uikit/loaders": "0.9.11",
|
|
44
44
|
"@snack-uikit/scroll": "0.11.0",
|
|
45
|
-
"@snack-uikit/tooltip": "0.18.15
|
|
46
|
-
"@snack-uikit/truncate-string": "0.7.14
|
|
45
|
+
"@snack-uikit/tooltip": "0.18.15",
|
|
46
|
+
"@snack-uikit/truncate-string": "0.7.14",
|
|
47
47
|
"@snack-uikit/typography": "0.8.13",
|
|
48
48
|
"@snack-uikit/utils": "4.0.2",
|
|
49
49
|
"classnames": "2.5.1",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react-modal": "3.16.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "864821fceaa6bbb61080166d14f1682fa16e3f85"
|
|
56
56
|
}
|