@cloud-ru/ds-uikit-product-modal-predefined 1.1.4 → 1.1.5
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 +6 -0
- package/README.md +2 -2
- package/dist/cjs/helperComponents/NoteItem/NoteItem.d.ts +2 -1
- package/dist/cjs/helperComponents/NoteItem/NoteItem.js +2 -2
- package/dist/cjs/helperComponents/NoteItem/styles.module.css +4 -0
- package/dist/cjs/helperComponents/ReleaseNotesContent/ReleaseNotesContent.js +18 -1
- package/dist/cjs/style.css +4 -0
- package/dist/esm/helperComponents/NoteItem/NoteItem.d.ts +2 -1
- package/dist/esm/helperComponents/NoteItem/NoteItem.js +2 -2
- package/dist/esm/helperComponents/NoteItem/styles.module.css +4 -0
- package/dist/esm/helperComponents/ReleaseNotesContent/ReleaseNotesContent.js +19 -2
- package/dist/esm/style.css +4 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/helperComponents/NoteItem/NoteItem.tsx +3 -2
- package/src/helperComponents/NoteItem/styles.module.scss +5 -0
- package/src/helperComponents/ReleaseNotesContent/ReleaseNotesContent.tsx +31 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.1.5 (2026-11-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **FF-8815:** size mobile news scroll area to active slide ([4e749ed](https://github.com/cloud-ru-tech/snack-v2/commit/4e749ed07cda6c98a2b906cc26f8b998491544c7))
|
|
11
|
+
|
|
6
12
|
## 1.1.4 (2026-11-11)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @ds/uikit-product-modal-predefined
|
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ export function DeleteConfirmable() {
|
|
|
94
94
|
| `data-test-id` | `string` | — | |
|
|
95
95
|
| `deleting` | `boolean` | — | Состояние загрузки кнопки удаления |
|
|
96
96
|
| `hideConfirmCopyButton` | `boolean` | — | Скрыть кнопку копирования текста подтверждения |
|
|
97
|
-
| `mode` | `"aggressive"` \| `"forced"` \| `"regular"` | `MODE.Regular` | Режим закрытия: Regular — overlay/Esc/кнопка; Aggressive — только кнопка; Forced — без кнопки и overlay/Esc. |
|
|
97
|
+
| `mode` | `"aggressive"` \| `"forced"` \| `"regular"` | `MODE.Regular` | Режим закрытия: Regular — overlay/Esc/кнопка; Aggressive — только кнопка; Forced — без кнопки и overlay/Esc. <br/> Aggressive и Forced размывают фон под подложкой. <br/> На mobile Aggressive запрещает закрытие кликом по подложке, Forced также отключает свайп. |
|
|
98
98
|
| `objectType` | `string` | — | Тип удаляемого объекта, отображается в заголовке |
|
|
99
99
|
| `onClose` | `() => void` | — | Колбэк закрытия |
|
|
100
100
|
| `onDelete` | `(onClose: () => void) => void` | — | Колбэк подтверждения удаления |
|
|
@@ -169,7 +169,7 @@ export function RecallConfirmable() {
|
|
|
169
169
|
| `data-test-id` | `string` | — | |
|
|
170
170
|
| `hideConfirmCopyButton` | `boolean` | — | Скрыть кнопку копирования текста подтверждения |
|
|
171
171
|
| `loading` | `boolean` | — | Состояние загрузки кнопки отзыва |
|
|
172
|
-
| `mode` | `"aggressive"` \| `"forced"` \| `"regular"` | `MODE.Regular` | Режим закрытия: Regular — overlay/Esc/кнопка; Aggressive — только кнопка; Forced — без кнопки и overlay/Esc. |
|
|
172
|
+
| `mode` | `"aggressive"` \| `"forced"` \| `"regular"` | `MODE.Regular` | Режим закрытия: Regular — overlay/Esc/кнопка; Aggressive — только кнопка; Forced — без кнопки и overlay/Esc. <br/> Aggressive и Forced размывают фон под подложкой. <br/> На mobile Aggressive запрещает закрытие кликом по подложке, Forced также отключает свайп. |
|
|
173
173
|
| `onClose` | `() => void` | — | Колбэк закрытия |
|
|
174
174
|
| `onRecall` | `(onClose: () => void) => void` | — | Колбэк подтверждения отзыва |
|
|
175
175
|
| `open` | `boolean` | — | Управление состоянием показан/не показан |
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NoteItemProps, Surface } from '../../types';
|
|
2
2
|
type NoteItemComponentProps = NoteItemProps & {
|
|
3
3
|
surface?: Surface;
|
|
4
|
+
active?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare function NoteItem({ title, description, image, video, surface }: NoteItemComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function NoteItem({ title, description, image, video, surface, active }: NoteItemComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -41,6 +41,6 @@ function NoteItemMedia({ image, video }) {
|
|
|
41
41
|
// При ошибке `<img>` не рендерится: иначе поверх заглушки остаётся превью браузера с alt-текстом.
|
|
42
42
|
status !== constants_1.MEDIA_STATUS.Error && ((0, jsx_runtime_1.jsx)("img", { ref: handleImageRef, className: styles_module_scss_1.default.file, src: image.src, alt: image.alt, onLoad: handleImageLoad, onError: handleImageError, "data-test-id": constants_1.TEST_IDS.releaseNotesImage }))), status === constants_1.MEDIA_STATUS.Pending && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.mediaOverlay, "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { loading: true, width: '100%', height: '100%' }) })), status === constants_1.MEDIA_STATUS.Error && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.mediaOverlay, role: 'img', "aria-label": image.alt, "data-test-id": constants_1.TEST_IDS.releaseNotesMediaFallback, children: (0, jsx_runtime_1.jsx)(system_1.ImageSVG, { className: styles_module_scss_1.default.mediaFallbackIcon, size: FALLBACK_ICON_SIZE }) }))] }));
|
|
43
43
|
}
|
|
44
|
-
function NoteItem({ title, description, image, video, surface = constants_1.SURFACE.Modal }) {
|
|
45
|
-
return ((0, jsx_runtime_1.jsxs)("article", { className: styles_module_scss_1.default.root, "data-surface": surface, "data-test-id": constants_1.TEST_IDS.releaseNotesItem, children: [(0, jsx_runtime_1.jsx)(NoteItemMedia, { image: image, video: video }, `${video ?? ''}|${image.src}`), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.titleWrapper, children: (0, jsx_runtime_1.jsx)(typography_1.Typography, { className: styles_module_scss_1.default.title, variant: 'title', size: 'l', children: title }) }), (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { className: styles_module_scss_1.default.description, size: scroll_1.SIZE.S, barHideStrategy: scroll_1.BAR_HIDE_STRATEGY.Leave, children: (0, jsx_runtime_1.jsx)(markdown_1.Markdown, { value: description, className: styles_module_scss_1.default.markdown }) })] })] }));
|
|
44
|
+
function NoteItem({ title, description, image, video, surface = constants_1.SURFACE.Modal, active = true }) {
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)("article", { className: styles_module_scss_1.default.root, "data-surface": surface, "data-active": active, "data-test-id": constants_1.TEST_IDS.releaseNotesItem, children: [(0, jsx_runtime_1.jsx)(NoteItemMedia, { image: image, video: video }, `${video ?? ''}|${image.src}`), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.titleWrapper, children: (0, jsx_runtime_1.jsx)(typography_1.Typography, { className: styles_module_scss_1.default.title, variant: 'title', size: 'l', children: title }) }), (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { className: styles_module_scss_1.default.description, size: scroll_1.SIZE.S, barHideStrategy: scroll_1.BAR_HIDE_STRATEGY.Leave, children: (0, jsx_runtime_1.jsx)(markdown_1.Markdown, { value: description, className: styles_module_scss_1.default.markdown }) })] })] }));
|
|
46
46
|
}
|
|
@@ -10,16 +10,33 @@ const carousel_1 = require("@cloud-ru/ds-carousel");
|
|
|
10
10
|
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
11
11
|
const info_block_1 = require("@cloud-ru/ds-info-block");
|
|
12
12
|
const typography_1 = require("@cloud-ru/ds-typography");
|
|
13
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
13
14
|
const classnames_1 = __importDefault(require("classnames"));
|
|
15
|
+
const react_1 = require("react");
|
|
14
16
|
const constants_1 = require("../../constants");
|
|
15
17
|
const NoteItem_1 = require("../NoteItem");
|
|
16
18
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
19
|
+
const SLIDE_TRANSITION_MS = 400;
|
|
17
20
|
function InfoBlockDescription({ children }) {
|
|
18
21
|
return ((0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: 'body', size: 'm', children: children }));
|
|
19
22
|
}
|
|
20
23
|
function ReleaseNotesContent({ contentState, items, loading, pageIndex, surface, noDataTitle, noDataDescription, errorTitle, errorDescription, retryLabel, onPageChange, onDataErrorRetryClick, }) {
|
|
21
24
|
const total = items.length;
|
|
22
25
|
const hasItems = total > 0;
|
|
26
|
+
const isMobileCarousel = surface === constants_1.SURFACE.BottomSheet && !loading && contentState === constants_1.CONTENT_STATE.Data && hasItems;
|
|
27
|
+
const previousPageIndex = (0, react_1.useRef)(pageIndex);
|
|
28
|
+
const [outgoingPageIndex, setOutgoingPageIndex] = (0, react_1.useState)();
|
|
29
|
+
(0, utils_1.useLayoutEffect)(() => {
|
|
30
|
+
const previousPage = previousPageIndex.current;
|
|
31
|
+
previousPageIndex.current = pageIndex;
|
|
32
|
+
if (!isMobileCarousel || previousPage === pageIndex) {
|
|
33
|
+
setOutgoingPageIndex(undefined);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
setOutgoingPageIndex(previousPage);
|
|
37
|
+
const timeout = window.setTimeout(() => setOutgoingPageIndex(undefined), SLIDE_TRANSITION_MS);
|
|
38
|
+
return () => window.clearTimeout(timeout);
|
|
39
|
+
}, [isMobileCarousel, pageIndex]);
|
|
23
40
|
if (loading) {
|
|
24
41
|
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, styles_module_scss_1.default[surface]), children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.skeletonSlide, children: (0, jsx_runtime_1.jsx)(NoteItem_1.NoteItemSkeleton, { surface: surface }) }) }));
|
|
25
42
|
}
|
|
@@ -29,5 +46,5 @@ function ReleaseNotesContent({ contentState, items, loading, pageIndex, surface,
|
|
|
29
46
|
if (contentState === constants_1.CONTENT_STATE.NoData || !hasItems) {
|
|
30
47
|
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.stateWrapper, "data-surface": surface, children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, { className: styles_module_scss_1.default.state, size: 'l', title: noDataTitle, content: (0, jsx_runtime_1.jsx)(InfoBlockDescription, { children: noDataDescription }), "data-test-id": constants_1.TEST_IDS.releaseNotesNoData }) }));
|
|
31
48
|
}
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, styles_module_scss_1.default[surface]), children: (0, jsx_runtime_1.jsx)(carousel_1.Carousel, { arrows: false, pagination: false, swipe: true, state: { page: pageIndex, onChange: onPageChange }, className: styles_module_scss_1.default.carousel, children: items.map(item => ((0, jsx_runtime_1.jsx)(NoteItem_1.NoteItem, { ...item, surface: surface }, `${item.title}-${item.image.src}`))) }) }));
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, styles_module_scss_1.default[surface]), children: (0, jsx_runtime_1.jsx)(carousel_1.Carousel, { arrows: false, pagination: false, swipe: true, transition: SLIDE_TRANSITION_MS / 1000, state: { page: pageIndex, onChange: onPageChange }, className: styles_module_scss_1.default.carousel, children: items.map((item, index) => ((0, jsx_runtime_1.jsx)(NoteItem_1.NoteItem, { ...item, surface: surface, active: index === pageIndex || index === outgoingPageIndex }, `${item.title}-${item.image.src}`))) }) }));
|
|
33
50
|
}
|
package/dist/cjs/style.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NoteItemProps, Surface } from '../../types.js';
|
|
2
2
|
type NoteItemComponentProps = NoteItemProps & {
|
|
3
3
|
surface?: Surface;
|
|
4
|
+
active?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare function NoteItem({ title, description, image, video, surface }: NoteItemComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function NoteItem({ title, description, image, video, surface, active }: NoteItemComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -35,6 +35,6 @@ function NoteItemMedia({ image, video }) {
|
|
|
35
35
|
// При ошибке `<img>` не рендерится: иначе поверх заглушки остаётся превью браузера с alt-текстом.
|
|
36
36
|
status !== MEDIA_STATUS.Error && (_jsx("img", { ref: handleImageRef, className: styles.file, src: image.src, alt: image.alt, onLoad: handleImageLoad, onError: handleImageError, "data-test-id": TEST_IDS.releaseNotesImage }))), status === MEDIA_STATUS.Pending && (_jsx("div", { className: styles.mediaOverlay, "aria-hidden": true, children: _jsx(Skeleton, { loading: true, width: '100%', height: '100%' }) })), status === MEDIA_STATUS.Error && (_jsx("div", { className: styles.mediaOverlay, role: 'img', "aria-label": image.alt, "data-test-id": TEST_IDS.releaseNotesMediaFallback, children: _jsx(ImageSVG, { className: styles.mediaFallbackIcon, size: FALLBACK_ICON_SIZE }) }))] }));
|
|
37
37
|
}
|
|
38
|
-
export function NoteItem({ title, description, image, video, surface = SURFACE.Modal }) {
|
|
39
|
-
return (_jsxs("article", { className: styles.root, "data-surface": surface, "data-test-id": TEST_IDS.releaseNotesItem, children: [_jsx(NoteItemMedia, { image: image, video: video }, `${video ?? ''}|${image.src}`), _jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.titleWrapper, children: _jsx(Typography, { className: styles.title, variant: 'title', size: 'l', children: title }) }), _jsx(Scroll, { className: styles.description, size: SCROLL_SIZE.S, barHideStrategy: BAR_HIDE_STRATEGY.Leave, children: _jsx(Markdown, { value: description, className: styles.markdown }) })] })] }));
|
|
38
|
+
export function NoteItem({ title, description, image, video, surface = SURFACE.Modal, active = true }) {
|
|
39
|
+
return (_jsxs("article", { className: styles.root, "data-surface": surface, "data-active": active, "data-test-id": TEST_IDS.releaseNotesItem, children: [_jsx(NoteItemMedia, { image: image, video: video }, `${video ?? ''}|${image.src}`), _jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.titleWrapper, children: _jsx(Typography, { className: styles.title, variant: 'title', size: 'l', children: title }) }), _jsx(Scroll, { className: styles.description, size: SCROLL_SIZE.S, barHideStrategy: BAR_HIDE_STRATEGY.Leave, children: _jsx(Markdown, { value: description, className: styles.markdown }) })] })] }));
|
|
40
40
|
}
|
|
@@ -4,16 +4,33 @@ import { Carousel } from '@cloud-ru/ds-carousel';
|
|
|
4
4
|
import { CrossSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
5
5
|
import { InfoBlock } from '@cloud-ru/ds-info-block';
|
|
6
6
|
import { Typography } from '@cloud-ru/ds-typography';
|
|
7
|
+
import { useLayoutEffect } from '@cloud-ru/ds-utils';
|
|
7
8
|
import cn from 'classnames';
|
|
8
|
-
import {
|
|
9
|
+
import { useRef, useState } from 'react';
|
|
10
|
+
import { CONTENT_STATE, SURFACE, TEST_IDS } from '../../constants.js';
|
|
9
11
|
import { NoteItem, NoteItemSkeleton } from '../NoteItem/index.js';
|
|
10
12
|
import styles from './styles.module.css';
|
|
13
|
+
const SLIDE_TRANSITION_MS = 400;
|
|
11
14
|
function InfoBlockDescription({ children }) {
|
|
12
15
|
return (_jsx(Typography, { variant: 'body', size: 'm', children: children }));
|
|
13
16
|
}
|
|
14
17
|
export function ReleaseNotesContent({ contentState, items, loading, pageIndex, surface, noDataTitle, noDataDescription, errorTitle, errorDescription, retryLabel, onPageChange, onDataErrorRetryClick, }) {
|
|
15
18
|
const total = items.length;
|
|
16
19
|
const hasItems = total > 0;
|
|
20
|
+
const isMobileCarousel = surface === SURFACE.BottomSheet && !loading && contentState === CONTENT_STATE.Data && hasItems;
|
|
21
|
+
const previousPageIndex = useRef(pageIndex);
|
|
22
|
+
const [outgoingPageIndex, setOutgoingPageIndex] = useState();
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
const previousPage = previousPageIndex.current;
|
|
25
|
+
previousPageIndex.current = pageIndex;
|
|
26
|
+
if (!isMobileCarousel || previousPage === pageIndex) {
|
|
27
|
+
setOutgoingPageIndex(undefined);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setOutgoingPageIndex(previousPage);
|
|
31
|
+
const timeout = window.setTimeout(() => setOutgoingPageIndex(undefined), SLIDE_TRANSITION_MS);
|
|
32
|
+
return () => window.clearTimeout(timeout);
|
|
33
|
+
}, [isMobileCarousel, pageIndex]);
|
|
17
34
|
if (loading) {
|
|
18
35
|
return (_jsx("div", { className: cn(styles.root, styles[surface]), children: _jsx("div", { className: styles.skeletonSlide, children: _jsx(NoteItemSkeleton, { surface: surface }) }) }));
|
|
19
36
|
}
|
|
@@ -23,5 +40,5 @@ export function ReleaseNotesContent({ contentState, items, loading, pageIndex, s
|
|
|
23
40
|
if (contentState === CONTENT_STATE.NoData || !hasItems) {
|
|
24
41
|
return (_jsx("div", { className: styles.stateWrapper, "data-surface": surface, children: _jsx(InfoBlock, { className: styles.state, size: 'l', title: noDataTitle, content: _jsx(InfoBlockDescription, { children: noDataDescription }), "data-test-id": TEST_IDS.releaseNotesNoData }) }));
|
|
25
42
|
}
|
|
26
|
-
return (_jsx("div", { className: cn(styles.root, styles[surface]), children: _jsx(Carousel, { arrows: false, pagination: false, swipe: true, state: { page: pageIndex, onChange: onPageChange }, className: styles.carousel, children: items.map(item => (_jsx(NoteItem, { ...item, surface: surface }, `${item.title}-${item.image.src}`))) }) }));
|
|
43
|
+
return (_jsx("div", { className: cn(styles.root, styles[surface]), children: _jsx(Carousel, { arrows: false, pagination: false, swipe: true, transition: SLIDE_TRANSITION_MS / 1000, state: { page: pageIndex, onChange: onPageChange }, className: styles.carousel, children: items.map((item, index) => (_jsx(NoteItem, { ...item, surface: surface, active: index === pageIndex || index === outgoingPageIndex }, `${item.title}-${item.image.src}`))) }) }));
|
|
27
44
|
}
|