@snack-uikit/alert 0.12.1 → 0.13.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/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/AlertTop/AlertTop.d.ts +1 -1
- package/dist/components/AlertTop/AlertTop.js +1 -1
- package/package.json +3 -3
- package/src/components/Alert/Alert.tsx +1 -2
- package/src/components/AlertTop/AlertTop.tsx +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.13.0 (2024-08-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **FF-3788:** updated typescript to v5 ([89e3338](https://github.com/cloud-ru-tech/snack-uikit/commit/89e3338a3ef4df24e4c20d9a9c8cd16e7934ba63))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* **PDS-349:** link property external deleted ([fe15016](https://github.com/cloud-ru-tech/snack-uikit/commit/fe150162c9a6bdec5d43dabe1e1a8296ddbe0cd4))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## 0.12.1 (2024-07-29)
|
|
7
23
|
|
|
8
24
|
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ import { InfoFilledSVG } from '@snack-uikit/icons';
|
|
|
58
58
|
| icon | `boolean` | true | Отображать иконку |
|
|
59
59
|
| title | `string` | - | Заголовок |
|
|
60
60
|
| truncate | `{ title?: number; }` | '{ <br>title: 1 }' | Максимальное кол-во строк <br> - `title` - в заголовке |
|
|
61
|
-
| link | `Pick<LinkProps, "text" \| "target" \| "onClick" \| "href" \| "appearance"
|
|
61
|
+
| link | `Pick<LinkProps, "text" \| "target" \| "onClick" \| "href" \| "appearance">` | - | Cсылка |
|
|
62
62
|
| onClose | `() => void` | - | Колбек закрытия |
|
|
63
63
|
| appearance | enum Appearance: `"neutral"`, `"primary"`, `"error"`, `"warning"`, `"success"`, `"info"` | neutral | Внешний вид |
|
|
64
64
|
| outline | `boolean` | - | Внешний бордер |
|
|
@@ -74,7 +74,7 @@ import { InfoFilledSVG } from '@snack-uikit/icons';
|
|
|
74
74
|
| icon | `boolean` | true | Отображать иконку |
|
|
75
75
|
| title | `string` | - | Заголовок |
|
|
76
76
|
| truncate | `{ title?: number; }` | '{ <br>title: 1 }' | Максимальное кол-во строк <br> - `title` - в заголовке |
|
|
77
|
-
| link | `Pick<LinkProps, "text" \| "target" \| "onClick" \| "href" \| "appearance"
|
|
77
|
+
| link | `Pick<LinkProps, "text" \| "target" \| "onClick" \| "href" \| "appearance">` | - | Cсылка |
|
|
78
78
|
| action | `AlertButtonProps` | - | Кнопка дополнительного действия |
|
|
79
79
|
| onClose | `() => void` | - | Колбек закрытия |
|
|
80
80
|
| appearance | enum Appearance: `"neutral"`, `"primary"`, `"error"`, `"warning"`, `"success"`, `"info"` | neutral | Внешний вид |
|
|
@@ -19,7 +19,7 @@ export type AlertProps = WithSupportProps<{
|
|
|
19
19
|
/** Описание */
|
|
20
20
|
description: ReactNode;
|
|
21
21
|
/** Cсылка */
|
|
22
|
-
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'
|
|
22
|
+
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
|
|
23
23
|
/** Колбек закрытия */
|
|
24
24
|
onClose?: () => void;
|
|
25
25
|
/** Внешний вид */
|
|
@@ -27,5 +27,5 @@ export function Alert(_a) {
|
|
|
27
27
|
var { icon = true, title, truncate, link, description, onClose, appearance = APPEARANCE.Neutral, className, actions, outline, size = 'm' } = _a, rest = __rest(_a, ["icon", "title", "truncate", "link", "description", "onClose", "appearance", "className", "actions", "outline", "size"]);
|
|
28
28
|
return (_jsxs("div", Object.assign({ className: cn(styles.alert, {
|
|
29
29
|
[styles.alertOutline]: outline,
|
|
30
|
-
}, className) }, extractSupportProps(rest), { "data-color": APPEARANCE_TO_COLOR_MAP[appearance], "data-size": size, children: [_jsxs("div", { className: styles.body, "data-size": size, children: [icon && (_jsx("div", { className: styles.icon, "data-color": APPEARANCE_TO_COLOR_MAP[appearance], "data-test-id": 'alert__icon', "data-size": size, children: getIcon(appearance, size === 's' ? 16 : 24) })), _jsxs("div", { className: styles.contentLayout, children: [title && (_jsx(TruncateString, { text: title, maxLines: (_b = truncate === null || truncate === void 0 ? void 0 : truncate.title) !== null && _b !== void 0 ? _b : 1, className: styles.title, "data-test-id": 'alert__title', "data-size": size })), _jsx("span", { "data-test-id": 'alert__description', className: styles.description, "data-size": size, children: description }), link && (_jsx("span", { children: _jsx(Link, Object.assign({
|
|
30
|
+
}, className) }, extractSupportProps(rest), { "data-color": APPEARANCE_TO_COLOR_MAP[appearance], "data-size": size, children: [_jsxs("div", { className: styles.body, "data-size": size, children: [icon && (_jsx("div", { className: styles.icon, "data-color": APPEARANCE_TO_COLOR_MAP[appearance], "data-test-id": 'alert__icon', "data-size": size, children: getIcon(appearance, size === 's' ? 16 : 24) })), _jsxs("div", { className: styles.contentLayout, children: [title && (_jsx(TruncateString, { text: title, maxLines: (_b = truncate === null || truncate === void 0 ? void 0 : truncate.title) !== null && _b !== void 0 ? _b : 1, className: styles.title, "data-test-id": 'alert__title', "data-size": size })), _jsx("span", { "data-test-id": 'alert__description', className: styles.description, "data-size": size, children: description }), link && (_jsx("span", { children: _jsx(Link, Object.assign({}, link, { appearance: APPEARANCE_TO_COLOR_MAP[appearance], textMode: 'default', size: size, "data-test-id": 'alert__link' })) }))] }), onClose && (_jsx(AlertButton, { onClick: onClose, appearance: APPEARANCE_TO_COLOR_MAP[appearance], icon: _jsx(CrossSVG, {}), variant: 'simple', dataTestId: 'alert__close-button' }))] }), actions && (_jsxs("div", { className: styles.footer, "data-size": size, children: [actions.primary && (_jsx(AlertButton, Object.assign({}, actions.primary, { appearance: APPEARANCE_TO_COLOR_MAP[appearance], variant: 'simple', size: size }))), (actions === null || actions === void 0 ? void 0 : actions.secondary) && (_jsx(AlertButton, Object.assign({}, actions.secondary, { appearance: APPEARANCE_TO_COLOR_MAP[appearance], variant: 'simple', size: size })))] }))] })));
|
|
31
31
|
}
|
|
@@ -19,7 +19,7 @@ export type AlertTopProps = WithSupportProps<{
|
|
|
19
19
|
/** Описание */
|
|
20
20
|
description: ReactNode;
|
|
21
21
|
/** Cсылка */
|
|
22
|
-
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'
|
|
22
|
+
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
|
|
23
23
|
/** Кнопка дополнительного действия */
|
|
24
24
|
action?: AlertButtonProps;
|
|
25
25
|
/** Колбек закрытия */
|
|
@@ -26,5 +26,5 @@ import styles from './styles.module.css';
|
|
|
26
26
|
export function AlertTop(_a) {
|
|
27
27
|
var _b;
|
|
28
28
|
var { icon = true, title, description, link, onClose, truncate, appearance = APPEARANCE.Neutral, action, className } = _a, rest = __rest(_a, ["icon", "title", "description", "link", "onClose", "truncate", "appearance", "action", "className"]);
|
|
29
|
-
return (_jsxs("div", Object.assign({ className: cn(styles.alertTop, className) }, extractSupportProps(rest), { "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], children: [_jsxs("div", { className: styles.contentWrapper, children: [icon && (_jsx("div", { className: styles.icon, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], "data-test-id": 'alert-top__icon', children: getIcon(appearance, 24) })), _jsxs("div", { className: styles.contentLayout, children: [_jsxs("div", { className: styles.textLayout, children: [title && (_jsx("div", { className: styles.title, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], "data-test-id": 'alert-top__title', children: _jsx(TruncateString, { text: title, maxLines: (_b = truncate === null || truncate === void 0 ? void 0 : truncate.title) !== null && _b !== void 0 ? _b : 1 }) })), _jsx("span", { className: styles.description, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], "data-test-id": 'alert-top__description', children: description })] }), link && (_jsx("span", { children: _jsx(Link, Object.assign({
|
|
29
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.alertTop, className) }, extractSupportProps(rest), { "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], children: [_jsxs("div", { className: styles.contentWrapper, children: [icon && (_jsx("div", { className: styles.icon, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], "data-test-id": 'alert-top__icon', children: getIcon(appearance, 24) })), _jsxs("div", { className: styles.contentLayout, children: [_jsxs("div", { className: styles.textLayout, children: [title && (_jsx("div", { className: styles.title, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], "data-test-id": 'alert-top__title', children: _jsx(TruncateString, { text: title, maxLines: (_b = truncate === null || truncate === void 0 ? void 0 : truncate.title) !== null && _b !== void 0 ? _b : 1 }) })), _jsx("span", { className: styles.description, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], "data-test-id": 'alert-top__description', children: description })] }), link && (_jsx("span", { children: _jsx(Link, Object.assign({}, link, { appearance: APPEARANCE_TO_COLOR_MAP[appearance], textMode: 'on-accent', size: 'm', "data-test-id": 'alert-top__link' })) }))] })] }), _jsxs("div", { className: styles.actions, children: [action && _jsx(AlertButton, Object.assign({}, action, { appearance: APPEARANCE_TO_COLOR_MAP_INVERT[appearance], variant: 'tonal' })), onClose && (_jsx(AlertButton, { onClick: onClose, appearance: APPEARANCE_TO_COLOR_MAP_INVERT[appearance], icon: _jsx(CrossSVG, {}), variant: 'tonal', dataTestId: 'alert-top__close-button' }))] })] })));
|
|
30
30
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Alert",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.13.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@snack-uikit/icons": "0.22.0",
|
|
36
|
-
"@snack-uikit/link": "0.
|
|
36
|
+
"@snack-uikit/link": "0.13.0",
|
|
37
37
|
"@snack-uikit/loaders": "0.5.2",
|
|
38
38
|
"@snack-uikit/truncate-string": "0.4.20",
|
|
39
39
|
"@snack-uikit/utils": "3.3.0",
|
|
40
40
|
"classnames": "2.3.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "86e5b8fc3a6235eddccf75485b6e989b6baf9a86"
|
|
43
43
|
}
|
|
@@ -28,7 +28,7 @@ export type AlertProps = WithSupportProps<{
|
|
|
28
28
|
/** Описание */
|
|
29
29
|
description: ReactNode;
|
|
30
30
|
/** Cсылка */
|
|
31
|
-
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'
|
|
31
|
+
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
|
|
32
32
|
/** Колбек закрытия */
|
|
33
33
|
onClose?: () => void;
|
|
34
34
|
/** Внешний вид */
|
|
@@ -106,7 +106,6 @@ export function Alert({
|
|
|
106
106
|
{link && (
|
|
107
107
|
<span>
|
|
108
108
|
<Link
|
|
109
|
-
external
|
|
110
109
|
{...link}
|
|
111
110
|
appearance={APPEARANCE_TO_COLOR_MAP[appearance]}
|
|
112
111
|
textMode='default'
|
|
@@ -29,7 +29,7 @@ export type AlertTopProps = WithSupportProps<{
|
|
|
29
29
|
/** Описание */
|
|
30
30
|
description: ReactNode;
|
|
31
31
|
/** Cсылка */
|
|
32
|
-
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'
|
|
32
|
+
link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
|
|
33
33
|
/** Кнопка дополнительного действия */
|
|
34
34
|
action?: AlertButtonProps;
|
|
35
35
|
/** Колбек закрытия */
|
|
@@ -96,7 +96,6 @@ export function AlertTop({
|
|
|
96
96
|
{link && (
|
|
97
97
|
<span>
|
|
98
98
|
<Link
|
|
99
|
-
external
|
|
100
99
|
{...link}
|
|
101
100
|
appearance={APPEARANCE_TO_COLOR_MAP[appearance]}
|
|
102
101
|
textMode='on-accent'
|