@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-uikit-product-widget",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Карточка продуктового виджета с кликабельным заголовком, SegmentControl, действиями и состояниями loading/error.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,18 +40,18 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "classnames": "^2.5.1",
43
- "@cloud-ru/ds-adaptive": "^1.0.2",
44
- "@cloud-ru/ds-info-block": "^1.0.3",
45
- "@cloud-ru/ds-materials": "^2.0.1",
43
+ "@cloud-ru/ds-icons": "^1.7.1",
44
+ "@cloud-ru/ds-button": "^1.0.5",
45
+ "@cloud-ru/ds-adaptive": "^1.0.3",
46
+ "@cloud-ru/ds-info-block": "^1.0.4",
46
47
  "@cloud-ru/ds-locale": "^1.0.0",
47
- "@cloud-ru/ds-icons": "^1.6.0",
48
- "@cloud-ru/ds-tooltip": "^1.0.13",
49
- "@cloud-ru/ds-segment-control": "^1.0.15",
50
- "@cloud-ru/ds-skeleton": "^1.0.2",
51
- "@cloud-ru/ds-button": "^1.0.4",
52
- "@cloud-ru/ds-utils": "^1.2.0",
53
- "@cloud-ru/ds-uikit-product-title-clickable": "^1.0.19",
54
- "@cloud-ru/ds-list": "^3.0.0"
48
+ "@cloud-ru/ds-list": "^3.0.2",
49
+ "@cloud-ru/ds-segment-control": "^1.0.17",
50
+ "@cloud-ru/ds-skeleton": "^1.0.3",
51
+ "@cloud-ru/ds-materials": "^2.0.2",
52
+ "@cloud-ru/ds-tooltip": "^1.0.15",
53
+ "@cloud-ru/ds-uikit-product-title-clickable": "^2.0.0",
54
+ "@cloud-ru/ds-utils": "^1.3.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
@@ -26,6 +26,7 @@ function WidgetComponent({
26
26
  segmentControl,
27
27
  ...rest
28
28
  }: WidgetProps) {
29
+ const { title, icon, titleTag, children: headerChildren, ...headerProps } = header;
29
30
  const { layoutType: contextLayoutType } = useAdaptiveLayout();
30
31
  const isMobile = isMobileLayout(contextLayoutType);
31
32
  const wide = wideProp && !isMobile;
@@ -63,7 +64,16 @@ function WidgetComponent({
63
64
  <Skeleton loading className={styles.skeletonTitle} />
64
65
  </div>
65
66
  ) : (
66
- <TitleClickable {...header} className={cn(styles.titleClickable, header.className)} />
67
+ <TitleClickable
68
+ {...headerProps}
69
+ className={cn(styles.titleClickable, header.className)}
70
+ content={
71
+ <>
72
+ <TitleClickable.SimpleTitle title={title} icon={icon} titleTag={titleTag} />
73
+ {headerChildren}
74
+ </>
75
+ }
76
+ />
67
77
  )}
68
78
 
69
79
  {!wide && (
package/src/types.ts CHANGED
@@ -2,9 +2,9 @@ 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 { TitleClickableProps } from '@cloud-ru/ds-uikit-product-title-clickable';
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
 
9
9
  import { BUTTON_TYPE } from './constants';
10
10
 
@@ -12,10 +12,7 @@ export type WidgetState = 'default' | 'loading' | 'error';
12
12
 
13
13
  export type WidgetLayoutType = 'desktop' | 'mobile';
14
14
 
15
- export type WidgetHeaderProps = Pick<
16
- TitleClickableProps,
17
- 'title' | 'icon' | 'avatar' | 'href' | 'target' | 'onClick' | 'titleTag' | 'fullWidth' | 'children' | 'className'
18
- >;
15
+ export type WidgetHeaderProps = TitleClickable.SimpleTitleProps & PropsWithChildren<{ href: string }>;
19
16
 
20
17
  export type WidgetLoadingStateProps = {
21
18
  /** Кастомный контент для состояния загрузки. */
@@ -117,13 +114,7 @@ type DroplistAction = BaseAction &
117
114
  };
118
115
 
119
116
  export type Action =
120
- | ButtonAction
121
- | OutlineAction
122
- | TonalAction
123
- | FunctionAction
124
- | SimpleAction
125
- | KebabAction
126
- | DroplistAction;
117
+ ButtonAction | OutlineAction | TonalAction | FunctionAction | SimpleAction | KebabAction | DroplistAction;
127
118
 
128
119
  export type WidgetAction = Action;
129
120