@snack-uikit/alert 0.12.0 → 0.12.1
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/components/Alert/Alert.js +1 -1
- package/dist/components/AlertTop/AlertTop.js +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +5 -5
- package/package.json +2 -2
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/AlertTop/AlertTop.tsx +1 -1
- package/src/utils.tsx +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.12.1 (2024-07-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **FF-00:** change icon size for size='s' ([17923a9](https://github.com/cloud-ru-tech/snack-uikit/commit/17923a99dbadb946c3ba0e67c2415fc82a4fb3d0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 0.12.0 (2024-07-24)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -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) })), _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({ external: true }, 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 })))] }))] })));
|
|
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({ external: true }, 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
|
}
|
|
@@ -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) })), _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({ external: true }, 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' }))] })] })));
|
|
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({ external: true }, 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/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Appearance } from './types';
|
|
2
|
-
export declare function getIcon(appearance: Appearance): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function getIcon(appearance: Appearance, size: number): import("react/jsx-runtime").JSX.Element;
|
package/dist/utils.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AlarmFilledSVG, CheckFilledSVG, CrossFilledSVG, InfoFilledSVG } from '@snack-uikit/icons';
|
|
3
3
|
import { APPEARANCE } from './constants';
|
|
4
|
-
export function getIcon(appearance) {
|
|
4
|
+
export function getIcon(appearance, size) {
|
|
5
5
|
switch (appearance) {
|
|
6
6
|
case APPEARANCE.Success:
|
|
7
|
-
return _jsx(CheckFilledSVG, {});
|
|
7
|
+
return _jsx(CheckFilledSVG, { size: size });
|
|
8
8
|
case APPEARANCE.Error:
|
|
9
|
-
return _jsx(CrossFilledSVG, {});
|
|
9
|
+
return _jsx(CrossFilledSVG, { size: size });
|
|
10
10
|
case APPEARANCE.Warning:
|
|
11
|
-
return _jsx(AlarmFilledSVG, {});
|
|
11
|
+
return _jsx(AlarmFilledSVG, { size: size });
|
|
12
12
|
case APPEARANCE.Primary:
|
|
13
13
|
case APPEARANCE.Neutral:
|
|
14
14
|
default:
|
|
15
|
-
return _jsx(InfoFilledSVG, {});
|
|
15
|
+
return _jsx(InfoFilledSVG, { size: size });
|
|
16
16
|
}
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Alert",
|
|
7
|
-
"version": "0.12.
|
|
7
|
+
"version": "0.12.1",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@snack-uikit/utils": "3.3.0",
|
|
40
40
|
"classnames": "2.3.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "d1b1ac720c6ea300a6c8cc3b4765609899200af7"
|
|
43
43
|
}
|
package/src/utils.tsx
CHANGED
|
@@ -3,17 +3,17 @@ import { AlarmFilledSVG, CheckFilledSVG, CrossFilledSVG, InfoFilledSVG } from '@
|
|
|
3
3
|
import { APPEARANCE } from './constants';
|
|
4
4
|
import { Appearance } from './types';
|
|
5
5
|
|
|
6
|
-
export function getIcon(appearance: Appearance) {
|
|
6
|
+
export function getIcon(appearance: Appearance, size: number) {
|
|
7
7
|
switch (appearance) {
|
|
8
8
|
case APPEARANCE.Success:
|
|
9
|
-
return <CheckFilledSVG />;
|
|
9
|
+
return <CheckFilledSVG size={size} />;
|
|
10
10
|
case APPEARANCE.Error:
|
|
11
|
-
return <CrossFilledSVG />;
|
|
11
|
+
return <CrossFilledSVG size={size} />;
|
|
12
12
|
case APPEARANCE.Warning:
|
|
13
|
-
return <AlarmFilledSVG />;
|
|
13
|
+
return <AlarmFilledSVG size={size} />;
|
|
14
14
|
case APPEARANCE.Primary:
|
|
15
15
|
case APPEARANCE.Neutral:
|
|
16
16
|
default:
|
|
17
|
-
return <InfoFilledSVG />;
|
|
17
|
+
return <InfoFilledSVG size={size} />;
|
|
18
18
|
}
|
|
19
19
|
}
|