@snack-uikit/modal 0.12.6 → 0.12.7-preview-d96c83e8.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/dist/cjs/components/Modal/Modal.js +118 -0
- package/dist/cjs/components/Modal/index.js +25 -0
- package/dist/cjs/components/Modal/types.js +5 -0
- package/dist/cjs/components/ModalCustom/ModalCustom.js +74 -0
- package/dist/cjs/components/ModalCustom/index.js +25 -0
- package/dist/cjs/components/ModalCustom/utils.js +16 -0
- package/dist/cjs/components/index.js +26 -0
- package/dist/cjs/constants.js +43 -0
- package/dist/cjs/helperComponents/Body/Body.js +42 -0
- package/dist/cjs/helperComponents/Body/index.js +25 -0
- package/dist/cjs/helperComponents/ButtonClose/ButtonClose.js +28 -0
- package/dist/cjs/helperComponents/ButtonClose/index.js +25 -0
- package/dist/cjs/helperComponents/Footer/Footer.js +47 -0
- package/dist/cjs/helperComponents/Footer/index.js +25 -0
- package/dist/cjs/helperComponents/Header/Header.js +76 -0
- package/dist/cjs/helperComponents/Header/index.js +26 -0
- package/dist/cjs/helperComponents/Header/types.js +5 -0
- package/dist/cjs/helperComponents/OverlayElement/OverlayElement.js +33 -0
- package/dist/cjs/helperComponents/OverlayElement/index.js +25 -0
- package/dist/cjs/helperComponents/index.js +29 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/utils.js +71 -0
- package/dist/esm/components/Modal/Modal.d.ts +3 -0
- package/dist/esm/components/Modal/index.js +1 -0
- package/dist/esm/components/Modal/types.d.ts +61 -0
- package/dist/esm/components/ModalCustom/ModalCustom.d.ts +36 -0
- package/dist/esm/components/ModalCustom/index.js +1 -0
- package/dist/esm/components/ModalCustom/utils.d.ts +1 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/constants.d.ts +37 -0
- package/dist/esm/helperComponents/Body/Body.d.ts +11 -0
- package/dist/esm/helperComponents/Body/index.js +1 -0
- package/dist/esm/helperComponents/ButtonClose/ButtonClose.d.ts +5 -0
- package/dist/esm/helperComponents/ButtonClose/index.js +1 -0
- package/dist/esm/helperComponents/Footer/Footer.d.ts +13 -0
- package/dist/esm/helperComponents/Footer/index.js +1 -0
- package/dist/esm/helperComponents/Header/Header.d.ts +20 -0
- package/dist/esm/helperComponents/Header/index.js +2 -0
- package/dist/esm/helperComponents/Header/types.d.ts +4 -0
- package/dist/esm/helperComponents/OverlayElement/OverlayElement.d.ts +7 -0
- package/dist/esm/helperComponents/OverlayElement/index.js +1 -0
- package/dist/esm/helperComponents/index.js +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +6 -0
- package/dist/esm/utils.d.ts +30 -0
- package/package.json +16 -14
- package/dist/components/Modal/styles.module.css +0 -3
- package/dist/components/ModalCustom/styles.module.css +0 -41
- package/dist/helperComponents/Body/styles.module.css +0 -13
- package/dist/helperComponents/ButtonClose/styles.module.css +0 -35
- package/dist/helperComponents/Footer/styles.module.css +0 -39
- package/dist/helperComponents/Header/styles.module.css +0 -55
- package/dist/helperComponents/OverlayElement/styles.module.css +0 -13
- /package/dist/{components → cjs/components}/Modal/Modal.d.ts +0 -0
- /package/dist/{components → cjs/components}/Modal/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/Modal/types.d.ts +0 -0
- /package/dist/{components → cjs/components}/ModalCustom/ModalCustom.d.ts +0 -0
- /package/dist/{components → cjs/components}/ModalCustom/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ModalCustom/utils.d.ts +0 -0
- /package/dist/{components → cjs/components}/index.d.ts +0 -0
- /package/dist/{constants.d.ts → cjs/constants.d.ts} +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Body/Body.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Body/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/ButtonClose/ButtonClose.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/ButtonClose/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Footer/Footer.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Footer/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Header/Header.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Header/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Header/types.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/OverlayElement/OverlayElement.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/OverlayElement/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/index.d.ts +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/dist/{utils.d.ts → cjs/utils.d.ts} +0 -0
- /package/dist/{components → esm/components}/Modal/Modal.js +0 -0
- /package/dist/{components/Modal/index.js → esm/components/Modal/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/Modal/types.js +0 -0
- /package/dist/{components → esm/components}/ModalCustom/ModalCustom.js +0 -0
- /package/dist/{components/ModalCustom/index.js → esm/components/ModalCustom/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ModalCustom/utils.js +0 -0
- /package/dist/{components/index.js → esm/components/index.d.ts} +0 -0
- /package/dist/{constants.js → esm/constants.js} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/Body/Body.js +0 -0
- /package/dist/{helperComponents/Body/index.js → esm/helperComponents/Body/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/ButtonClose/ButtonClose.js +0 -0
- /package/dist/{helperComponents/ButtonClose/index.js → esm/helperComponents/ButtonClose/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/Footer/Footer.js +0 -0
- /package/dist/{helperComponents/Footer/index.js → esm/helperComponents/Footer/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/Header/Header.js +0 -0
- /package/dist/{helperComponents/Header/index.js → esm/helperComponents/Header/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/Header/types.js +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/OverlayElement/OverlayElement.js +0 -0
- /package/dist/{helperComponents/OverlayElement/index.js → esm/helperComponents/OverlayElement/index.d.ts} +0 -0
- /package/dist/{helperComponents/index.js → esm/helperComponents/index.d.ts} +0 -0
- /package/dist/{index.js → esm/index.d.ts} +0 -0
- /package/dist/{types.js → esm/types.js} +0 -0
- /package/dist/{utils.js → esm/utils.js} +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
"default": mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.Modal = Modal;
|
|
20
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
const button_1 = require("@snack-uikit/button");
|
|
22
|
+
const link_1 = require("@snack-uikit/link");
|
|
23
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
24
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
25
|
+
const constants_1 = require("../../constants");
|
|
26
|
+
const utils_1 = require("../../utils");
|
|
27
|
+
const ModalCustom_1 = require("../ModalCustom");
|
|
28
|
+
const styles_module_scss_1 = __importDefault({});
|
|
29
|
+
function Modal(_a) {
|
|
30
|
+
var {
|
|
31
|
+
open,
|
|
32
|
+
onClose,
|
|
33
|
+
size = constants_1.SIZE.S,
|
|
34
|
+
mode = constants_1.MODE.Regular,
|
|
35
|
+
align = constants_1.ALIGN.Default,
|
|
36
|
+
title,
|
|
37
|
+
titleTooltip,
|
|
38
|
+
subtitle,
|
|
39
|
+
picture: pictureProp,
|
|
40
|
+
content,
|
|
41
|
+
approveButton,
|
|
42
|
+
cancelButton,
|
|
43
|
+
additionalButton,
|
|
44
|
+
disclaimer,
|
|
45
|
+
truncate,
|
|
46
|
+
className
|
|
47
|
+
} = _a,
|
|
48
|
+
rest = __rest(_a, ["open", "onClose", "size", "mode", "align", "title", "titleTooltip", "subtitle", "picture", "content", "approveButton", "cancelButton", "additionalButton", "disclaimer", "truncate", "className"]);
|
|
49
|
+
const aligns = (0, utils_1.getAlignProps)({
|
|
50
|
+
align,
|
|
51
|
+
size
|
|
52
|
+
});
|
|
53
|
+
const buttonsSize = (0, utils_1.getButtonsSize)({
|
|
54
|
+
align,
|
|
55
|
+
size
|
|
56
|
+
});
|
|
57
|
+
const picture = (0, utils_1.getPicture)({
|
|
58
|
+
size,
|
|
59
|
+
picture: pictureProp
|
|
60
|
+
});
|
|
61
|
+
return (0, jsx_runtime_1.jsxs)(ModalCustom_1.ModalCustom, Object.assign({
|
|
62
|
+
open: open,
|
|
63
|
+
onClose: onClose,
|
|
64
|
+
size: size,
|
|
65
|
+
mode: mode,
|
|
66
|
+
className: className
|
|
67
|
+
}, rest, {
|
|
68
|
+
children: [(0, jsx_runtime_1.jsx)(ModalCustom_1.ModalCustom.Header, {
|
|
69
|
+
title: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, {
|
|
70
|
+
text: title,
|
|
71
|
+
maxLines: (truncate === null || truncate === void 0 ? void 0 : truncate.title) || 1
|
|
72
|
+
}),
|
|
73
|
+
titleTooltip: titleTooltip,
|
|
74
|
+
subtitle: subtitle ? (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, {
|
|
75
|
+
text: subtitle,
|
|
76
|
+
maxLines: (truncate === null || truncate === void 0 ? void 0 : truncate.subtitle) || 2
|
|
77
|
+
}) : undefined,
|
|
78
|
+
picture: picture,
|
|
79
|
+
align: aligns.header
|
|
80
|
+
}), Boolean(content) && (0, jsx_runtime_1.jsx)(ModalCustom_1.ModalCustom.Body, {
|
|
81
|
+
content: content,
|
|
82
|
+
align: aligns.body
|
|
83
|
+
}), (0, jsx_runtime_1.jsx)(ModalCustom_1.ModalCustom.Footer, {
|
|
84
|
+
actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
85
|
+
children: [(0, jsx_runtime_1.jsx)(button_1.ButtonFilled, Object.assign({
|
|
86
|
+
appearance: 'primary'
|
|
87
|
+
}, approveButton, {
|
|
88
|
+
size: buttonsSize,
|
|
89
|
+
className: styles_module_scss_1.default.footerButton,
|
|
90
|
+
"data-test-id": constants_1.TEST_IDS.approveButton
|
|
91
|
+
})), cancelButton && (0, jsx_runtime_1.jsx)(button_1.ButtonOutline, Object.assign({
|
|
92
|
+
appearance: 'neutral'
|
|
93
|
+
}, cancelButton, {
|
|
94
|
+
size: buttonsSize,
|
|
95
|
+
className: styles_module_scss_1.default.footerButton,
|
|
96
|
+
"data-test-id": constants_1.TEST_IDS.cancelButton
|
|
97
|
+
})), additionalButton && (0, jsx_runtime_1.jsx)(button_1.ButtonSimple, Object.assign({
|
|
98
|
+
appearance: 'neutral'
|
|
99
|
+
}, additionalButton, {
|
|
100
|
+
size: buttonsSize,
|
|
101
|
+
className: styles_module_scss_1.default.footerButton,
|
|
102
|
+
"data-test-id": constants_1.TEST_IDS.additionalButton
|
|
103
|
+
}))]
|
|
104
|
+
}),
|
|
105
|
+
disclaimer: disclaimer && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
106
|
+
children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, {
|
|
107
|
+
"data-test-id": constants_1.TEST_IDS.disclaimerText,
|
|
108
|
+
children: disclaimer.text
|
|
109
|
+
}), disclaimer.link && (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({}, disclaimer.link, {
|
|
110
|
+
size: 's',
|
|
111
|
+
"data-test-id": constants_1.TEST_IDS.disclaimerLink
|
|
112
|
+
}))]
|
|
113
|
+
}),
|
|
114
|
+
align: aligns.footer,
|
|
115
|
+
className: styles_module_scss_1.default.modalFooter
|
|
116
|
+
})]
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Modal"), exports);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
"default": mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.ModalCustom = ModalCustom;
|
|
20
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
+
const react_modal_1 = __importDefault(require("react-modal"));
|
|
23
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
24
|
+
const constants_1 = require("../../constants");
|
|
25
|
+
const helperComponents_1 = require("../../helperComponents");
|
|
26
|
+
const styles_module_scss_1 = __importDefault({});
|
|
27
|
+
const utils_2 = require("./utils");
|
|
28
|
+
function ModalCustom(_a) {
|
|
29
|
+
var {
|
|
30
|
+
open,
|
|
31
|
+
onClose,
|
|
32
|
+
size = constants_1.SIZE.S,
|
|
33
|
+
mode = constants_1.MODE.Regular,
|
|
34
|
+
children,
|
|
35
|
+
className
|
|
36
|
+
} = _a,
|
|
37
|
+
rest = __rest(_a, ["open", "onClose", "size", "mode", "children", "className"]);
|
|
38
|
+
const handleCloseButtonClick = () => {
|
|
39
|
+
onClose();
|
|
40
|
+
};
|
|
41
|
+
const handleClose = () => {
|
|
42
|
+
if (mode === constants_1.MODE.Regular) {
|
|
43
|
+
onClose();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (!open) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return (0, jsx_runtime_1.jsxs)(react_modal_1.default, {
|
|
50
|
+
data: Object.assign(Object.assign({}, (0, utils_2.getDataTestAttributes)(rest)), {
|
|
51
|
+
size
|
|
52
|
+
}),
|
|
53
|
+
isOpen: true,
|
|
54
|
+
onRequestClose: handleClose,
|
|
55
|
+
appElement: (0, utils_1.isBrowser)() ? document.body : undefined,
|
|
56
|
+
overlayElement: (_, content) => (0, jsx_runtime_1.jsx)(helperComponents_1.OverlayElement, {
|
|
57
|
+
blur: [constants_1.MODE.Forced, constants_1.MODE.Aggressive].includes(mode),
|
|
58
|
+
content: content,
|
|
59
|
+
onClose: handleClose
|
|
60
|
+
}),
|
|
61
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.modal, className),
|
|
62
|
+
children: [mode !== constants_1.MODE.Forced && (0, jsx_runtime_1.jsx)("div", {
|
|
63
|
+
className: styles_module_scss_1.default.headerElements,
|
|
64
|
+
children: (0, jsx_runtime_1.jsx)(helperComponents_1.ButtonClose, {
|
|
65
|
+
onClick: handleCloseButtonClick
|
|
66
|
+
})
|
|
67
|
+
}), children]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
(function (ModalCustom) {
|
|
71
|
+
ModalCustom.Header = helperComponents_1.ModalHeader;
|
|
72
|
+
ModalCustom.Body = helperComponents_1.ModalBody;
|
|
73
|
+
ModalCustom.Footer = helperComponents_1.ModalFooter;
|
|
74
|
+
})(ModalCustom || (exports.ModalCustom = ModalCustom = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./ModalCustom"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDataTestAttributes = void 0;
|
|
7
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
8
|
+
const getDataTestAttributes = rest => {
|
|
9
|
+
const dataTestProps = (0, utils_1.extractDataTestProps)(rest);
|
|
10
|
+
return Object.keys(dataTestProps).reduce((acc, key) => {
|
|
11
|
+
const newKey = key.replace('data-', '');
|
|
12
|
+
acc[newKey] = dataTestProps[key];
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
15
|
+
};
|
|
16
|
+
exports.getDataTestAttributes = getDataTestAttributes;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./ModalCustom"), exports);
|
|
26
|
+
__exportStar(require("./Modal"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TEST_IDS = exports.CONTENT_ALIGN = exports.ALIGN = exports.MODE = exports.SIZE = void 0;
|
|
7
|
+
exports.SIZE = {
|
|
8
|
+
S: 's',
|
|
9
|
+
M: 'm',
|
|
10
|
+
L: 'l'
|
|
11
|
+
};
|
|
12
|
+
exports.MODE = {
|
|
13
|
+
Regular: 'regular',
|
|
14
|
+
Aggressive: 'aggressive',
|
|
15
|
+
Forced: 'forced'
|
|
16
|
+
};
|
|
17
|
+
exports.ALIGN = {
|
|
18
|
+
Default: 'default',
|
|
19
|
+
Center: 'center',
|
|
20
|
+
Vertical: 'vertical'
|
|
21
|
+
};
|
|
22
|
+
exports.CONTENT_ALIGN = {
|
|
23
|
+
Default: 'default',
|
|
24
|
+
Center: 'center'
|
|
25
|
+
};
|
|
26
|
+
exports.TEST_IDS = {
|
|
27
|
+
overlay: 'modal__overlay',
|
|
28
|
+
closeButton: 'modal__close-button',
|
|
29
|
+
header: 'modal__header',
|
|
30
|
+
title: 'modal__title',
|
|
31
|
+
subtitle: 'modal__subtitle',
|
|
32
|
+
tooltip: 'modal__title-tooltip',
|
|
33
|
+
icon: 'modal__icon',
|
|
34
|
+
image: 'modal__image',
|
|
35
|
+
content: 'modal__body',
|
|
36
|
+
footer: 'modal__footer',
|
|
37
|
+
approveButton: 'modal__approve-button',
|
|
38
|
+
cancelButton: 'modal__cancel-button',
|
|
39
|
+
additionalButton: 'modal__additional-button',
|
|
40
|
+
disclaimer: 'modal__disclaimer',
|
|
41
|
+
disclaimerText: 'modal__disclaimer-text',
|
|
42
|
+
disclaimerLink: 'modal__disclaimer-link'
|
|
43
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
"default": mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.ModalBody = ModalBody;
|
|
20
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
+
const scroll_1 = require("@snack-uikit/scroll");
|
|
23
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
24
|
+
const constants_1 = require("../../constants");
|
|
25
|
+
const styles_module_scss_1 = __importDefault({});
|
|
26
|
+
function ModalBody(_a) {
|
|
27
|
+
var {
|
|
28
|
+
content,
|
|
29
|
+
align = constants_1.CONTENT_ALIGN.Default,
|
|
30
|
+
className
|
|
31
|
+
} = _a,
|
|
32
|
+
rest = __rest(_a, ["content", "align", "className"]);
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(scroll_1.Scroll, Object.assign({
|
|
34
|
+
size: 'm',
|
|
35
|
+
barHideStrategy: 'never',
|
|
36
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.modalBody, className)
|
|
37
|
+
}, (0, utils_1.extractSupportProps)(rest), {
|
|
38
|
+
"data-align": align,
|
|
39
|
+
"data-test-id": constants_1.TEST_IDS.content,
|
|
40
|
+
children: content
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Body"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.ButtonClose = ButtonClose;
|
|
12
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
14
|
+
const constants_1 = require("../../constants");
|
|
15
|
+
const styles_module_scss_1 = __importDefault({});
|
|
16
|
+
function ButtonClose(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
onClick
|
|
19
|
+
} = _ref;
|
|
20
|
+
return (0, jsx_runtime_1.jsx)("button", {
|
|
21
|
+
type: 'button',
|
|
22
|
+
className: styles_module_scss_1.default.buttonClose,
|
|
23
|
+
onClick: onClick,
|
|
24
|
+
"aria-label": 'close modal',
|
|
25
|
+
"data-test-id": constants_1.TEST_IDS.closeButton,
|
|
26
|
+
children: (0, jsx_runtime_1.jsx)(icons_1.CrossSVG, {})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./ButtonClose"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
"default": mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.ModalFooter = ModalFooter;
|
|
20
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
23
|
+
const constants_1 = require("../../constants");
|
|
24
|
+
const styles_module_scss_1 = __importDefault({});
|
|
25
|
+
function ModalFooter(_a) {
|
|
26
|
+
var {
|
|
27
|
+
actions,
|
|
28
|
+
disclaimer,
|
|
29
|
+
align = constants_1.ALIGN.Default,
|
|
30
|
+
className
|
|
31
|
+
} = _a,
|
|
32
|
+
rest = __rest(_a, ["actions", "disclaimer", "align", "className"]);
|
|
33
|
+
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
34
|
+
"data-align": align,
|
|
35
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.footer, className)
|
|
36
|
+
}, (0, utils_1.extractSupportProps)(rest), {
|
|
37
|
+
"data-test-id": constants_1.TEST_IDS.footer,
|
|
38
|
+
children: [(0, jsx_runtime_1.jsx)("div", {
|
|
39
|
+
className: styles_module_scss_1.default.footerActions,
|
|
40
|
+
children: actions
|
|
41
|
+
}), disclaimer && (0, jsx_runtime_1.jsx)("div", {
|
|
42
|
+
className: styles_module_scss_1.default.footerDisclaimer,
|
|
43
|
+
"data-test-id": constants_1.TEST_IDS.disclaimer,
|
|
44
|
+
children: disclaimer
|
|
45
|
+
})]
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Footer"), exports);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
"default": mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.ModalHeader = ModalHeader;
|
|
20
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
+
const icon_predefined_1 = require("@snack-uikit/icon-predefined");
|
|
23
|
+
const tooltip_1 = require("@snack-uikit/tooltip");
|
|
24
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
25
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
26
|
+
const constants_1 = require("../../constants");
|
|
27
|
+
const utils_2 = require("../../utils");
|
|
28
|
+
const styles_module_scss_1 = __importDefault({});
|
|
29
|
+
function ModalHeader(_a) {
|
|
30
|
+
var {
|
|
31
|
+
title,
|
|
32
|
+
titleTooltip,
|
|
33
|
+
subtitle,
|
|
34
|
+
align = constants_1.CONTENT_ALIGN.Default,
|
|
35
|
+
picture,
|
|
36
|
+
className
|
|
37
|
+
} = _a,
|
|
38
|
+
rest = __rest(_a, ["title", "titleTooltip", "subtitle", "align", "picture", "className"]);
|
|
39
|
+
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
40
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.header, className)
|
|
41
|
+
}, (0, utils_1.extractSupportProps)(rest), {
|
|
42
|
+
"data-test-id": constants_1.TEST_IDS.header,
|
|
43
|
+
children: [picture && ((0, utils_2.isPictureImage)(picture) ? (0, jsx_runtime_1.jsx)("img", {
|
|
44
|
+
src: picture.src,
|
|
45
|
+
alt: picture.alt,
|
|
46
|
+
className: styles_module_scss_1.default.image,
|
|
47
|
+
"data-test-id": constants_1.TEST_IDS.image
|
|
48
|
+
}) : (0, jsx_runtime_1.jsx)("div", {
|
|
49
|
+
className: styles_module_scss_1.default.icon,
|
|
50
|
+
"data-test-id": constants_1.TEST_IDS.icon,
|
|
51
|
+
children: (0, jsx_runtime_1.jsx)(icon_predefined_1.IconPredefined, {
|
|
52
|
+
icon: picture,
|
|
53
|
+
size: 'l'
|
|
54
|
+
})
|
|
55
|
+
})), (0, jsx_runtime_1.jsxs)("div", {
|
|
56
|
+
className: styles_module_scss_1.default.headlineLayout,
|
|
57
|
+
"data-align": align,
|
|
58
|
+
children: [(0, jsx_runtime_1.jsxs)("div", {
|
|
59
|
+
className: styles_module_scss_1.default.headline,
|
|
60
|
+
children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansHeadlineS, {
|
|
61
|
+
className: styles_module_scss_1.default.title,
|
|
62
|
+
"data-test-id": constants_1.TEST_IDS.title,
|
|
63
|
+
children: title
|
|
64
|
+
}), titleTooltip && (0, jsx_runtime_1.jsx)(tooltip_1.QuestionTooltip, {
|
|
65
|
+
tip: titleTooltip,
|
|
66
|
+
size: 's',
|
|
67
|
+
"data-test-id": constants_1.TEST_IDS.tooltip
|
|
68
|
+
})]
|
|
69
|
+
}), subtitle && (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, {
|
|
70
|
+
className: styles_module_scss_1.default.subtitle,
|
|
71
|
+
"data-test-id": constants_1.TEST_IDS.subtitle,
|
|
72
|
+
children: subtitle
|
|
73
|
+
})]
|
|
74
|
+
})]
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Header"), exports);
|
|
26
|
+
__exportStar(require("./types"), exports);
|