@cloud-ru/ds-uikit-product-header 1.2.1 → 1.2.2-preview-bf64a5bb.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/README.md CHANGED
@@ -253,6 +253,7 @@ export function WithFavorites() {
253
253
  | `badge` | `CardServiceLightProps` \| `PromoTagPredefinedBaseProps` | — | |
254
254
  | `description` | `string \| undefined` | — | Краткое описание сервиса — отображается при включённом переключателе «Описание». |
255
255
  | `disabled` | `boolean \| undefined` | — | |
256
+ | `favoritesEnabled` | `boolean \| undefined` | — | Разрешено ли добавление карточки в избранное. default=true - разрешено |
256
257
  | `hidden` | `boolean \| undefined` | — | |
257
258
  | `href` | `string \| undefined` | — | |
258
259
  | `icon` | `JSXElementConstructor<{ size?: number; className?: string; }> \| undefined` | — | Иконка карточки. |
@@ -14,11 +14,12 @@ const utils_1 = require("../../utils");
14
14
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
15
15
  function ServiceCard({ service, favorite, isMobile, onServiceClick, showDescription, className, tabIndex, dragPreview, expandable, }) {
16
16
  const isInFavorites = favorite?.value.includes(service.id) ?? false;
17
+ const isFavoriteEnabled = service.favoritesEnabled ?? true;
17
18
  const favoriteProps = !dragPreview && favorite
18
19
  ? {
19
20
  checked: isInFavorites,
20
21
  onChange: favorite.onChange(service.id),
21
- enabled: !service.disabled,
22
+ enabled: !service.disabled && isFavoriteEnabled,
22
23
  }
23
24
  : undefined;
24
25
  const commonProps = {
@@ -43,7 +44,8 @@ function ServiceCard({ service, favorite, isMobile, onServiceClick, showDescript
43
44
  return dragPreview ? (0, jsx_runtime_1.jsx)(drag_and_drop_1.DragPreview, { className: styles_module_scss_1.default.dragCardPreview, children: card }) : card;
44
45
  }
45
46
  function DraggableServiceCard({ groupId, service, favorite, dragDisabled, ...props }) {
46
- const disabled = dragDisabled || service.disabled || favorite?.value.includes(service.id);
47
+ const isFavoriteEnabled = service.favoritesEnabled ?? true;
48
+ const disabled = dragDisabled || service.disabled || favorite?.value.includes(service.id) || !isFavoriteEnabled;
47
49
  const { attributes, listeners, setNodeRef, isDragging } = (0, core_1.useDraggable)({
48
50
  id: (0, utils_1.getServiceSourceDragId)(groupId, service.id),
49
51
  disabled,
@@ -34,6 +34,8 @@ export type InnerLink = {
34
34
  disabled?: boolean;
35
35
  hidden?: boolean;
36
36
  badge?: CardServiceLightProps['promoTag'];
37
+ /** Разрешено ли добавление карточки в избранное. default=true - разрешено */
38
+ favoritesEnabled?: boolean;
37
39
  /**
38
40
  * Вложенные сервисы подкатегории.
39
41
  *
@@ -7,11 +7,12 @@ import { getLinkEmblem, getServiceSourceDragId } from '../../utils/index.js';
7
7
  import styles from './styles.module.css';
8
8
  export function ServiceCard({ service, favorite, isMobile, onServiceClick, showDescription, className, tabIndex, dragPreview, expandable, }) {
9
9
  const isInFavorites = favorite?.value.includes(service.id) ?? false;
10
+ const isFavoriteEnabled = service.favoritesEnabled ?? true;
10
11
  const favoriteProps = !dragPreview && favorite
11
12
  ? {
12
13
  checked: isInFavorites,
13
14
  onChange: favorite.onChange(service.id),
14
- enabled: !service.disabled,
15
+ enabled: !service.disabled && isFavoriteEnabled,
15
16
  }
16
17
  : undefined;
17
18
  const commonProps = {
@@ -36,7 +37,8 @@ export function ServiceCard({ service, favorite, isMobile, onServiceClick, showD
36
37
  return dragPreview ? _jsx(DragPreview, { className: styles.dragCardPreview, children: card }) : card;
37
38
  }
38
39
  export function DraggableServiceCard({ groupId, service, favorite, dragDisabled, ...props }) {
39
- const disabled = dragDisabled || service.disabled || favorite?.value.includes(service.id);
40
+ const isFavoriteEnabled = service.favoritesEnabled ?? true;
41
+ const disabled = dragDisabled || service.disabled || favorite?.value.includes(service.id) || !isFavoriteEnabled;
40
42
  const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
41
43
  id: getServiceSourceDragId(groupId, service.id),
42
44
  disabled,
@@ -34,6 +34,8 @@ export type InnerLink = {
34
34
  disabled?: boolean;
35
35
  hidden?: boolean;
36
36
  badge?: CardServiceLightProps['promoTag'];
37
+ /** Разрешено ли добавление карточки в избранное. default=true - разрешено */
38
+ favoritesEnabled?: boolean;
37
39
  /**
38
40
  * Вложенные сервисы подкатегории.
39
41
  *