@cloud-ru/uikit-product-site-cards 1.3.4 → 1.4.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 +11 -0
- package/dist/cjs/components/CardMedia/CardMedia.d.ts +5 -1
- package/dist/cjs/components/CardMedia/CardMedia.js +2 -2
- package/dist/cjs/components/CardMedia/styles.module.css +15 -0
- package/dist/esm/components/CardMedia/CardMedia.d.ts +5 -1
- package/dist/esm/components/CardMedia/CardMedia.js +3 -3
- package/dist/esm/components/CardMedia/styles.module.css +15 -0
- package/package.json +2 -2
- package/src/components/CardMedia/CardMedia.tsx +13 -0
- package/src/components/CardMedia/styles.module.scss +15 -0
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
|
+
# 1.4.0 (2026-07-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **SITE-11518:** add isRead&readLabel props for card media ([9879c86](https://github.com/cloud-ru-tech/uikit-product/commit/9879c86c2af6d9cbb850dddcb3ab0fa37c3adc64))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 1.3.4 (2026-07-21)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -30,5 +30,9 @@ export type CardMediaProps = WithSupportProps<WithLayoutType<{
|
|
|
30
30
|
* @default false
|
|
31
31
|
*/
|
|
32
32
|
disabled?: boolean;
|
|
33
|
+
/** Карточка прочитана — затемняет картинку и показывает лейбл */
|
|
34
|
+
isRead?: boolean;
|
|
35
|
+
/** Текст лейбла при isRead @default 'Прочитано' */
|
|
36
|
+
readLabel?: string;
|
|
33
37
|
}>>;
|
|
34
|
-
export declare function CardMedia({ title, titleTag, size, img, imgAlt, tag, time, href, disabled, date, target, onClick, 'data-test-id': dataTestId, layoutType, ...rest }: CardMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function CardMedia({ title, titleTag, size, img, imgAlt, tag, time, href, disabled, date, target, onClick, 'data-test-id': dataTestId, layoutType, isRead, readLabel, ...rest }: CardMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,7 +25,7 @@ const hooks_1 = require("../../hooks");
|
|
|
25
25
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
26
26
|
const utils_1 = require("./utils");
|
|
27
27
|
function CardMedia(_a) {
|
|
28
|
-
var { title, titleTag = 'h2', size = 's', img, imgAlt, tag, time, href, disabled, date, target = '_self', onClick, 'data-test-id': dataTestId = 'card-media', layoutType } = _a, rest = __rest(_a, ["title", "titleTag", "size", "img", "imgAlt", "tag", "time", "href", "disabled", "date", "target", "onClick", 'data-test-id', "layoutType"]);
|
|
28
|
+
var { title, titleTag = 'h2', size = 's', img, imgAlt, tag, time, href, disabled, date, target = '_self', onClick, 'data-test-id': dataTestId = 'card-media', layoutType, isRead = false, readLabel = 'Прочитано' } = _a, rest = __rest(_a, ["title", "titleTag", "size", "img", "imgAlt", "tag", "time", "href", "disabled", "date", "target", "onClick", 'data-test-id', "layoutType", "isRead", "readLabel"]);
|
|
29
29
|
const { anchorRef, handleLinkClick, handleCardKeyDown } = (0, hooks_1.useCardInteractions)({
|
|
30
30
|
href,
|
|
31
31
|
disabled,
|
|
@@ -35,5 +35,5 @@ function CardMedia(_a) {
|
|
|
35
35
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
36
36
|
(0, jsx_runtime_1.jsxs)("div", Object.assign({}, (0, uikit_product_utils_1.extractSupportProps)(rest), { onKeyDown: handleCardKeyDown, "data-test-id": dataTestId, "data-size": size, className: styles_module_scss_1.default.root, "data-disabled": disabled || undefined, "data-layout-type": layoutType,
|
|
37
37
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
38
|
-
tabIndex: 0, children: [(0, jsx_runtime_1.
|
|
38
|
+
tabIndex: 0, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.imgWrapper, children: [(0, jsx_runtime_1.jsx)("img", { className: styles_module_scss_1.default.img, src: img, alt: imgAlt !== null && imgAlt !== void 0 ? imgAlt : 'card-media-img' }), isRead && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.blackout }), (0, jsx_runtime_1.jsx)(tag_1.Tag, { size: 'xs', label: readLabel, className: styles_module_scss_1.default.tagRead })] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.left, children: [(0, jsx_runtime_1.jsx)(tag_1.Tag, Object.assign({ size: 'xs' }, tag)), time && ((0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.time, children: [(0, jsx_runtime_1.jsx)(uikit_product_icons_1.WatchSVG, { className: styles_module_scss_1.default.icon, size: 16 }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.minutes, children: `${time} мин` })] }))] }), size !== 's' && (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.date, children: date })] }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { tag: titleTag, family: 'sans', purpose: 'title', size: (0, utils_1.getTypographySize)(layoutType, size), className: styles_module_scss_1.default.title, "data-test-id": `${dataTestId}__title`, children: href ? ((0, jsx_runtime_1.jsx)("a", { tabIndex: -1, ref: anchorRef, href: href, target: target, onClick: handleLinkClick, "data-test-id": `${dataTestId}__title-link`, children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { text: title, maxLines: 4 }) })) : (title) })] })));
|
|
39
39
|
}
|
|
@@ -29,11 +29,26 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.imgWrapper{
|
|
32
|
+
position:relative;
|
|
32
33
|
overflow:hidden;
|
|
33
34
|
height:auto;
|
|
34
35
|
border-radius:4px;
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
.blackout{
|
|
39
|
+
position:absolute;
|
|
40
|
+
inset:0;
|
|
41
|
+
display:block;
|
|
42
|
+
background:var(--sys-blackout, rgba(0, 0, 0, 0.3215686275));
|
|
43
|
+
pointer-events:none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.tagRead{
|
|
47
|
+
position:absolute;
|
|
48
|
+
top:2px;
|
|
49
|
+
right:2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
.header{
|
|
38
53
|
display:flex;
|
|
39
54
|
justify-content:space-between;
|
|
@@ -30,5 +30,9 @@ export type CardMediaProps = WithSupportProps<WithLayoutType<{
|
|
|
30
30
|
* @default false
|
|
31
31
|
*/
|
|
32
32
|
disabled?: boolean;
|
|
33
|
+
/** Карточка прочитана — затемняет картинку и показывает лейбл */
|
|
34
|
+
isRead?: boolean;
|
|
35
|
+
/** Текст лейбла при isRead @default 'Прочитано' */
|
|
36
|
+
readLabel?: string;
|
|
33
37
|
}>>;
|
|
34
|
-
export declare function CardMedia({ title, titleTag, size, img, imgAlt, tag, time, href, disabled, date, target, onClick, 'data-test-id': dataTestId, layoutType, ...rest }: CardMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function CardMedia({ title, titleTag, size, img, imgAlt, tag, time, href, disabled, date, target, onClick, 'data-test-id': dataTestId, layoutType, isRead, readLabel, ...rest }: CardMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { WatchSVG } from '@cloud-ru/uikit-product-icons';
|
|
14
14
|
import { extractSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
15
15
|
import { Tag } from '@snack-uikit/tag';
|
|
@@ -19,7 +19,7 @@ import { useCardInteractions } from '../../hooks';
|
|
|
19
19
|
import styles from './styles.module.css';
|
|
20
20
|
import { getTypographySize } from './utils';
|
|
21
21
|
export function CardMedia(_a) {
|
|
22
|
-
var { title, titleTag = 'h2', size = 's', img, imgAlt, tag, time, href, disabled, date, target = '_self', onClick, 'data-test-id': dataTestId = 'card-media', layoutType } = _a, rest = __rest(_a, ["title", "titleTag", "size", "img", "imgAlt", "tag", "time", "href", "disabled", "date", "target", "onClick", 'data-test-id', "layoutType"]);
|
|
22
|
+
var { title, titleTag = 'h2', size = 's', img, imgAlt, tag, time, href, disabled, date, target = '_self', onClick, 'data-test-id': dataTestId = 'card-media', layoutType, isRead = false, readLabel = 'Прочитано' } = _a, rest = __rest(_a, ["title", "titleTag", "size", "img", "imgAlt", "tag", "time", "href", "disabled", "date", "target", "onClick", 'data-test-id', "layoutType", "isRead", "readLabel"]);
|
|
23
23
|
const { anchorRef, handleLinkClick, handleCardKeyDown } = useCardInteractions({
|
|
24
24
|
href,
|
|
25
25
|
disabled,
|
|
@@ -29,5 +29,5 @@ export function CardMedia(_a) {
|
|
|
29
29
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
30
30
|
_jsxs("div", Object.assign({}, extractSupportProps(rest), { onKeyDown: handleCardKeyDown, "data-test-id": dataTestId, "data-size": size, className: styles.root, "data-disabled": disabled || undefined, "data-layout-type": layoutType,
|
|
31
31
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
32
|
-
tabIndex: 0, children: [
|
|
32
|
+
tabIndex: 0, children: [_jsxs("div", { className: styles.imgWrapper, children: [_jsx("img", { className: styles.img, src: img, alt: imgAlt !== null && imgAlt !== void 0 ? imgAlt : 'card-media-img' }), isRead && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.blackout }), _jsx(Tag, { size: 'xs', label: readLabel, className: styles.tagRead })] }))] }), _jsxs("div", { className: styles.header, children: [_jsxs("div", { className: styles.left, children: [_jsx(Tag, Object.assign({ size: 'xs' }, tag)), time && (_jsxs("span", { className: styles.time, children: [_jsx(WatchSVG, { className: styles.icon, size: 16 }), _jsx(Typography.SansBodyM, { className: styles.minutes, children: `${time} мин` })] }))] }), size !== 's' && _jsx(Typography.SansBodyM, { className: styles.date, children: date })] }), _jsx(Typography, { tag: titleTag, family: 'sans', purpose: 'title', size: getTypographySize(layoutType, size), className: styles.title, "data-test-id": `${dataTestId}__title`, children: href ? (_jsx("a", { tabIndex: -1, ref: anchorRef, href: href, target: target, onClick: handleLinkClick, "data-test-id": `${dataTestId}__title-link`, children: _jsx(TruncateString, { text: title, maxLines: 4 }) })) : (title) })] })));
|
|
33
33
|
}
|
|
@@ -29,11 +29,26 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.imgWrapper{
|
|
32
|
+
position:relative;
|
|
32
33
|
overflow:hidden;
|
|
33
34
|
height:auto;
|
|
34
35
|
border-radius:4px;
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
.blackout{
|
|
39
|
+
position:absolute;
|
|
40
|
+
inset:0;
|
|
41
|
+
display:block;
|
|
42
|
+
background:var(--sys-blackout, rgba(0, 0, 0, 0.3215686275));
|
|
43
|
+
pointer-events:none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.tagRead{
|
|
47
|
+
position:absolute;
|
|
48
|
+
top:2px;
|
|
49
|
+
right:2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
.header{
|
|
38
53
|
display:flex;
|
|
39
54
|
justify-content:space-between;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-site-cards",
|
|
3
3
|
"title": "Site Cards",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"@snack-uikit/typography": "0.8.4",
|
|
48
48
|
"classnames": "2.5.1"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "5fede50f59b2dd7183e9c63dfe5397caf73ab805"
|
|
51
51
|
}
|
|
@@ -40,6 +40,10 @@ export type CardMediaProps = WithSupportProps<
|
|
|
40
40
|
* @default false
|
|
41
41
|
*/
|
|
42
42
|
disabled?: boolean;
|
|
43
|
+
/** Карточка прочитана — затемняет картинку и показывает лейбл */
|
|
44
|
+
isRead?: boolean;
|
|
45
|
+
/** Текст лейбла при isRead @default 'Прочитано' */
|
|
46
|
+
readLabel?: string;
|
|
43
47
|
}>
|
|
44
48
|
>;
|
|
45
49
|
|
|
@@ -58,6 +62,8 @@ export function CardMedia({
|
|
|
58
62
|
onClick,
|
|
59
63
|
'data-test-id': dataTestId = 'card-media',
|
|
60
64
|
layoutType,
|
|
65
|
+
isRead = false,
|
|
66
|
+
readLabel = 'Прочитано',
|
|
61
67
|
...rest
|
|
62
68
|
}: CardMediaProps) {
|
|
63
69
|
const { anchorRef, handleLinkClick, handleCardKeyDown } = useCardInteractions({
|
|
@@ -81,6 +87,13 @@ export function CardMedia({
|
|
|
81
87
|
>
|
|
82
88
|
<div className={styles.imgWrapper}>
|
|
83
89
|
<img className={styles.img} src={img} alt={imgAlt ?? 'card-media-img'} />
|
|
90
|
+
|
|
91
|
+
{isRead && (
|
|
92
|
+
<>
|
|
93
|
+
<div className={styles.blackout} />
|
|
94
|
+
<Tag size='xs' label={readLabel} className={styles.tagRead} />
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
84
97
|
</div>
|
|
85
98
|
|
|
86
99
|
<div className={styles.header}>
|
|
@@ -37,11 +37,26 @@ $scale: 1.05;
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.imgWrapper {
|
|
40
|
+
position: relative;
|
|
40
41
|
overflow: hidden;
|
|
41
42
|
height: auto;
|
|
42
43
|
border-radius: 4px;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
.blackout {
|
|
47
|
+
position: absolute;
|
|
48
|
+
inset: 0;
|
|
49
|
+
display: block;
|
|
50
|
+
background: ste.$sys-blackout;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tagRead {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 2px;
|
|
57
|
+
right: 2px;
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
.header {
|
|
46
61
|
display: flex;
|
|
47
62
|
justify-content: space-between;
|