@cloud-ru/uikit-product-mobile-modal 0.9.18 → 0.9.20
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 +22 -0
- package/dist/cjs/components/AdaptiveDrawer/AdaptiveDrawer.d.ts +10 -0
- package/dist/cjs/components/AdaptiveDrawer/AdaptiveDrawer.js +34 -0
- package/dist/cjs/components/AdaptiveDrawer/index.d.ts +1 -0
- package/dist/cjs/components/AdaptiveDrawer/index.js +17 -0
- package/dist/cjs/components/AdaptiveModal/AdaptiveModal.d.ts +10 -0
- package/dist/cjs/components/AdaptiveModal/AdaptiveModal.js +31 -0
- package/dist/cjs/components/AdaptiveModal/index.d.ts +1 -0
- package/dist/cjs/components/AdaptiveModal/index.js +17 -0
- package/dist/cjs/components/MobileModal/MobileModal.d.ts +46 -0
- package/dist/cjs/components/MobileModal/MobileModal.js +47 -0
- package/dist/cjs/components/MobileModal/index.d.ts +1 -0
- package/dist/cjs/components/MobileModal/index.js +17 -0
- package/dist/cjs/components/MobileModal/styles.module.css +21 -0
- package/dist/cjs/components/MobileModalCustom/MobileModalCustom.d.ts +28 -0
- package/dist/cjs/components/MobileModalCustom/MobileModalCustom.js +27 -0
- package/dist/cjs/components/MobileModalCustom/index.d.ts +1 -0
- package/dist/cjs/components/MobileModalCustom/index.js +17 -0
- package/dist/cjs/components/index.d.ts +4 -0
- package/dist/cjs/components/index.js +20 -0
- package/dist/cjs/constants.d.ts +37 -0
- package/dist/cjs/constants.js +40 -0
- package/dist/cjs/helperComponents/Body/Body.d.ts +11 -0
- package/dist/cjs/helperComponents/Body/Body.js +27 -0
- package/dist/cjs/helperComponents/Body/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Body/index.js +17 -0
- package/dist/cjs/helperComponents/Body/styles.module.css +16 -0
- package/dist/cjs/helperComponents/Footer/Footer.d.ts +13 -0
- package/dist/cjs/helperComponents/Footer/Footer.js +26 -0
- package/dist/cjs/helperComponents/Footer/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Footer/index.js +17 -0
- package/dist/cjs/helperComponents/Footer/styles.module.css +37 -0
- package/dist/cjs/helperComponents/Header/Header.d.ts +16 -0
- package/dist/cjs/helperComponents/Header/Header.js +28 -0
- package/dist/cjs/helperComponents/Header/index.d.ts +2 -0
- package/dist/cjs/helperComponents/Header/index.js +18 -0
- package/dist/cjs/helperComponents/Header/styles.module.css +56 -0
- package/dist/cjs/helperComponents/Header/types.d.ts +4 -0
- package/dist/cjs/helperComponents/Header/types.js +2 -0
- package/dist/cjs/helperComponents/index.d.ts +3 -0
- package/dist/cjs/helperComponents/index.js +19 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/types.d.ts +6 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +17 -0
- package/dist/cjs/utils.js +28 -0
- package/dist/esm/components/AdaptiveDrawer/AdaptiveDrawer.d.ts +10 -0
- package/dist/esm/components/AdaptiveDrawer/AdaptiveDrawer.js +30 -0
- package/dist/esm/components/AdaptiveDrawer/index.d.ts +1 -0
- package/dist/esm/components/AdaptiveDrawer/index.js +1 -0
- package/dist/esm/components/AdaptiveModal/AdaptiveModal.d.ts +10 -0
- package/dist/esm/components/AdaptiveModal/AdaptiveModal.js +27 -0
- package/dist/esm/components/AdaptiveModal/index.d.ts +1 -0
- package/dist/esm/components/AdaptiveModal/index.js +1 -0
- package/dist/esm/components/MobileModal/MobileModal.d.ts +46 -0
- package/dist/esm/components/MobileModal/MobileModal.js +41 -0
- package/dist/esm/components/MobileModal/index.d.ts +1 -0
- package/dist/esm/components/MobileModal/index.js +1 -0
- package/dist/esm/components/MobileModal/styles.module.css +21 -0
- package/dist/esm/components/MobileModalCustom/MobileModalCustom.d.ts +28 -0
- package/dist/esm/components/MobileModalCustom/MobileModalCustom.js +24 -0
- package/dist/esm/components/MobileModalCustom/index.d.ts +1 -0
- package/dist/esm/components/MobileModalCustom/index.js +1 -0
- package/dist/esm/components/index.d.ts +4 -0
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/constants.d.ts +37 -0
- package/dist/esm/constants.js +37 -0
- package/dist/esm/helperComponents/Body/Body.d.ts +11 -0
- package/dist/esm/helperComponents/Body/Body.js +21 -0
- package/dist/esm/helperComponents/Body/index.d.ts +1 -0
- package/dist/esm/helperComponents/Body/index.js +1 -0
- package/dist/esm/helperComponents/Body/styles.module.css +16 -0
- package/dist/esm/helperComponents/Footer/Footer.d.ts +13 -0
- package/dist/esm/helperComponents/Footer/Footer.js +20 -0
- package/dist/esm/helperComponents/Footer/index.d.ts +1 -0
- package/dist/esm/helperComponents/Footer/index.js +1 -0
- package/dist/esm/helperComponents/Footer/styles.module.css +37 -0
- package/dist/esm/helperComponents/Header/Header.d.ts +16 -0
- package/dist/esm/helperComponents/Header/Header.js +22 -0
- package/dist/esm/helperComponents/Header/index.d.ts +2 -0
- package/dist/esm/helperComponents/Header/index.js +2 -0
- package/dist/esm/helperComponents/Header/styles.module.css +56 -0
- package/dist/esm/helperComponents/Header/types.d.ts +4 -0
- package/dist/esm/helperComponents/Header/types.js +1 -0
- package/dist/esm/helperComponents/index.d.ts +3 -0
- package/dist/esm/helperComponents/index.js +3 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +6 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +17 -0
- package/dist/esm/utils.js +24 -0
- package/package.json +6 -5
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.footerActions{
|
|
2
|
+
gap:var(--space-modal-footer-action-row-gap, 8px);
|
|
3
|
+
display:flex;
|
|
4
|
+
flex-direction:row-reverse;
|
|
5
|
+
flex-wrap:wrap-reverse;
|
|
6
|
+
align-items:center;
|
|
7
|
+
justify-content:center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.footerDisclaimer{
|
|
11
|
+
display:flex;
|
|
12
|
+
flex-direction:column;
|
|
13
|
+
align-items:flex-end;
|
|
14
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.footer{
|
|
18
|
+
padding:0 var(--dimension-2m, 16px) var(--dimension-3m, 24px) var(--dimension-2m, 16px);
|
|
19
|
+
gap:var(--dimension-2m, 16px);
|
|
20
|
+
display:flex;
|
|
21
|
+
flex-direction:column;
|
|
22
|
+
}
|
|
23
|
+
.footer[data-align=vertical]{
|
|
24
|
+
align-items:center;
|
|
25
|
+
}
|
|
26
|
+
.footer[data-align=vertical] .footerActions{
|
|
27
|
+
width:100%;
|
|
28
|
+
}
|
|
29
|
+
.footer[data-align=vertical] .footerDisclaimer{
|
|
30
|
+
align-items:center;
|
|
31
|
+
}
|
|
32
|
+
.footer[data-align=center]{
|
|
33
|
+
align-items:center;
|
|
34
|
+
}
|
|
35
|
+
.footer[data-align=center] .footerDisclaimer{
|
|
36
|
+
align-items:center;
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MobileQuestionTooltipProps } from '@sbercloud/uikit-product-mobile-tooltip';
|
|
3
|
+
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
|
+
import { ContentAlign } from '../../types';
|
|
5
|
+
export type ModalHeaderProps = WithSupportProps<{
|
|
6
|
+
/** Заголовок модального окна */
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** Тултип для заголовка */
|
|
9
|
+
titleTooltip?: MobileQuestionTooltipProps['tip'];
|
|
10
|
+
/** Подзаголовок */
|
|
11
|
+
subtitle?: ReactNode;
|
|
12
|
+
/** Выравнивание контента */
|
|
13
|
+
align?: ContentAlign;
|
|
14
|
+
className?: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function ModalHeader({ title, titleTooltip, subtitle, align, className, ...rest }: ModalHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ModalHeader = ModalHeader;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const uikit_product_mobile_tooltip_1 = require("@sbercloud/uikit-product-mobile-tooltip");
|
|
21
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
22
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
23
|
+
const constants_1 = require("../../constants");
|
|
24
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
25
|
+
function ModalHeader(_a) {
|
|
26
|
+
var { title, titleTooltip, subtitle, align = constants_1.CONTENT_ALIGN.Default, className } = _a, rest = __rest(_a, ["title", "titleTooltip", "subtitle", "align", "className"]);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.header, className) }, (0, utils_1.extractSupportProps)(rest), { "data-test-id": constants_1.TEST_IDS.header, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.headlineLayout, "data-align": align, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.headline, children: (0, jsx_runtime_1.jsxs)(typography_1.Typography.SansHeadlineS, { className: styles_module_scss_1.default.title, "data-test-id": constants_1.TEST_IDS.title, children: [title, titleTooltip && ((0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.questionTooltip, children: (0, jsx_runtime_1.jsx)(uikit_product_mobile_tooltip_1.MobileQuestionTooltip, { tip: titleTooltip, size: 's', "data-test-id": constants_1.TEST_IDS.tooltip }) }))] }) }), subtitle && ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.subtitle, "data-test-id": constants_1.TEST_IDS.subtitle, children: subtitle }))] }) })));
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Header"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.header{
|
|
2
|
+
}
|
|
3
|
+
|
|
4
|
+
.title{
|
|
5
|
+
display:inline;
|
|
6
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
7
|
+
word-break:break-word;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.subtitle{
|
|
11
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.questionTooltip{
|
|
15
|
+
display:inline-flex;
|
|
16
|
+
height:var(--dimension-4m, 32px);
|
|
17
|
+
padding-left:4px;
|
|
18
|
+
}
|
|
19
|
+
.questionTooltip > span{
|
|
20
|
+
transform:translate(0, 4px);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.image{
|
|
24
|
+
border-top-left-radius:var(--radius-modal-modal-window, 12px);
|
|
25
|
+
border-top-right-radius:var(--radius-modal-modal-window, 12px);
|
|
26
|
+
height:var(--size-modal-image, 184px);
|
|
27
|
+
display:block;
|
|
28
|
+
width:100%;
|
|
29
|
+
-o-object-fit:cover;
|
|
30
|
+
object-fit:cover;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.icon{
|
|
34
|
+
padding-top:var(--space-modal-icon-decor, 32px);
|
|
35
|
+
display:flex;
|
|
36
|
+
justify-content:center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.headlineLayout{
|
|
40
|
+
padding:var(--dimension-3m, 24px) var(--dimension-2m, 16px) 0;
|
|
41
|
+
gap:var(--dimension-1m, 8px);
|
|
42
|
+
display:flex;
|
|
43
|
+
flex-direction:column;
|
|
44
|
+
}
|
|
45
|
+
.headlineLayout[data-align=center]{
|
|
46
|
+
align-items:center;
|
|
47
|
+
}
|
|
48
|
+
.headlineLayout[data-align=center] .title, .headlineLayout[data-align=center] .subtitle{
|
|
49
|
+
text-align:center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.headline{
|
|
53
|
+
gap:var(--space-modal-headline-layout-headline, 4px);
|
|
54
|
+
display:flex;
|
|
55
|
+
align-items:center;
|
|
56
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Body"), exports);
|
|
18
|
+
__exportStar(require("./Footer"), exports);
|
|
19
|
+
__exportStar(require("./Header"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValueOf } from '@snack-uikit/utils';
|
|
2
|
+
import { ALIGN, CONTENT_ALIGN, MODE, SIZE } from './constants';
|
|
3
|
+
export type Size = ValueOf<typeof SIZE>;
|
|
4
|
+
export type Mode = ValueOf<typeof MODE>;
|
|
5
|
+
export type Align = ValueOf<typeof ALIGN>;
|
|
6
|
+
export type ContentAlign = ValueOf<typeof CONTENT_ALIGN>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Align } from './types';
|
|
2
|
+
export declare function getAlignProps({ align }: {
|
|
3
|
+
align: Align;
|
|
4
|
+
}): {
|
|
5
|
+
header: "default";
|
|
6
|
+
body: "default";
|
|
7
|
+
footer: "vertical";
|
|
8
|
+
} | {
|
|
9
|
+
header: "center";
|
|
10
|
+
body: "center";
|
|
11
|
+
footer: "center";
|
|
12
|
+
} | {
|
|
13
|
+
header: "center";
|
|
14
|
+
body: "center";
|
|
15
|
+
footer: "vertical";
|
|
16
|
+
};
|
|
17
|
+
export declare function getButtonsSize(): "m";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAlignProps = getAlignProps;
|
|
4
|
+
exports.getButtonsSize = getButtonsSize;
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const MAP_ALIGNS = {
|
|
7
|
+
[constants_1.ALIGN.Default]: {
|
|
8
|
+
header: constants_1.CONTENT_ALIGN.Default,
|
|
9
|
+
body: constants_1.CONTENT_ALIGN.Default,
|
|
10
|
+
footer: constants_1.ALIGN.Vertical,
|
|
11
|
+
},
|
|
12
|
+
[constants_1.ALIGN.Center]: {
|
|
13
|
+
header: constants_1.CONTENT_ALIGN.Center,
|
|
14
|
+
body: constants_1.CONTENT_ALIGN.Center,
|
|
15
|
+
footer: constants_1.ALIGN.Center,
|
|
16
|
+
},
|
|
17
|
+
[constants_1.ALIGN.Vertical]: {
|
|
18
|
+
header: constants_1.CONTENT_ALIGN.Center,
|
|
19
|
+
body: constants_1.CONTENT_ALIGN.Center,
|
|
20
|
+
footer: constants_1.ALIGN.Vertical,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
function getAlignProps({ align }) {
|
|
24
|
+
return MAP_ALIGNS[align];
|
|
25
|
+
}
|
|
26
|
+
function getButtonsSize() {
|
|
27
|
+
return 'm';
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WithLayoutType } from '@sbercloud/uikit-product-utils';
|
|
2
|
+
import { DrawerCustom, DrawerProps } from '@snack-uikit/drawer';
|
|
3
|
+
import { MobileModalProps } from '../MobileModal';
|
|
4
|
+
import { MobileModalCustom } from '../MobileModalCustom';
|
|
5
|
+
export type AdaptiveDrawerProps = WithLayoutType<Omit<DrawerProps, 'size'> & {
|
|
6
|
+
size?: DrawerProps['size'] | MobileModalProps['size'];
|
|
7
|
+
}>;
|
|
8
|
+
export declare function AdaptiveDrawer({ layoutType, size, ...props }: AdaptiveDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useAdaptiveDrawerCustom({ layoutType }: WithLayoutType): typeof MobileModalCustom | typeof DrawerCustom;
|
|
10
|
+
export type { DrawerProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
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]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Drawer, DrawerCustom } from '@snack-uikit/drawer';
|
|
14
|
+
import { SIZE } from '../../constants';
|
|
15
|
+
import { MobileModal } from '../MobileModal';
|
|
16
|
+
import { MobileModalCustom } from '../MobileModalCustom';
|
|
17
|
+
export function AdaptiveDrawer(_a) {
|
|
18
|
+
var { layoutType, size } = _a, props = __rest(_a, ["layoutType", "size"]);
|
|
19
|
+
const isMobile = layoutType === 'mobile';
|
|
20
|
+
const mobileSize = size && Object.values(SIZE).includes(size) ? size : undefined;
|
|
21
|
+
const desktopProps = Object.assign(Object.assign({}, props), { size: size && ['s', 'm', 'l'].includes(size) ? size : undefined });
|
|
22
|
+
return isMobile ? (
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
_jsx(MobileModal, Object.assign({ size: mobileSize }, props))) : (_jsx(Drawer, Object.assign({}, desktopProps)));
|
|
26
|
+
}
|
|
27
|
+
export function useAdaptiveDrawerCustom({ layoutType }) {
|
|
28
|
+
const isMobile = layoutType === 'mobile';
|
|
29
|
+
return isMobile ? MobileModalCustom : DrawerCustom;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AdaptiveDrawer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AdaptiveDrawer';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WithLayoutType } from '@sbercloud/uikit-product-utils';
|
|
2
|
+
import { ModalCustom, ModalProps } from '@snack-uikit/modal';
|
|
3
|
+
import { MobileModalProps } from '../MobileModal';
|
|
4
|
+
import { MobileModalCustom } from '../MobileModalCustom';
|
|
5
|
+
export type AdaptiveModalProps = WithLayoutType<Omit<ModalProps, 'size'> & {
|
|
6
|
+
size?: ModalProps['size'] | MobileModalProps['size'];
|
|
7
|
+
}>;
|
|
8
|
+
export declare function AdaptiveModal({ layoutType, size, ...props }: AdaptiveModalProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useAdaptiveModalCustom({ layoutType }: WithLayoutType): typeof MobileModalCustom | typeof ModalCustom;
|
|
10
|
+
export type { ModalProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
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]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Modal, ModalCustom } from '@snack-uikit/modal';
|
|
14
|
+
import { SIZE } from '../../constants';
|
|
15
|
+
import { MobileModal } from '../MobileModal';
|
|
16
|
+
import { MobileModalCustom } from '../MobileModalCustom';
|
|
17
|
+
export function AdaptiveModal(_a) {
|
|
18
|
+
var { layoutType, size } = _a, props = __rest(_a, ["layoutType", "size"]);
|
|
19
|
+
const isMobile = layoutType === 'mobile';
|
|
20
|
+
const mobileSize = size && Object.values(SIZE).includes(size) ? size : undefined;
|
|
21
|
+
const desktopProps = Object.assign(Object.assign({}, props), { size: size && ['s', 'm', 'l'].includes(size) ? size : undefined });
|
|
22
|
+
return isMobile ? _jsx(MobileModal, Object.assign({ size: mobileSize }, props)) : _jsx(Modal, Object.assign({}, desktopProps));
|
|
23
|
+
}
|
|
24
|
+
export function useAdaptiveModalCustom({ layoutType }) {
|
|
25
|
+
const isMobile = layoutType === 'mobile';
|
|
26
|
+
return isMobile ? MobileModalCustom : ModalCustom;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AdaptiveModal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AdaptiveModal';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonFilledProps, ButtonOutlineProps, ButtonSimpleProps } from '@snack-uikit/button';
|
|
3
|
+
import { LinkProps } from '@snack-uikit/link';
|
|
4
|
+
import { Align } from '../../types';
|
|
5
|
+
import { MobileModalCustom, MobileModalCustomProps } from '../MobileModalCustom';
|
|
6
|
+
export type MobileModalProps = Omit<MobileModalCustomProps, 'children'> & {
|
|
7
|
+
/** Заголовок модального окна */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Всплывающая подсказка для заголовка */
|
|
10
|
+
titleTooltip?: MobileModalCustom.HeaderProps['titleTooltip'];
|
|
11
|
+
/** Подзаголовок */
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
/** Содержимое модального окна */
|
|
14
|
+
content?: MobileModalCustom.BodyProps['content'];
|
|
15
|
+
/** Основная кнопка действия */
|
|
16
|
+
approveButton: Omit<ButtonFilledProps, 'size' | 'data-test-id'>;
|
|
17
|
+
/** Кнопка отмены */
|
|
18
|
+
cancelButton?: Omit<ButtonOutlineProps, 'size' | 'data-test-id'>;
|
|
19
|
+
/** Вторая кнопка действия */
|
|
20
|
+
additionalButton?: Omit<ButtonSimpleProps, 'size' | 'data-test-id'>;
|
|
21
|
+
/** Небольшой текст под кнопками футера с возможностью передать дополнительно ссылку */
|
|
22
|
+
disclaimer?: {
|
|
23
|
+
text: string;
|
|
24
|
+
link?: Pick<LinkProps, 'text' | 'href' | 'target'>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Выравнивание, для разных размеров доступны разные значения
|
|
28
|
+
* <br> для size=`s` - все
|
|
29
|
+
*/
|
|
30
|
+
align?: Align;
|
|
31
|
+
/**
|
|
32
|
+
* Максимальное кол-во строк
|
|
33
|
+
* <br> - `title` - в заголовке
|
|
34
|
+
* <br> - `subtitle` - в подзаголовке
|
|
35
|
+
* @default '{ <br>title: 1; <br>subtitle: 2; }'
|
|
36
|
+
*/
|
|
37
|
+
truncate?: {
|
|
38
|
+
title?: number;
|
|
39
|
+
subtitle?: number;
|
|
40
|
+
};
|
|
41
|
+
/** Управление состоянием загрузки */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/** Содержимое состояния загрузки вместо спиннера по умолчанию */
|
|
44
|
+
loadingState?: ReactNode;
|
|
45
|
+
};
|
|
46
|
+
export declare function MobileModal({ title, titleTooltip, subtitle, content, approveButton, cancelButton, additionalButton, disclaimer, align, loading, loadingState, ...rest }: MobileModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
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]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import cn from 'classnames';
|
|
14
|
+
import { useMemo } from 'react';
|
|
15
|
+
import { ButtonFilled, ButtonOutline, ButtonSimple, } from '@snack-uikit/button';
|
|
16
|
+
import { Link } from '@snack-uikit/link';
|
|
17
|
+
import { Spinner } from '@snack-uikit/loaders';
|
|
18
|
+
import { Typography } from '@snack-uikit/typography';
|
|
19
|
+
import { ALIGN, TEST_IDS } from '../../constants';
|
|
20
|
+
import { getAlignProps, getButtonsSize } from '../../utils';
|
|
21
|
+
import { MobileModalCustom } from '../MobileModalCustom';
|
|
22
|
+
import styles from './styles.module.css';
|
|
23
|
+
export function MobileModal(_a) {
|
|
24
|
+
var { title, titleTooltip, subtitle, content, approveButton, cancelButton, additionalButton, disclaimer, align = ALIGN.Default, loading, loadingState } = _a, rest = __rest(_a, ["title", "titleTooltip", "subtitle", "content", "approveButton", "cancelButton", "additionalButton", "disclaimer", "align", "loading", "loadingState"]);
|
|
25
|
+
const aligns = getAlignProps({ align });
|
|
26
|
+
const buttonsSize = getButtonsSize();
|
|
27
|
+
const showFooter = !loading && (Boolean(approveButton) || Boolean(cancelButton) || Boolean(additionalButton) || Boolean(disclaimer));
|
|
28
|
+
const body = useMemo(() => {
|
|
29
|
+
if (loading) {
|
|
30
|
+
if (loadingState) {
|
|
31
|
+
return _jsx(MobileModalCustom.Body, { content: loadingState, align: aligns.body });
|
|
32
|
+
}
|
|
33
|
+
return (_jsx(MobileModalCustom.Body, { content: _jsx("div", { className: styles.loaderWrapper, children: _jsx(Spinner, { size: 'm', "data-test-id": TEST_IDS.loadingSpinner }) }), align: aligns.body }));
|
|
34
|
+
}
|
|
35
|
+
if (content) {
|
|
36
|
+
return _jsx(MobileModalCustom.Body, { className: styles.modalBody, content: content, align: aligns.body });
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}, [aligns.body, content, loading, loadingState]);
|
|
40
|
+
return (_jsxs(MobileModalCustom, Object.assign({}, rest, { children: [_jsx(MobileModalCustom.Header, { className: cn({ [styles.modalHeader]: !content }), title: title, titleTooltip: titleTooltip, subtitle: subtitle, align: aligns.header }), body, showFooter && (_jsx(MobileModalCustom.Footer, { actions: _jsxs(_Fragment, { children: [approveButton && (_jsx(ButtonFilled, Object.assign({ appearance: 'primary' }, approveButton, { size: buttonsSize, className: cn(styles.footerButton, approveButton.className), "data-test-id": TEST_IDS.approveButton }))), cancelButton && (_jsx(ButtonOutline, Object.assign({ appearance: 'neutral' }, cancelButton, { size: buttonsSize, className: cn(styles.footerButton, cancelButton.className), "data-test-id": TEST_IDS.cancelButton }))), additionalButton && (_jsx(ButtonSimple, Object.assign({ appearance: 'neutral' }, additionalButton, { size: buttonsSize, className: cn(styles.footerButton, additionalButton.className), "data-test-id": TEST_IDS.additionalButton })))] }), disclaimer: disclaimer && (_jsxs(_Fragment, { children: [_jsx(Typography.SansBodyS, { "data-test-id": TEST_IDS.disclaimerText, children: disclaimer.text }), disclaimer.link && _jsx(Link, Object.assign({}, disclaimer.link, { size: 's', "data-test-id": TEST_IDS.disclaimerLink }))] })), align: aligns.footer, className: styles.modalFooter }))] })));
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileModal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileModal';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.modalFooter[data-align=vertical] .footerButton{
|
|
2
|
+
width:100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.modalBody{
|
|
6
|
+
flex:0 1 auto;
|
|
7
|
+
height:-moz-min-content;
|
|
8
|
+
height:min-content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.modalHeader{
|
|
12
|
+
margin-bottom:24px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.loaderWrapper{
|
|
16
|
+
display:flex;
|
|
17
|
+
align-items:center;
|
|
18
|
+
justify-content:center;
|
|
19
|
+
padding-top:var(--space-modal-body-top-bottom, 4px);
|
|
20
|
+
padding-bottom:var(--space-modal-footer-bottom, 32px);
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MobileDrawerCustomProps } from '@sbercloud/uikit-product-mobile-drawer';
|
|
2
|
+
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
|
+
import { ModalBody, ModalBodyProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps } from '../../helperComponents';
|
|
4
|
+
import { Mode, Size } from '../../types';
|
|
5
|
+
export type MobileModalCustomProps = Pick<MobileDrawerCustomProps, 'open' | 'onClose' | 'className' | 'children' | 'closeButtonEnabled' | 'closeOnPopstate'> & WithSupportProps<{
|
|
6
|
+
/**
|
|
7
|
+
* Режим отображения модального окна:
|
|
8
|
+
* <br> - __`Regular`__ - есть кнопка закрытия, клик на оверлей и нажатие кнопки `Esc` закрывают модалку
|
|
9
|
+
* <br> - __`Aggressive`__ - есть кнопка закрытия, но выключен клик на оверлей и не работает закрытие по клавише `Esc`
|
|
10
|
+
* <br> - __`Forced`__ - закрыть модальное окно можно только по нажатию на кнопку действия в нижней части
|
|
11
|
+
* @default Mode.Regular
|
|
12
|
+
*/
|
|
13
|
+
mode?: Mode;
|
|
14
|
+
/**
|
|
15
|
+
* Размер модального окна
|
|
16
|
+
* @default Size.Auto
|
|
17
|
+
*/
|
|
18
|
+
size?: Size;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function MobileModalCustom({ size, mode, closeButtonEnabled, ...rest }: MobileModalCustomProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare namespace MobileModalCustom {
|
|
22
|
+
type HeaderProps = ModalHeaderProps;
|
|
23
|
+
type BodyProps = ModalBodyProps;
|
|
24
|
+
type FooterProps = ModalFooterProps;
|
|
25
|
+
const Header: typeof ModalHeader;
|
|
26
|
+
const Body: typeof ModalBody;
|
|
27
|
+
const Footer: typeof ModalFooter;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
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]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { MobileDrawerCustom } from '@sbercloud/uikit-product-mobile-drawer';
|
|
14
|
+
import { MODE, SIZE } from '../../constants';
|
|
15
|
+
import { ModalBody, ModalFooter, ModalHeader, } from '../../helperComponents';
|
|
16
|
+
export function MobileModalCustom(_a) {
|
|
17
|
+
var { size = SIZE.Auto, mode = MODE.Regular, closeButtonEnabled = false } = _a, rest = __rest(_a, ["size", "mode", "closeButtonEnabled"]);
|
|
18
|
+
return (_jsx(MobileDrawerCustom, Object.assign({}, rest, { modalMode: mode, size: size === SIZE.Auto ? 'auto' : '100%', hasBorderRadius: true, position: 'bottom', swipeEnabled: true, closeButtonEnabled: closeButtonEnabled })));
|
|
19
|
+
}
|
|
20
|
+
(function (MobileModalCustom) {
|
|
21
|
+
MobileModalCustom.Header = ModalHeader;
|
|
22
|
+
MobileModalCustom.Body = ModalBody;
|
|
23
|
+
MobileModalCustom.Footer = ModalFooter;
|
|
24
|
+
})(MobileModalCustom || (MobileModalCustom = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileModalCustom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileModalCustom';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const SIZE: {
|
|
2
|
+
readonly Full: "full";
|
|
3
|
+
readonly Auto: "auto";
|
|
4
|
+
};
|
|
5
|
+
export declare const MODE: {
|
|
6
|
+
readonly Regular: "regular";
|
|
7
|
+
readonly Aggressive: "aggressive";
|
|
8
|
+
readonly Forced: "forced";
|
|
9
|
+
};
|
|
10
|
+
export declare const ALIGN: {
|
|
11
|
+
readonly Default: "default";
|
|
12
|
+
readonly Center: "center";
|
|
13
|
+
readonly Vertical: "vertical";
|
|
14
|
+
};
|
|
15
|
+
export declare const CONTENT_ALIGN: {
|
|
16
|
+
readonly Default: "default";
|
|
17
|
+
readonly Center: "center";
|
|
18
|
+
};
|
|
19
|
+
export declare const TEST_IDS: {
|
|
20
|
+
overlay: string;
|
|
21
|
+
closeButton: string;
|
|
22
|
+
header: string;
|
|
23
|
+
title: string;
|
|
24
|
+
subtitle: string;
|
|
25
|
+
tooltip: string;
|
|
26
|
+
icon: string;
|
|
27
|
+
image: string;
|
|
28
|
+
content: string;
|
|
29
|
+
footer: string;
|
|
30
|
+
approveButton: string;
|
|
31
|
+
cancelButton: string;
|
|
32
|
+
additionalButton: string;
|
|
33
|
+
disclaimer: string;
|
|
34
|
+
disclaimerText: string;
|
|
35
|
+
disclaimerLink: string;
|
|
36
|
+
loadingSpinner: string;
|
|
37
|
+
};
|