@cloud-ru/uikit-product-mobile-alert 0.4.64 → 0.4.65
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/AdaptiveAlert/AdaptiveAlert.d.ts +7 -0
- package/dist/cjs/components/AdaptiveAlert/AdaptiveAlert.js +28 -0
- package/dist/cjs/components/AdaptiveAlert/index.d.ts +1 -0
- package/dist/cjs/components/AdaptiveAlert/index.js +17 -0
- package/dist/cjs/components/MobileAlertTop/MobileAlertTop.d.ts +29 -0
- package/dist/cjs/components/MobileAlertTop/MobileAlertTop.js +85 -0
- package/dist/cjs/components/MobileAlertTop/constants.d.ts +8 -0
- package/dist/cjs/components/MobileAlertTop/constants.js +20 -0
- package/dist/cjs/components/MobileAlertTop/index.d.ts +1 -0
- package/dist/cjs/components/MobileAlertTop/index.js +17 -0
- package/dist/cjs/components/MobileAlertTop/styles.module.css +177 -0
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/constants.d.ts +16 -0
- package/dist/cjs/constants.js +31 -0
- package/dist/cjs/helperComponents/AlertButton.d.ts +24 -0
- package/dist/cjs/helperComponents/AlertButton.js +12 -0
- package/dist/cjs/helperComponents/index.d.ts +1 -0
- package/dist/cjs/helperComponents/index.js +17 -0
- package/dist/cjs/helperComponents/styles.module.css +85 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/types.d.ts +4 -0
- package/dist/cjs/types.js +2 -0
- package/dist/esm/components/AdaptiveAlert/AdaptiveAlert.d.ts +7 -0
- package/dist/esm/components/AdaptiveAlert/AdaptiveAlert.js +24 -0
- package/dist/esm/components/AdaptiveAlert/index.d.ts +1 -0
- package/dist/esm/components/AdaptiveAlert/index.js +1 -0
- package/dist/esm/components/MobileAlertTop/MobileAlertTop.d.ts +29 -0
- package/dist/esm/components/MobileAlertTop/MobileAlertTop.js +79 -0
- package/dist/esm/components/MobileAlertTop/constants.d.ts +8 -0
- package/dist/esm/components/MobileAlertTop/constants.js +17 -0
- package/dist/esm/components/MobileAlertTop/index.d.ts +1 -0
- package/dist/esm/components/MobileAlertTop/index.js +1 -0
- package/dist/esm/components/MobileAlertTop/styles.module.css +177 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/constants.d.ts +16 -0
- package/dist/esm/constants.js +28 -0
- package/dist/esm/helperComponents/AlertButton.d.ts +24 -0
- package/dist/esm/helperComponents/AlertButton.js +6 -0
- package/dist/esm/helperComponents/index.d.ts +1 -0
- package/dist/esm/helperComponents/index.js +1 -0
- package/dist/esm/helperComponents/styles.module.css +85 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +4 -0
- package/dist/esm/types.js +1 -0
- package/package.json +5 -4
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.4.65 (2025-11-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **PD-3377:** contributors update to publish all packages ([719fd3e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/719fd3e1249e247443b125c47ea408d92c8395c3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.4.64 (2025-11-12)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WithLayoutType } from '@sbercloud/uikit-product-utils';
|
|
2
|
+
import { AlertProps, AlertTopProps } from '@snack-uikit/alert';
|
|
3
|
+
export type AdaptiveAlertProps = WithLayoutType<AlertProps>;
|
|
4
|
+
export declare function AdaptiveAlert({ layoutType, ...props }: AdaptiveAlertProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export type AdaptiveAlertTopProps = WithLayoutType<AlertTopProps>;
|
|
6
|
+
export declare function AdaptiveAlertTop({ layoutType, ...props }: AdaptiveAlertTopProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type { AlertProps, AlertTopProps };
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.AdaptiveAlert = AdaptiveAlert;
|
|
15
|
+
exports.AdaptiveAlertTop = AdaptiveAlertTop;
|
|
16
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
const alert_1 = require("@snack-uikit/alert");
|
|
18
|
+
const MobileAlertTop_1 = require("../MobileAlertTop");
|
|
19
|
+
function AdaptiveAlert(_a) {
|
|
20
|
+
var { layoutType } = _a, props = __rest(_a, ["layoutType"]);
|
|
21
|
+
const isMobile = layoutType === 'mobile';
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(alert_1.Alert, Object.assign({ truncate: isMobile ? { title: 2 } : undefined }, props));
|
|
23
|
+
}
|
|
24
|
+
function AdaptiveAlertTop(_a) {
|
|
25
|
+
var { layoutType } = _a, props = __rest(_a, ["layoutType"]);
|
|
26
|
+
const isMobile = layoutType === 'mobile';
|
|
27
|
+
return isMobile ? (0, jsx_runtime_1.jsx)(MobileAlertTop_1.MobileAlertTop, Object.assign({}, props)) : (0, jsx_runtime_1.jsx)(alert_1.AlertTop, Object.assign({}, props));
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AdaptiveAlert';
|
|
@@ -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("./AdaptiveAlert"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LinkProps } from '@snack-uikit/link';
|
|
3
|
+
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
|
+
import { AlertButtonProps } from '../../helperComponents';
|
|
5
|
+
import { Appearance } from '../../types';
|
|
6
|
+
export type MobileAlertTopProps = WithSupportProps<{
|
|
7
|
+
/** Заголовок */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Описание */
|
|
10
|
+
description: ReactNode;
|
|
11
|
+
/** Cсылка */
|
|
12
|
+
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
|
|
13
|
+
/** Кнопка дополнительного действия */
|
|
14
|
+
action?: AlertButtonProps;
|
|
15
|
+
/** Колбек закрытия */
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
/** Внешний вид */
|
|
18
|
+
appearance?: Appearance;
|
|
19
|
+
/** CSS-класс */
|
|
20
|
+
className?: string;
|
|
21
|
+
truncate?: {
|
|
22
|
+
title?: number;
|
|
23
|
+
};
|
|
24
|
+
icon?: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Компонент для отображения уведомления вверху экрана.
|
|
28
|
+
*/
|
|
29
|
+
export declare function MobileAlertTop({ title, description, link, onClose, appearance, action, className, ...rest }: MobileAlertTopProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
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.MobileAlertTop = MobileAlertTop;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const react_1 = require("react");
|
|
21
|
+
const uikit_product_icons_1 = require("@sbercloud/uikit-product-icons");
|
|
22
|
+
const link_1 = require("@snack-uikit/link");
|
|
23
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
24
|
+
const constants_1 = require("../../constants");
|
|
25
|
+
const helperComponents_1 = require("../../helperComponents");
|
|
26
|
+
const constants_2 = require("./constants");
|
|
27
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
28
|
+
const ONE_LINE_TEXT_HEIGHT = 20;
|
|
29
|
+
/**
|
|
30
|
+
* Компонент для отображения уведомления вверху экрана.
|
|
31
|
+
*/
|
|
32
|
+
function MobileAlertTop(_a) {
|
|
33
|
+
var { title, description, link, onClose, appearance = constants_1.APPEARANCE.Neutral, action, className } = _a, rest = __rest(_a, ["title", "description", "link", "onClose", "appearance", "action", "className"]);
|
|
34
|
+
const titleRef = (0, react_1.useRef)(null);
|
|
35
|
+
const descriptionRef = (0, react_1.useRef)(null);
|
|
36
|
+
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
37
|
+
const [isTitleLarge, setIsTitleLarge] = (0, react_1.useState)(false);
|
|
38
|
+
const [isDescriptionLarge, setIsDescriptionLarge] = (0, react_1.useState)(false);
|
|
39
|
+
const invertAppearance = constants_2.APPEARANCE_TO_COLOR_MAP_INVERT[appearance];
|
|
40
|
+
const handleExpand = () => setIsExpanded(val => !val);
|
|
41
|
+
const canExpand = Boolean(isTitleLarge || isDescriptionLarge || link || action);
|
|
42
|
+
const showCloseButton = Boolean(onClose && ((canExpand && isExpanded) || !canExpand));
|
|
43
|
+
const showLink = Boolean(link && isExpanded);
|
|
44
|
+
const showAction = Boolean(action && isExpanded);
|
|
45
|
+
const handleClose = event => {
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
48
|
+
};
|
|
49
|
+
const handleActionButtonClick = event => {
|
|
50
|
+
var _a;
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
(_a = action === null || action === void 0 ? void 0 : action.onClick) === null || _a === void 0 ? void 0 : _a.call(action, event);
|
|
53
|
+
};
|
|
54
|
+
const handleLinkClick = event => {
|
|
55
|
+
var _a;
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
(_a = link === null || link === void 0 ? void 0 : link.onClick) === null || _a === void 0 ? void 0 : _a.call(link, event);
|
|
58
|
+
};
|
|
59
|
+
const updateIsLarge = (0, react_1.useCallback)(({ ref, setter }) => {
|
|
60
|
+
const element = ref.current;
|
|
61
|
+
if (element) {
|
|
62
|
+
const { offsetWidth, scrollWidth, offsetHeight } = element;
|
|
63
|
+
setter(offsetHeight > ONE_LINE_TEXT_HEIGHT || scrollWidth > offsetWidth);
|
|
64
|
+
}
|
|
65
|
+
}, []);
|
|
66
|
+
const observeElement = (0, react_1.useCallback)(({ ref, setter }) => {
|
|
67
|
+
const refElement = ref.current;
|
|
68
|
+
if (refElement && (0, utils_1.isBrowser)()) {
|
|
69
|
+
const observer = new ResizeObserver(entities => entities.forEach(entity => {
|
|
70
|
+
if (entity.target === refElement) {
|
|
71
|
+
updateIsLarge({ ref, setter });
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
observer.observe(refElement);
|
|
75
|
+
return () => observer.disconnect();
|
|
76
|
+
}
|
|
77
|
+
}, [updateIsLarge]);
|
|
78
|
+
(0, utils_1.useLayoutEffect)(() => observeElement({ ref: titleRef, setter: setIsTitleLarge }), [observeElement]);
|
|
79
|
+
(0, utils_1.useLayoutEffect)(() => updateIsLarge({ ref: titleRef, setter: setIsTitleLarge }), [title, updateIsLarge]);
|
|
80
|
+
(0, utils_1.useLayoutEffect)(() => observeElement({ ref: descriptionRef, setter: setIsDescriptionLarge }), [observeElement]);
|
|
81
|
+
(0, utils_1.useLayoutEffect)(() => updateIsLarge({ ref: descriptionRef, setter: setIsDescriptionLarge }), [description, updateIsLarge]);
|
|
82
|
+
return (
|
|
83
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
84
|
+
(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.alertTop, className) }, (0, utils_1.extractSupportProps)(rest), { "data-color": invertAppearance, role: 'alert', onClick: canExpand ? handleExpand : undefined, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentWrapper, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentLayout, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.textLayout, "data-expanded": isExpanded || undefined, children: [title && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.title, ref: titleRef, "data-color": invertAppearance, "data-test-id": 'alert-top__title', children: title })), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.description, ref: descriptionRef, "data-color": invertAppearance, "data-test-id": 'alert-top__description', "data-expanded": isExpanded || undefined, children: description })] }), showLink && ((0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({}, link, { onClick: handleLinkClick, appearance: constants_1.APPEARANCE_TO_COLOR_MAP[appearance], textMode: 'on-accent', size: 'm', "data-test-id": 'alert-top__link' })) }))] }), showAction && ((0, jsx_runtime_1.jsx)(helperComponents_1.AlertButton, Object.assign({}, action, { onClick: handleActionButtonClick, appearance: invertAppearance, variant: 'tonal' })))] }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.actions, children: [canExpand && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.expandingIcon, "data-appearance": invertAppearance, "data-test-id": 'alert-top__expanding-icon', children: isExpanded ? (0, jsx_runtime_1.jsx)(uikit_product_icons_1.ChevronUpSVG, {}) : (0, jsx_runtime_1.jsx)(uikit_product_icons_1.ChevronDownSVG, {}) })), showCloseButton && ((0, jsx_runtime_1.jsx)(helperComponents_1.AlertButton, { onClick: handleClose, appearance: invertAppearance, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.CrossSVG, {}), variant: 'tonal', dataTestId: 'alert-top__close-button' }))] })] })));
|
|
85
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APPEARANCE_TO_COLOR_MAP_INVERT = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const COLOR = {
|
|
6
|
+
InvertNeutral: 'invert-neutral',
|
|
7
|
+
Primary: 'primary',
|
|
8
|
+
Red: 'red',
|
|
9
|
+
Yellow: 'yellow',
|
|
10
|
+
Green: 'green',
|
|
11
|
+
Blue: 'blue',
|
|
12
|
+
};
|
|
13
|
+
exports.APPEARANCE_TO_COLOR_MAP_INVERT = {
|
|
14
|
+
[constants_1.APPEARANCE.Neutral]: COLOR.InvertNeutral,
|
|
15
|
+
[constants_1.APPEARANCE.Primary]: COLOR.Primary,
|
|
16
|
+
[constants_1.APPEARANCE.Error]: COLOR.Red,
|
|
17
|
+
[constants_1.APPEARANCE.Warning]: COLOR.Yellow,
|
|
18
|
+
[constants_1.APPEARANCE.Success]: COLOR.Green,
|
|
19
|
+
[constants_1.APPEARANCE.Info]: COLOR.Blue,
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileAlertTop';
|
|
@@ -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("./MobileAlertTop"), exports);
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
.alertTop{
|
|
2
|
+
padding-top:var(--space-alert-top-container-vertical-padding, 8px);
|
|
3
|
+
padding-bottom:var(--space-alert-top-container-vertical-padding, 8px);
|
|
4
|
+
padding-left:var(--space-alert-top-container-horizontal-padding, 16px);
|
|
5
|
+
padding-right:var(--space-alert-top-container-horizontal-padding, 16px);
|
|
6
|
+
gap:var(--space-alert-top-container-gap, 16px);
|
|
7
|
+
display:flex;
|
|
8
|
+
justify-content:space-between;
|
|
9
|
+
box-sizing:border-box;
|
|
10
|
+
gap:0;
|
|
11
|
+
}
|
|
12
|
+
.alertTop[data-color=invert-neutral]{
|
|
13
|
+
background-color:var(--sys-invert-neutral-background, #30303c);
|
|
14
|
+
}
|
|
15
|
+
.alertTop[data-color=primary]{
|
|
16
|
+
background-color:var(--sys-primary-accent-default, #389f74);
|
|
17
|
+
}
|
|
18
|
+
.alertTop[data-color=red]{
|
|
19
|
+
background-color:var(--sys-red-accent-default, #cb3f3e);
|
|
20
|
+
}
|
|
21
|
+
.alertTop[data-color=yellow]{
|
|
22
|
+
background-color:var(--sys-yellow-accent-default, #e2b134);
|
|
23
|
+
}
|
|
24
|
+
.alertTop[data-color=green]{
|
|
25
|
+
background-color:var(--sys-green-accent-default, #57b762);
|
|
26
|
+
}
|
|
27
|
+
.alertTop[data-color=blue]{
|
|
28
|
+
background-color:var(--sys-blue-accent-default, #5388d1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.icon{
|
|
32
|
+
display:flex;
|
|
33
|
+
align-items:center;
|
|
34
|
+
justify-content:center;
|
|
35
|
+
}
|
|
36
|
+
.icon[data-color=invert-neutral]{
|
|
37
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
38
|
+
}
|
|
39
|
+
.icon[data-color=primary]{
|
|
40
|
+
color:var(--sys-primary-on-accent, #fbfffc);
|
|
41
|
+
}
|
|
42
|
+
.icon[data-color=red]{
|
|
43
|
+
color:var(--sys-red-on-accent, #fffbf9);
|
|
44
|
+
}
|
|
45
|
+
.icon[data-color=yellow]{
|
|
46
|
+
color:var(--sys-yellow-on-accent, #583f1f);
|
|
47
|
+
}
|
|
48
|
+
.icon[data-color=green]{
|
|
49
|
+
color:var(--sys-green-on-accent, #fcfefa);
|
|
50
|
+
}
|
|
51
|
+
.icon[data-color=blue]{
|
|
52
|
+
color:var(--sys-blue-on-accent, #fdfeff);
|
|
53
|
+
}
|
|
54
|
+
.icon svg{
|
|
55
|
+
width:var(--size-icon-container-s, 24px) !important;
|
|
56
|
+
height:var(--size-icon-container-s, 24px) !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.title{
|
|
60
|
+
font-family:var(--sans-title-s-font-family, SB Sans Interface);
|
|
61
|
+
font-weight:var(--sans-title-s-font-weight, Semibold);
|
|
62
|
+
line-height:var(--sans-title-s-line-height, 20px);
|
|
63
|
+
font-size:var(--sans-title-s-font-size, 14px);
|
|
64
|
+
letter-spacing:var(--sans-title-s-letter-spacing, 0.15px);
|
|
65
|
+
paragraph-spacing:var(--sans-title-s-paragraph-spacing, 7.7px);
|
|
66
|
+
word-wrap:break-word;
|
|
67
|
+
overflow:hidden;
|
|
68
|
+
text-overflow:ellipsis;
|
|
69
|
+
white-space:nowrap;
|
|
70
|
+
}
|
|
71
|
+
.title[data-color=invert-neutral]{
|
|
72
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
73
|
+
}
|
|
74
|
+
.title[data-color=primary]{
|
|
75
|
+
color:var(--sys-primary-on-accent, #fbfffc);
|
|
76
|
+
}
|
|
77
|
+
.title[data-color=red]{
|
|
78
|
+
color:var(--sys-red-on-accent, #fffbf9);
|
|
79
|
+
}
|
|
80
|
+
.title[data-color=yellow]{
|
|
81
|
+
color:var(--sys-yellow-on-accent, #583f1f);
|
|
82
|
+
}
|
|
83
|
+
.title[data-color=green]{
|
|
84
|
+
color:var(--sys-green-on-accent, #fcfefa);
|
|
85
|
+
}
|
|
86
|
+
.title[data-color=blue]{
|
|
87
|
+
color:var(--sys-blue-on-accent, #fdfeff);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.description{
|
|
91
|
+
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
92
|
+
font-weight:var(--sans-body-m-font-weight, Regular);
|
|
93
|
+
line-height:var(--sans-body-m-line-height, 20px);
|
|
94
|
+
font-size:var(--sans-body-m-font-size, 14px);
|
|
95
|
+
letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
|
|
96
|
+
paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
|
|
97
|
+
word-wrap:break-word;
|
|
98
|
+
overflow:hidden;
|
|
99
|
+
text-overflow:ellipsis;
|
|
100
|
+
white-space:nowrap;
|
|
101
|
+
}
|
|
102
|
+
.description[data-color=invert-neutral]{
|
|
103
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
104
|
+
}
|
|
105
|
+
.description[data-color=primary]{
|
|
106
|
+
color:var(--sys-primary-on-accent, #fbfffc);
|
|
107
|
+
}
|
|
108
|
+
.description[data-color=red]{
|
|
109
|
+
color:var(--sys-red-on-accent, #fffbf9);
|
|
110
|
+
}
|
|
111
|
+
.description[data-color=yellow]{
|
|
112
|
+
color:var(--sys-yellow-on-accent, #583f1f);
|
|
113
|
+
}
|
|
114
|
+
.description[data-color=green]{
|
|
115
|
+
color:var(--sys-green-on-accent, #fcfefa);
|
|
116
|
+
}
|
|
117
|
+
.description[data-color=blue]{
|
|
118
|
+
color:var(--sys-blue-on-accent, #fdfeff);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.contentWrapper{
|
|
122
|
+
display:flex;
|
|
123
|
+
flex-direction:column;
|
|
124
|
+
gap:var(--dimension-1m, 8px);
|
|
125
|
+
align-items:flex-start;
|
|
126
|
+
min-width:0;
|
|
127
|
+
justify-content:center;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.contentLayout{
|
|
131
|
+
gap:var(--space-alert-top-container-content-layout-gap, 2px);
|
|
132
|
+
display:flex;
|
|
133
|
+
flex-direction:column;
|
|
134
|
+
min-width:0;
|
|
135
|
+
width:100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.textLayout{
|
|
139
|
+
overflow:hidden;
|
|
140
|
+
}
|
|
141
|
+
.textLayout[data-expanded] .title, .textLayout[data-expanded] .description{
|
|
142
|
+
overflow:initial;
|
|
143
|
+
text-overflow:initial;
|
|
144
|
+
white-space:initial;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.actions{
|
|
148
|
+
display:flex;
|
|
149
|
+
flex-direction:column;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.expandingIcon{
|
|
153
|
+
display:flex;
|
|
154
|
+
align-items:center;
|
|
155
|
+
justify-content:center;
|
|
156
|
+
flex-shrink:0;
|
|
157
|
+
width:var(--dimension-5m, 40px);
|
|
158
|
+
height:var(--dimension-5m, 40px);
|
|
159
|
+
}
|
|
160
|
+
.expandingIcon[data-appearance=invert-neutral]{
|
|
161
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
162
|
+
}
|
|
163
|
+
.expandingIcon[data-appearance=primary]{
|
|
164
|
+
color:var(--sys-primary-on-accent, #fbfffc);
|
|
165
|
+
}
|
|
166
|
+
.expandingIcon[data-appearance=red]{
|
|
167
|
+
color:var(--sys-red-on-accent, #fffbf9);
|
|
168
|
+
}
|
|
169
|
+
.expandingIcon[data-appearance=yellow]{
|
|
170
|
+
color:var(--sys-yellow-on-accent, #583f1f);
|
|
171
|
+
}
|
|
172
|
+
.expandingIcon[data-appearance=green]{
|
|
173
|
+
color:var(--sys-green-on-accent, #fcfefa);
|
|
174
|
+
}
|
|
175
|
+
.expandingIcon[data-appearance=blue]{
|
|
176
|
+
color:var(--sys-blue-on-accent, #fdfeff);
|
|
177
|
+
}
|
|
@@ -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("./AdaptiveAlert"), exports);
|
|
18
|
+
__exportStar(require("./MobileAlertTop"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LinkProps } from '@snack-uikit/link';
|
|
2
|
+
import { ValueOf } from '@snack-uikit/utils';
|
|
3
|
+
export declare const APPEARANCE: {
|
|
4
|
+
readonly Neutral: "neutral";
|
|
5
|
+
readonly Primary: "primary";
|
|
6
|
+
readonly Error: "error";
|
|
7
|
+
readonly Warning: "warning";
|
|
8
|
+
readonly Success: "success";
|
|
9
|
+
readonly Info: "info";
|
|
10
|
+
};
|
|
11
|
+
export declare const SIZE: {
|
|
12
|
+
readonly S: "s";
|
|
13
|
+
readonly M: "m";
|
|
14
|
+
};
|
|
15
|
+
export declare const APPEARANCE_TO_COLOR_MAP: Record<ValueOf<typeof APPEARANCE>, LinkProps['appearance']>;
|
|
16
|
+
export declare const APPEARANCE_TO_LINK_COLOR_MAP: Record<ValueOf<typeof APPEARANCE>, LinkProps['appearance']>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APPEARANCE_TO_LINK_COLOR_MAP = exports.APPEARANCE_TO_COLOR_MAP = exports.SIZE = exports.APPEARANCE = void 0;
|
|
4
|
+
exports.APPEARANCE = {
|
|
5
|
+
Neutral: 'neutral',
|
|
6
|
+
Primary: 'primary',
|
|
7
|
+
Error: 'error',
|
|
8
|
+
Warning: 'warning',
|
|
9
|
+
Success: 'success',
|
|
10
|
+
Info: 'info',
|
|
11
|
+
};
|
|
12
|
+
exports.SIZE = {
|
|
13
|
+
S: 's',
|
|
14
|
+
M: 'm',
|
|
15
|
+
};
|
|
16
|
+
exports.APPEARANCE_TO_COLOR_MAP = {
|
|
17
|
+
[exports.APPEARANCE.Neutral]: 'neutral',
|
|
18
|
+
[exports.APPEARANCE.Primary]: 'primary',
|
|
19
|
+
[exports.APPEARANCE.Error]: 'red',
|
|
20
|
+
[exports.APPEARANCE.Warning]: 'yellow',
|
|
21
|
+
[exports.APPEARANCE.Success]: 'green',
|
|
22
|
+
[exports.APPEARANCE.Info]: 'blue',
|
|
23
|
+
};
|
|
24
|
+
exports.APPEARANCE_TO_LINK_COLOR_MAP = {
|
|
25
|
+
[exports.APPEARANCE.Neutral]: 'primary',
|
|
26
|
+
[exports.APPEARANCE.Primary]: 'primary',
|
|
27
|
+
[exports.APPEARANCE.Error]: 'red',
|
|
28
|
+
[exports.APPEARANCE.Warning]: 'yellow',
|
|
29
|
+
[exports.APPEARANCE.Success]: 'green',
|
|
30
|
+
[exports.APPEARANCE.Info]: 'blue',
|
|
31
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { LinkProps } from '@snack-uikit/link';
|
|
3
|
+
import { Size } from '../types';
|
|
4
|
+
type PrivateAlertButtonProps = {
|
|
5
|
+
/** Внешний вид */
|
|
6
|
+
appearance?: LinkProps['appearance'] | 'invert-neutral';
|
|
7
|
+
/** Текст кнопки */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Иконка в кнопке */
|
|
10
|
+
icon?: ReactElement;
|
|
11
|
+
/** Вариант отображения */
|
|
12
|
+
variant?: 'simple' | 'tonal';
|
|
13
|
+
/** Колбек клика */
|
|
14
|
+
onClick?(e: MouseEvent<HTMLButtonElement>): void;
|
|
15
|
+
/** Дата тест айди */
|
|
16
|
+
dataTestId?: string;
|
|
17
|
+
/** Управление состоянием загрузки */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/** Размер */
|
|
20
|
+
size?: Size;
|
|
21
|
+
};
|
|
22
|
+
export type AlertButtonProps = Omit<PrivateAlertButtonProps, 'appearance' | 'variant'>;
|
|
23
|
+
export declare function AlertButton({ appearance, text, icon, onClick, dataTestId, loading }: PrivateAlertButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AlertButton = AlertButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const loaders_1 = require("@snack-uikit/loaders");
|
|
9
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
10
|
+
function AlertButton({ appearance, text, icon, onClick, dataTestId, loading = false }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("button", { type: 'button', onClick: onClick, className: styles_module_scss_1.default.alertButton, "data-variant": 'tonal', "data-appearance": appearance, "data-test-id": dataTestId || 'alert__action-button', "data-icon-only": !text || undefined, "data-loading": loading, "data-size": 'm', children: [text && ((0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.text, "data-size": 'm', children: text })), icon && (loading ? (0, jsx_runtime_1.jsx)(loaders_1.Sun, { size: 's' }) : (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.icon, children: icon }))] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AlertButton';
|
|
@@ -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("./AlertButton"), exports);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.alertButton{
|
|
2
|
+
cursor:pointer;
|
|
3
|
+
display:flex;
|
|
4
|
+
align-items:center;
|
|
5
|
+
justify-content:center;
|
|
6
|
+
box-sizing:border-box;
|
|
7
|
+
margin:0;
|
|
8
|
+
padding:0;
|
|
9
|
+
white-space:nowrap;
|
|
10
|
+
background:none;
|
|
11
|
+
border:0;
|
|
12
|
+
}
|
|
13
|
+
.alertButton .text[data-size=m]{
|
|
14
|
+
font-family:var(--sans-label-l-font-family, SB Sans Interface);
|
|
15
|
+
font-weight:var(--sans-label-l-font-weight, Semibold);
|
|
16
|
+
line-height:var(--sans-label-l-line-height, 20px);
|
|
17
|
+
font-size:var(--sans-label-l-font-size, 14px);
|
|
18
|
+
letter-spacing:var(--sans-label-l-letter-spacing, 0px);
|
|
19
|
+
paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
|
|
20
|
+
}
|
|
21
|
+
.alertButton .icon{
|
|
22
|
+
display:inline-flex;
|
|
23
|
+
align-items:center;
|
|
24
|
+
justify-content:center;
|
|
25
|
+
width:var(--size-icon-container-s, 24px);
|
|
26
|
+
height:var(--size-icon-container-s, 24px);
|
|
27
|
+
}
|
|
28
|
+
.alertButton .icon svg{
|
|
29
|
+
max-width:var(--size-icon-container-s, 24px);
|
|
30
|
+
max-height:var(--size-icon-container-s, 24px);
|
|
31
|
+
}
|
|
32
|
+
.alertButton[data-loading=true]{
|
|
33
|
+
cursor:not-allowed;
|
|
34
|
+
}
|
|
35
|
+
.alertButton[data-loading=true] > *{
|
|
36
|
+
cursor:not-allowed;
|
|
37
|
+
}
|
|
38
|
+
.alertButton[data-variant=tonal]{
|
|
39
|
+
height:var(--size-alert-top-button, 32px);
|
|
40
|
+
gap:var(--space-alert-top-button-gap, 4px);
|
|
41
|
+
border-radius:var(--radius-alert-top-button, 4px);
|
|
42
|
+
padding-left:var(--space-alert-top-button-horizontal-padding, 12px);
|
|
43
|
+
padding-right:var(--space-alert-top-button-horizontal-padding, 12px);
|
|
44
|
+
background:var(--sys-opacity-enabled, rgba(255, 255, 255, 0.1607843137));
|
|
45
|
+
}
|
|
46
|
+
.alertButton[data-variant=tonal][data-icon-only]{
|
|
47
|
+
border-radius:var(--radius-alert-top-button, 4px);
|
|
48
|
+
height:var(--size-alert-top-button, 32px);
|
|
49
|
+
width:var(--size-alert-top-button, 32px);
|
|
50
|
+
height:var(--dimension-5m, 40px);
|
|
51
|
+
width:var(--dimension-5m, 40px);
|
|
52
|
+
background:none;
|
|
53
|
+
}
|
|
54
|
+
.alertButton[data-variant=tonal]:hover{
|
|
55
|
+
opacity:unset;
|
|
56
|
+
background-color:var(--sys-opacity-hovered, rgba(255, 255, 255, 0.2392156863));
|
|
57
|
+
}
|
|
58
|
+
.alertButton[data-variant=tonal]:focus-visible{
|
|
59
|
+
outline-width:var(--border-state-focus-s-border-width, 2px);
|
|
60
|
+
outline-style:var(--border-state-focus-s-border-style, solid);
|
|
61
|
+
outline-color:var(--border-state-focus-s-border-color, );
|
|
62
|
+
background-color:var(--sys-opacity-hovered, rgba(255, 255, 255, 0.2392156863));
|
|
63
|
+
outline-color:var(--sys-available-on-complementary, #ffffff);
|
|
64
|
+
}
|
|
65
|
+
.alertButton[data-variant=tonal]:active{
|
|
66
|
+
background-color:var(--sys-opacity-activated, rgba(255, 255, 255, 0.3215686275));
|
|
67
|
+
}
|
|
68
|
+
.alertButton[data-variant=tonal][data-appearance=invert-neutral]{
|
|
69
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
70
|
+
}
|
|
71
|
+
.alertButton[data-variant=tonal][data-appearance=primary]{
|
|
72
|
+
color:var(--sys-primary-on-accent, #fbfffc);
|
|
73
|
+
}
|
|
74
|
+
.alertButton[data-variant=tonal][data-appearance=red]{
|
|
75
|
+
color:var(--sys-red-on-accent, #fffbf9);
|
|
76
|
+
}
|
|
77
|
+
.alertButton[data-variant=tonal][data-appearance=yellow]{
|
|
78
|
+
color:var(--sys-yellow-on-accent, #583f1f);
|
|
79
|
+
}
|
|
80
|
+
.alertButton[data-variant=tonal][data-appearance=green]{
|
|
81
|
+
color:var(--sys-green-on-accent, #fcfefa);
|
|
82
|
+
}
|
|
83
|
+
.alertButton[data-variant=tonal][data-appearance=blue]{
|
|
84
|
+
color:var(--sys-blue-on-accent, #fdfeff);
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|