@cloud-ru/ds-uikit-product-widget 1.1.0 → 2.0.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 +14 -0
- package/README.md +7 -7
- package/dist/cjs/components/Widget/Widget.js +2 -1
- package/dist/cjs/types.d.ts +5 -3
- package/dist/esm/components/Widget/Widget.js +3 -2
- package/dist/esm/types.d.ts +5 -3
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/components/Widget/Widget.tsx +11 -1
- package/src/types.ts +4 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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
|
+
# 2.0.0 (2026-10-17)
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
- **FF-8949:** update title clickable ([fb85bb8](https://github.com/cloud-ru-tech/snack-v2/commit/fb85bb8d4fc936996778eec11f8647fb4412919f))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **FF-8949:** api recomposition to titleSimple and titleUser sub-components ([9f3cd79](https://github.com/cloud-ru-tech/snack-v2/commit/9f3cd79a07e1a47e59113aadc61c6c17fee4276e))
|
|
15
|
+
|
|
16
|
+
## 1.1.1 (2026-10-16)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @ds/uikit-product-widget
|
|
19
|
+
|
|
6
20
|
# 1.1.0 (2026-10-16)
|
|
7
21
|
|
|
8
22
|
### Features
|
package/README.md
CHANGED
|
@@ -270,13 +270,13 @@ export function ErrorState() {
|
|
|
270
270
|
|
|
271
271
|
| Prop | Type | Default | Description |
|
|
272
272
|
|------|------|---------|-------------|
|
|
273
|
-
| `
|
|
274
|
-
| `
|
|
275
|
-
| `
|
|
276
|
-
| `
|
|
277
|
-
| `icon` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Иконка
|
|
278
|
-
| `title` | `string
|
|
279
|
-
| `titleTag` | `ElementType \| undefined` | — |
|
|
273
|
+
| `children` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | |
|
|
274
|
+
| `className` | `string \| undefined` | — | CSS-класс корневого контейнера. |
|
|
275
|
+
| `data-test-id` | `string \| undefined` | — | |
|
|
276
|
+
| `href` | `string` | — | |
|
|
277
|
+
| `icon` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Иконка слева, 24×24. |
|
|
278
|
+
| `title` | `string` | — | Текст заголовка. |
|
|
279
|
+
| `titleTag` | `ElementType \| undefined` | — | Семантический тег заголовка. |
|
|
280
280
|
|
|
281
281
|
**WidgetLoadingStateProps**
|
|
282
282
|
|
|
@@ -18,6 +18,7 @@ const helperComponents_1 = require("../../helperComponents");
|
|
|
18
18
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
19
19
|
const ACRYLIC = (0, materials_1.backgroundPredefinedFillToAcrylic)(materials_1.BACKGROUND_PREDEFINED_FILL.NeutralBackground1Level);
|
|
20
20
|
function WidgetComponent({ header, children, actions = [], wide: wideProp = false, state = constants_1.WIDGET_STATE.Default, loadingState, errorState, className, actionsChildren, segmentControl, ...rest }) {
|
|
21
|
+
const { title, icon, titleTag, children: headerChildren, ...headerProps } = header;
|
|
21
22
|
const { layoutType: contextLayoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
22
23
|
const isMobile = (0, adaptive_1.isMobileLayout)(contextLayoutType);
|
|
23
24
|
const wide = wideProp && !isMobile;
|
|
@@ -33,7 +34,7 @@ function WidgetComponent({ header, children, actions = [], wide: wideProp = fals
|
|
|
33
34
|
const withKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === constants_1.BUTTON_TYPE.Kebab));
|
|
34
35
|
return [withoutKebab, withKebab];
|
|
35
36
|
}, [visibleItems, hiddenItems]);
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.widget, className), "data-state": state, ref: containerRef, "data-wide": wide || undefined, "data-acrylic-appearance": ACRYLIC.appearance, "data-acrylic-level": ACRYLIC.level, ...(0, utils_1.extractSupportProps)(rest), children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.acrylic, "aria-hidden": true }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.widgetHeader, "data-mobile": !wide || undefined, "data-test-id": constants_1.TEST_IDS.header, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.headerMain, children: [state === constants_1.WIDGET_STATE.Loading ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.skeletonHeader, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { loading: true, className: styles_module_scss_1.default.skeletonTitle }) })) : ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { ...
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.widget, className), "data-state": state, ref: containerRef, "data-wide": wide || undefined, "data-acrylic-appearance": ACRYLIC.appearance, "data-acrylic-level": ACRYLIC.level, ...(0, utils_1.extractSupportProps)(rest), children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.acrylic, "aria-hidden": true }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.widgetHeader, "data-mobile": !wide || undefined, "data-test-id": constants_1.TEST_IDS.header, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.headerMain, children: [state === constants_1.WIDGET_STATE.Loading ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.skeletonHeader, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { loading: true, className: styles_module_scss_1.default.skeletonTitle }) })) : ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { ...headerProps, className: (0, classnames_1.default)(styles_module_scss_1.default.titleClickable, header.className), content: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, { title: title, icon: icon, titleTag: titleTag }), headerChildren] }) })), !wide && ((0, jsx_runtime_1.jsx)(helperComponents_1.Actions, { actions: state === constants_1.WIDGET_STATE.Error ? actions : hiddenItemsWithKebab, actionsChildren: actionsChildren, wide: wide, state: state }))] }), (0, jsx_runtime_1.jsx)(helperComponents_1.ControlBlock, { actions: actions, actionsChildren: actionsChildren, segmentControl: segmentControl, wide: wide, state: state })] }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.widgetContent, "data-test-id": constants_1.TEST_IDS.content, children: (0, jsx_runtime_1.jsx)(helperComponents_1.Content, { state: state, wide: wide, loadingState: loadingState, errorState: errorState, children: children }) }), !wide &&
|
|
37
38
|
state !== constants_1.WIDGET_STATE.Error &&
|
|
38
39
|
visibleItemsWithoutKebab.map((action, index) => state === constants_1.WIDGET_STATE.Loading ? ((0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { loading: true, className: styles_module_scss_1.default.skeletonButton }, index)) : ((0, react_1.createElement)(helperComponents_1.ActionView, { ...action, key: index, commonProps: {
|
|
39
40
|
className: styles_module_scss_1.default.button,
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ import { ButtonProps } from '@cloud-ru/ds-button';
|
|
|
2
2
|
import type { InfoBlockProps } from '@cloud-ru/ds-info-block';
|
|
3
3
|
import type { SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
4
4
|
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
5
|
-
import {
|
|
5
|
+
import { TitleClickable } from '@cloud-ru/ds-uikit-product-title-clickable';
|
|
6
6
|
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
7
|
-
import { MouseEventHandler, ReactNode } from 'react';
|
|
7
|
+
import { MouseEventHandler, PropsWithChildren, ReactNode } from 'react';
|
|
8
8
|
import { BUTTON_TYPE } from './constants';
|
|
9
9
|
export type WidgetState = 'default' | 'loading' | 'error';
|
|
10
10
|
export type WidgetLayoutType = 'desktop' | 'mobile';
|
|
11
|
-
export type WidgetHeaderProps =
|
|
11
|
+
export type WidgetHeaderProps = TitleClickable.SimpleTitleProps & PropsWithChildren<{
|
|
12
|
+
href: string;
|
|
13
|
+
}>;
|
|
12
14
|
export type WidgetLoadingStateProps = {
|
|
13
15
|
/** Кастомный контент для состояния загрузки. */
|
|
14
16
|
loadingContent?: ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
4
4
|
import { BACKGROUND_PREDEFINED_FILL, backgroundPredefinedFillToAcrylic } from '@cloud-ru/ds-materials';
|
|
5
5
|
import { Skeleton } from '@cloud-ru/ds-skeleton';
|
|
@@ -12,6 +12,7 @@ import { Actions, ActionView, Content, ControlBlock, isVisibleAction } from '../
|
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
const ACRYLIC = backgroundPredefinedFillToAcrylic(BACKGROUND_PREDEFINED_FILL.NeutralBackground1Level);
|
|
14
14
|
function WidgetComponent({ header, children, actions = [], wide: wideProp = false, state = WIDGET_STATE.Default, loadingState, errorState, className, actionsChildren, segmentControl, ...rest }) {
|
|
15
|
+
const { title, icon, titleTag, children: headerChildren, ...headerProps } = header;
|
|
15
16
|
const { layoutType: contextLayoutType } = useAdaptiveLayout();
|
|
16
17
|
const isMobile = isMobileLayout(contextLayoutType);
|
|
17
18
|
const wide = wideProp && !isMobile;
|
|
@@ -27,7 +28,7 @@ function WidgetComponent({ header, children, actions = [], wide: wideProp = fals
|
|
|
27
28
|
const withKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === BUTTON_TYPE.Kebab));
|
|
28
29
|
return [withoutKebab, withKebab];
|
|
29
30
|
}, [visibleItems, hiddenItems]);
|
|
30
|
-
return (_jsxs("div", { className: cn(styles.widget, className), "data-state": state, ref: containerRef, "data-wide": wide || undefined, "data-acrylic-appearance": ACRYLIC.appearance, "data-acrylic-level": ACRYLIC.level, ...extractSupportProps(rest), children: [_jsx("span", { className: styles.acrylic, "aria-hidden": true }), _jsxs("div", { className: styles.widgetHeader, "data-mobile": !wide || undefined, "data-test-id": TEST_IDS.header, children: [_jsxs("div", { className: styles.headerMain, children: [state === WIDGET_STATE.Loading ? (_jsx("div", { className: styles.skeletonHeader, children: _jsx(Skeleton, { loading: true, className: styles.skeletonTitle }) })) : (_jsx(TitleClickable, { ...
|
|
31
|
+
return (_jsxs("div", { className: cn(styles.widget, className), "data-state": state, ref: containerRef, "data-wide": wide || undefined, "data-acrylic-appearance": ACRYLIC.appearance, "data-acrylic-level": ACRYLIC.level, ...extractSupportProps(rest), children: [_jsx("span", { className: styles.acrylic, "aria-hidden": true }), _jsxs("div", { className: styles.widgetHeader, "data-mobile": !wide || undefined, "data-test-id": TEST_IDS.header, children: [_jsxs("div", { className: styles.headerMain, children: [state === WIDGET_STATE.Loading ? (_jsx("div", { className: styles.skeletonHeader, children: _jsx(Skeleton, { loading: true, className: styles.skeletonTitle }) })) : (_jsx(TitleClickable, { ...headerProps, className: cn(styles.titleClickable, header.className), content: _jsxs(_Fragment, { children: [_jsx(TitleClickable.SimpleTitle, { title: title, icon: icon, titleTag: titleTag }), headerChildren] }) })), !wide && (_jsx(Actions, { actions: state === WIDGET_STATE.Error ? actions : hiddenItemsWithKebab, actionsChildren: actionsChildren, wide: wide, state: state }))] }), _jsx(ControlBlock, { actions: actions, actionsChildren: actionsChildren, segmentControl: segmentControl, wide: wide, state: state })] }), _jsx("div", { className: styles.widgetContent, "data-test-id": TEST_IDS.content, children: _jsx(Content, { state: state, wide: wide, loadingState: loadingState, errorState: errorState, children: children }) }), !wide &&
|
|
31
32
|
state !== WIDGET_STATE.Error &&
|
|
32
33
|
visibleItemsWithoutKebab.map((action, index) => state === WIDGET_STATE.Loading ? (_jsx(Skeleton, { loading: true, className: styles.skeletonButton }, index)) : (_createElement(ActionView, { ...action, key: index, commonProps: {
|
|
33
34
|
className: styles.button,
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ import { ButtonProps } from '@cloud-ru/ds-button';
|
|
|
2
2
|
import type { InfoBlockProps } from '@cloud-ru/ds-info-block';
|
|
3
3
|
import type { SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
4
4
|
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
5
|
-
import {
|
|
5
|
+
import { TitleClickable } from '@cloud-ru/ds-uikit-product-title-clickable';
|
|
6
6
|
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
7
|
-
import { MouseEventHandler, ReactNode } from 'react';
|
|
7
|
+
import { MouseEventHandler, PropsWithChildren, ReactNode } from 'react';
|
|
8
8
|
import { BUTTON_TYPE } from './constants.js';
|
|
9
9
|
export type WidgetState = 'default' | 'loading' | 'error';
|
|
10
10
|
export type WidgetLayoutType = 'desktop' | 'mobile';
|
|
11
|
-
export type WidgetHeaderProps =
|
|
11
|
+
export type WidgetHeaderProps = TitleClickable.SimpleTitleProps & PropsWithChildren<{
|
|
12
|
+
href: string;
|
|
13
|
+
}>;
|
|
12
14
|
export type WidgetLoadingStateProps = {
|
|
13
15
|
/** Кастомный контент для состояния загрузки. */
|
|
14
16
|
loadingContent?: ReactNode;
|