@cloud-ru/ds-uikit-product-card-predefined 4.2.5-preview-67c3d8fb.0 → 4.2.5-preview-c75d4f3d.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 +5 -5
- package/dist/cjs/components/CardNavigation/CardNavigation.js +0 -3
- package/dist/cjs/components/CardServiceLight/CardServiceLight.js +0 -3
- package/dist/cjs/helperComponents/CardActionsSurface/CardActionsSurface.d.ts +0 -1
- package/dist/cjs/helperComponents/CardActionsSurface/CardActionsSurface.js +1 -9
- package/dist/esm/components/CardNavigation/CardNavigation.js +0 -3
- package/dist/esm/components/CardServiceLight/CardServiceLight.js +0 -3
- package/dist/esm/helperComponents/CardActionsSurface/CardActionsSurface.d.ts +0 -1
- package/dist/esm/helperComponents/CardActionsSurface/CardActionsSurface.js +2 -10
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +15 -16
- package/src/components/CardNavigation/CardNavigation.tsx +0 -3
- package/src/components/CardServiceLight/CardServiceLight.tsx +0 -3
- package/src/helperComponents/CardActionsSurface/CardActionsSurface.tsx +18 -33
package/README.md
CHANGED
|
@@ -366,9 +366,9 @@ export function PolymorphicLink() {
|
|
|
366
366
|
| `favorite` | `FavoriteProps` | — | Настройки кнопки «Избранное». <br/> Keyboard: ArrowRight на карточке → tooltip (если есть) → Favorite; ArrowLeft — в обратном порядке. |
|
|
367
367
|
| `icon` | `ReactElement<any, string \| JSXElementConstructor<any>>` | — | Иконка сервиса |
|
|
368
368
|
| `innerRef` | `PolymorphicRef` | — | Ref на реальный DOM-элемент / инстанс |
|
|
369
|
-
| `promoTag` | `CardPromoTagProps` \| `PromoTagPredefinedBaseProps` | — | Настройки promo tag. При отсутствии не отображается |
|
|
369
|
+
| `promoTag` | `CardPromoTagProps` \| `DataTestIdProps` \| `PromoTagPredefinedBaseProps` | — | Настройки promo tag. При отсутствии не отображается |
|
|
370
370
|
| `title` | `string` | — | Заголовок карточки |
|
|
371
|
-
| `tooltip` | `TooltipProps` | — | Подсказка с иконкой «?» рядом с заголовком |
|
|
371
|
+
| `tooltip` | `DataTestIdProps` \| `TooltipProps` | — | Подсказка с иконкой «?» рядом с заголовком |
|
|
372
372
|
| `truncate` | `{ title?: number; }` | — | Настройки обрезки текста заголовка |
|
|
373
373
|
|
|
374
374
|
##### Related types
|
|
@@ -593,7 +593,7 @@ export function PolymorphicLink() {
|
|
|
593
593
|
| `favorite` | `FavoriteProps` | — | Настройки кнопки «Избранное». <br/> Keyboard: ArrowRight на карточке → Favorite → expand; ArrowLeft — в обратном порядке. |
|
|
594
594
|
| `icon` | `ReactElement<any, string \| JSXElementConstructor<any>>` | — | Иконка сервиса |
|
|
595
595
|
| `innerRef` | `PolymorphicRef` | — | Ref на реальный DOM-элемент / инстанс |
|
|
596
|
-
| `promoTag` | `CardPromoTagProps` \| `PromoTagPredefinedBaseProps` | — | Настройки promo tag. При отсутствии не отображается |
|
|
596
|
+
| `promoTag` | `CardPromoTagProps` \| `DataTestIdProps` \| `PromoTagPredefinedBaseProps` | — | Настройки promo tag. При отсутствии не отображается |
|
|
597
597
|
| `title` | `string` | — | Заголовок карточки |
|
|
598
598
|
|
|
599
599
|
##### Related types
|
|
@@ -828,7 +828,7 @@ export function PolymorphicLink() {
|
|
|
828
828
|
| `favorite` | `FavoriteProps` | — | Настройки кнопки «Избранное» |
|
|
829
829
|
| `innerRef` | `PolymorphicRef` | — | Ref на реальный DOM-элемент / инстанс |
|
|
830
830
|
| `outline` | `boolean` | — | Рамка вокруг карточки |
|
|
831
|
-
| `promoBadge` | `PromoTagOwnProps` \| `PromoTagProps` | — | Промо-тег (бейдж). Тип — `PromoTagProps` из `@cloud-ru/ds-promo-tag`. |
|
|
831
|
+
| `promoBadge` | `DataTestIdProps` \| `PromoTagOwnProps` \| `PromoTagProps` | — | Промо-тег (бейдж). Тип — `PromoTagProps` из `@cloud-ru/ds-promo-tag`. |
|
|
832
832
|
| `title` | `string` | — | Заголовок карточки |
|
|
833
833
|
| `truncate` | `{ title?: number; }` | — | Настройки обрезки заголовка |
|
|
834
834
|
|
|
@@ -1019,7 +1019,7 @@ export function PolymorphicLink() {
|
|
|
1019
1019
|
| `data-test-id` | `string` | — | Support prop для тестов |
|
|
1020
1020
|
| `disabled` | `boolean` | — | Неактивное состояние |
|
|
1021
1021
|
| `innerRef` | `PolymorphicRef` | — | Ref на реальный DOM-элемент / инстанс |
|
|
1022
|
-
| `promoBadge` | `PromoTagOwnProps` \| `PromoTagProps` | — | Промо-тег. <br/> Используйте `PromoTagProps` из `@cloud-ru/ds-promo-tag`. |
|
|
1022
|
+
| `promoBadge` | `DataTestIdProps` \| `PromoTagOwnProps` \| `PromoTagProps` | — | Промо-тег. <br/> Используйте `PromoTagProps` из `@cloud-ru/ds-promo-tag`. |
|
|
1023
1023
|
| `size` | `"m"` \| `"s"` | `m` | Размер: управляет типографикой и отступами. <br/> `'m'` — roleTitle/m + roleBody/m, padding 16px; <br/> `'s'` — roleTitle/s + roleBody/s, padding 8px. |
|
|
1024
1024
|
| `title` | `string` | — | Заголовок |
|
|
1025
1025
|
| `truncate` | `{ title?: number; content?: number; } \| undefined` | — | Настройки обрезки текста |
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CardNavigation = CardNavigation;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const adaptive_1 = require("@cloud-ru/ds-adaptive");
|
|
9
8
|
const materials_1 = require("@cloud-ru/ds-materials");
|
|
10
9
|
const theme_1 = require("@cloud-ru/ds-theme");
|
|
11
10
|
const truncate_string_1 = require("@cloud-ru/ds-truncate-string");
|
|
@@ -30,7 +29,6 @@ function CardNavigation({ as, innerRef, icon, title, description, promoTag, trun
|
|
|
30
29
|
const promoTagTooltipTriggerRef = (0, react_1.useRef)(null);
|
|
31
30
|
const favoriteRef = (0, react_1.useRef)(null);
|
|
32
31
|
const expandButtonRef = (0, react_1.useRef)(null);
|
|
33
|
-
const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
34
32
|
const compactThemeClassName = (0, theme_1.useThemeClassnames)({ density: 'compact' });
|
|
35
33
|
const isDetailed = description !== undefined;
|
|
36
34
|
const actionsVisibility = actionsVisibilityProp ?? constants_1.VISIBILITY_STRATEGY.hover;
|
|
@@ -123,7 +121,6 @@ function CardNavigation({ as, innerRef, icon, title, description, promoTag, trun
|
|
|
123
121
|
enabled: favorite.enabled,
|
|
124
122
|
checked: isFavorite,
|
|
125
123
|
onChange: setIsFavorite,
|
|
126
|
-
showTooltip: !(0, adaptive_1.isMobileLayout)(layoutType),
|
|
127
124
|
buttonRef: favoriteRef,
|
|
128
125
|
'data-test-id': constants_1.TEST_IDS.cardNavigationFavorite,
|
|
129
126
|
}
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CardServiceLight = CardServiceLight;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const adaptive_1 = require("@cloud-ru/ds-adaptive");
|
|
9
8
|
const theme_1 = require("@cloud-ru/ds-theme");
|
|
10
9
|
const truncate_string_1 = require("@cloud-ru/ds-truncate-string");
|
|
11
10
|
const typography_1 = require("@cloud-ru/ds-typography");
|
|
@@ -24,7 +23,6 @@ function CardServiceLight({ as, innerRef, icon, title, promoTag, truncate, actio
|
|
|
24
23
|
const promoTagTooltipTriggerRef = (0, react_1.useRef)(null);
|
|
25
24
|
const favoriteRef = (0, react_1.useRef)(null);
|
|
26
25
|
const expandButtonRef = (0, react_1.useRef)(null);
|
|
27
|
-
const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
28
26
|
const compactThemeClassName = (0, theme_1.useThemeClassnames)({ density: 'compact' });
|
|
29
27
|
const actionsVisibility = actionsVisibilityProp ?? constants_1.VISIBILITY_STRATEGY.hover;
|
|
30
28
|
const [isFavorite, setIsFavorite] = (0, utils_1.useValueControl)({
|
|
@@ -101,7 +99,6 @@ function CardServiceLight({ as, innerRef, icon, title, promoTag, truncate, actio
|
|
|
101
99
|
enabled: favorite.enabled,
|
|
102
100
|
checked: isFavorite,
|
|
103
101
|
onChange: setIsFavorite,
|
|
104
|
-
showTooltip: !(0, adaptive_1.isMobileLayout)(layoutType),
|
|
105
102
|
buttonRef: favoriteRef,
|
|
106
103
|
'data-test-id': constants_1.TEST_IDS.cardServiceLightFavorite,
|
|
107
104
|
}
|
|
@@ -19,7 +19,6 @@ function CardActionsSurface({ actionsVisibility = constants_1.VISIBILITY_STRATEG
|
|
|
19
19
|
const { t } = locale_1.cardPredefinedLocale.useTranslations();
|
|
20
20
|
const [visibleTooltip, setVisibleTooltip] = (0, react_1.useState)(undefined);
|
|
21
21
|
const rootRef = (0, react_1.useRef)(null);
|
|
22
|
-
const showFavoriteTooltip = favorite?.showTooltip ?? true;
|
|
23
22
|
const tooltipTrigger = tooltip?.trigger ??
|
|
24
23
|
(actionsVisibility === constants_1.VISIBILITY_STRATEGY.always ? tooltip_1.TRIGGER.Click : tooltip_1.TRIGGER.HoverAndFocusVisible);
|
|
25
24
|
const getHandleTooltipOpenChange = (0, react_1.useCallback)((tooltipType) => (isOpen) => {
|
|
@@ -30,11 +29,6 @@ function CardActionsSurface({ actionsVisibility = constants_1.VISIBILITY_STRATEG
|
|
|
30
29
|
setVisibleTooltip(isOpen ? tooltipType : undefined);
|
|
31
30
|
onTooltipOpenChange?.(isOpen);
|
|
32
31
|
}, [onTooltipOpenChange, tooltipTrigger]);
|
|
33
|
-
(0, react_1.useEffect)(() => {
|
|
34
|
-
if (!showFavoriteTooltip && visibleTooltip === 'favorite') {
|
|
35
|
-
getHandleTooltipOpenChange('favorite')(false);
|
|
36
|
-
}
|
|
37
|
-
}, [getHandleTooltipOpenChange, showFavoriteTooltip, visibleTooltip]);
|
|
38
32
|
if (!tooltip && !favorite && !expandable) {
|
|
39
33
|
return null;
|
|
40
34
|
}
|
|
@@ -55,9 +49,7 @@ function CardActionsSurface({ actionsVisibility = constants_1.VISIBILITY_STRATEG
|
|
|
55
49
|
onTooltipOpenChange?.(false);
|
|
56
50
|
};
|
|
57
51
|
const { buttonRef: tooltipButtonRef, 'data-test-id': tooltipTestId, ...tooltipProps } = tooltip ?? {};
|
|
58
|
-
const favoriteLabel = favorite?.checked ? t('actions.favoriteRemove') : t('actions.favoriteAdd');
|
|
59
|
-
const favoriteButton = favorite?.enabled && ((0, jsx_runtime_1.jsx)(button_1.Button, { as: 'span', role: 'button', "aria-label": favoriteLabel, "aria-pressed": Boolean(favorite.checked), size: 'm', appearance: 'neutral', view: 'simple', icon: favorite.checked ? (0, jsx_runtime_1.jsx)(system_1.StarFilledSVG, {}) : (0, jsx_runtime_1.jsx)(system_1.StarSVG, {}), onClick: handleFavoriteClick, className: styles_module_scss_1.default.favorite, innerRef: favorite.buttonRef, tabIndex: -1, "data-test-id": favorite['data-test-id'], "data-checked": favorite.checked || undefined }));
|
|
60
52
|
return (
|
|
61
53
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
62
|
-
(0, jsx_runtime_1.jsxs)("div", { ref: rootRef, onClick: utils_1.preventEventDefaultAndPropagation, onMouseLeave: handleMouseLeave, className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-actions-visibility": actionsVisibility, children: [tooltip && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { ...tooltipProps, open: visibleTooltip === 'info', onOpenChange: getHandleTooltipOpenChange('info'), tip: tooltip.tip, trigger: tooltipTrigger, hoverDelayOpen: constants_1.TOOLTIP_HOVER_DELAY_OPEN_MS, triggerClassName: styles_module_scss_1.default.tooltipTrigger, children: (0, jsx_runtime_1.jsx)(button_1.Button, { as: 'span', role: 'button', "aria-label": t('actions.info'), size: 'm', appearance: 'neutral', view: 'simple', icon: (0, jsx_runtime_1.jsx)(product_1.InfoOutlineSVG, {}), tabIndex: -1, onClick: utils_1.preventEventDefault, innerRef: tooltipButtonRef, "data-test-id": tooltipTestId }) })),
|
|
54
|
+
(0, jsx_runtime_1.jsxs)("div", { ref: rootRef, onClick: utils_1.preventEventDefaultAndPropagation, onMouseLeave: handleMouseLeave, className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-actions-visibility": actionsVisibility, children: [tooltip && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { ...tooltipProps, open: visibleTooltip === 'info', onOpenChange: getHandleTooltipOpenChange('info'), tip: tooltip.tip, trigger: tooltipTrigger, hoverDelayOpen: constants_1.TOOLTIP_HOVER_DELAY_OPEN_MS, triggerClassName: styles_module_scss_1.default.tooltipTrigger, children: (0, jsx_runtime_1.jsx)(button_1.Button, { as: 'span', role: 'button', "aria-label": t('actions.info'), size: 'm', appearance: 'neutral', view: 'simple', icon: (0, jsx_runtime_1.jsx)(product_1.InfoOutlineSVG, {}), tabIndex: -1, onClick: utils_1.preventEventDefault, innerRef: tooltipButtonRef, "data-test-id": tooltipTestId }) })), favorite?.enabled && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: favorite.checked ? t('actions.favoriteRemove') : t('actions.favoriteAdd'), trigger: tooltipTrigger, triggerClassName: styles_module_scss_1.default.tooltipTrigger, hoverDelayOpen: constants_1.TOOLTIP_HOVER_DELAY_OPEN_MS, open: visibleTooltip === 'favorite', onOpenChange: getHandleTooltipOpenChange('favorite'), children: (0, jsx_runtime_1.jsx)(button_1.Button, { as: 'span', role: 'button', "aria-pressed": Boolean(favorite.checked), size: 'm', appearance: 'neutral', view: 'simple', icon: favorite.checked ? (0, jsx_runtime_1.jsx)(system_1.StarFilledSVG, {}) : (0, jsx_runtime_1.jsx)(system_1.StarSVG, {}), onClick: handleFavoriteClick, className: styles_module_scss_1.default.favorite, innerRef: favorite.buttonRef, tabIndex: -1, "data-test-id": favorite['data-test-id'], "data-checked": favorite.checked || undefined }) })), expandable && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: expandable.value ? t('actions.collapse') : t('actions.expand'), trigger: tooltipTrigger, triggerClassName: styles_module_scss_1.default.tooltipTrigger, hoverDelayOpen: constants_1.TOOLTIP_HOVER_DELAY_OPEN_MS, open: visibleTooltip === 'expandable', onOpenChange: getHandleTooltipOpenChange('expandable'), children: (0, jsx_runtime_1.jsx)(button_1.Button, { as: 'span', role: 'button', "aria-expanded": expandable.value, size: 'm', appearance: 'neutral', view: 'simple', icon: expandable.value ? (0, jsx_runtime_1.jsx)(system_1.CollapseVerticalSVG, {}) : (0, jsx_runtime_1.jsx)(system_1.ExpandVerticalSVG, {}), onClick: handleExpandButtonClick, className: styles_module_scss_1.default.expandButton, innerRef: expandable.buttonRef, tabIndex: -1 }) }))] }));
|
|
63
55
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
3
2
|
import { BACKGROUND_PREDEFINED_FILL, backgroundPredefinedFillToAcrylic } from '@cloud-ru/ds-materials';
|
|
4
3
|
import { useThemeClassnames } from '@cloud-ru/ds-theme';
|
|
5
4
|
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
@@ -24,7 +23,6 @@ export function CardNavigation({ as, innerRef, icon, title, description, promoTa
|
|
|
24
23
|
const promoTagTooltipTriggerRef = useRef(null);
|
|
25
24
|
const favoriteRef = useRef(null);
|
|
26
25
|
const expandButtonRef = useRef(null);
|
|
27
|
-
const { layoutType } = useAdaptiveLayout();
|
|
28
26
|
const compactThemeClassName = useThemeClassnames({ density: 'compact' });
|
|
29
27
|
const isDetailed = description !== undefined;
|
|
30
28
|
const actionsVisibility = actionsVisibilityProp ?? VISIBILITY_STRATEGY.hover;
|
|
@@ -117,7 +115,6 @@ export function CardNavigation({ as, innerRef, icon, title, description, promoTa
|
|
|
117
115
|
enabled: favorite.enabled,
|
|
118
116
|
checked: isFavorite,
|
|
119
117
|
onChange: setIsFavorite,
|
|
120
|
-
showTooltip: !isMobileLayout(layoutType),
|
|
121
118
|
buttonRef: favoriteRef,
|
|
122
119
|
'data-test-id': TEST_IDS.cardNavigationFavorite,
|
|
123
120
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
3
2
|
import { useThemeClassnames } from '@cloud-ru/ds-theme';
|
|
4
3
|
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
5
4
|
import { Typography } from '@cloud-ru/ds-typography';
|
|
@@ -18,7 +17,6 @@ export function CardServiceLight({ as, innerRef, icon, title, promoTag, truncate
|
|
|
18
17
|
const promoTagTooltipTriggerRef = useRef(null);
|
|
19
18
|
const favoriteRef = useRef(null);
|
|
20
19
|
const expandButtonRef = useRef(null);
|
|
21
|
-
const { layoutType } = useAdaptiveLayout();
|
|
22
20
|
const compactThemeClassName = useThemeClassnames({ density: 'compact' });
|
|
23
21
|
const actionsVisibility = actionsVisibilityProp ?? VISIBILITY_STRATEGY.hover;
|
|
24
22
|
const [isFavorite, setIsFavorite] = useValueControl({
|
|
@@ -95,7 +93,6 @@ export function CardServiceLight({ as, innerRef, icon, title, promoTag, truncate
|
|
|
95
93
|
enabled: favorite.enabled,
|
|
96
94
|
checked: isFavorite,
|
|
97
95
|
onChange: setIsFavorite,
|
|
98
|
-
showTooltip: !isMobileLayout(layoutType),
|
|
99
96
|
buttonRef: favoriteRef,
|
|
100
97
|
'data-test-id': TEST_IDS.cardServiceLightFavorite,
|
|
101
98
|
}
|
|
@@ -5,7 +5,7 @@ import { CollapseVerticalSVG, ExpandVerticalSVG, StarFilledSVG, StarSVG } from '
|
|
|
5
5
|
import { Tooltip, TRIGGER } from '@cloud-ru/ds-tooltip';
|
|
6
6
|
import { preventEventDefault, preventEventDefaultAndPropagation } from '@cloud-ru/ds-utils';
|
|
7
7
|
import cn from 'classnames';
|
|
8
|
-
import { useCallback,
|
|
8
|
+
import { useCallback, useRef, useState } from 'react';
|
|
9
9
|
import { TOOLTIP_HOVER_DELAY_OPEN_MS, VISIBILITY_STRATEGY } from '../../constants.js';
|
|
10
10
|
import { cardPredefinedLocale } from '../../locale/index.js';
|
|
11
11
|
import styles from './styles.module.css';
|
|
@@ -13,7 +13,6 @@ export function CardActionsSurface({ actionsVisibility = VISIBILITY_STRATEGY.hov
|
|
|
13
13
|
const { t } = cardPredefinedLocale.useTranslations();
|
|
14
14
|
const [visibleTooltip, setVisibleTooltip] = useState(undefined);
|
|
15
15
|
const rootRef = useRef(null);
|
|
16
|
-
const showFavoriteTooltip = favorite?.showTooltip ?? true;
|
|
17
16
|
const tooltipTrigger = tooltip?.trigger ??
|
|
18
17
|
(actionsVisibility === VISIBILITY_STRATEGY.always ? TRIGGER.Click : TRIGGER.HoverAndFocusVisible);
|
|
19
18
|
const getHandleTooltipOpenChange = useCallback((tooltipType) => (isOpen) => {
|
|
@@ -24,11 +23,6 @@ export function CardActionsSurface({ actionsVisibility = VISIBILITY_STRATEGY.hov
|
|
|
24
23
|
setVisibleTooltip(isOpen ? tooltipType : undefined);
|
|
25
24
|
onTooltipOpenChange?.(isOpen);
|
|
26
25
|
}, [onTooltipOpenChange, tooltipTrigger]);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!showFavoriteTooltip && visibleTooltip === 'favorite') {
|
|
29
|
-
getHandleTooltipOpenChange('favorite')(false);
|
|
30
|
-
}
|
|
31
|
-
}, [getHandleTooltipOpenChange, showFavoriteTooltip, visibleTooltip]);
|
|
32
26
|
if (!tooltip && !favorite && !expandable) {
|
|
33
27
|
return null;
|
|
34
28
|
}
|
|
@@ -49,9 +43,7 @@ export function CardActionsSurface({ actionsVisibility = VISIBILITY_STRATEGY.hov
|
|
|
49
43
|
onTooltipOpenChange?.(false);
|
|
50
44
|
};
|
|
51
45
|
const { buttonRef: tooltipButtonRef, 'data-test-id': tooltipTestId, ...tooltipProps } = tooltip ?? {};
|
|
52
|
-
const favoriteLabel = favorite?.checked ? t('actions.favoriteRemove') : t('actions.favoriteAdd');
|
|
53
|
-
const favoriteButton = favorite?.enabled && (_jsx(Button, { as: 'span', role: 'button', "aria-label": favoriteLabel, "aria-pressed": Boolean(favorite.checked), size: 'm', appearance: 'neutral', view: 'simple', icon: favorite.checked ? _jsx(StarFilledSVG, {}) : _jsx(StarSVG, {}), onClick: handleFavoriteClick, className: styles.favorite, innerRef: favorite.buttonRef, tabIndex: -1, "data-test-id": favorite['data-test-id'], "data-checked": favorite.checked || undefined }));
|
|
54
46
|
return (
|
|
55
47
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
56
|
-
_jsxs("div", { ref: rootRef, onClick: preventEventDefaultAndPropagation, onMouseLeave: handleMouseLeave, className: cn(styles.root, className), "data-actions-visibility": actionsVisibility, children: [tooltip && (_jsx(Tooltip, { ...tooltipProps, open: visibleTooltip === 'info', onOpenChange: getHandleTooltipOpenChange('info'), tip: tooltip.tip, trigger: tooltipTrigger, hoverDelayOpen: TOOLTIP_HOVER_DELAY_OPEN_MS, triggerClassName: styles.tooltipTrigger, children: _jsx(Button, { as: 'span', role: 'button', "aria-label": t('actions.info'), size: 'm', appearance: 'neutral', view: 'simple', icon: _jsx(InfoOutlineSVG, {}), tabIndex: -1, onClick: preventEventDefault, innerRef: tooltipButtonRef, "data-test-id": tooltipTestId }) })),
|
|
48
|
+
_jsxs("div", { ref: rootRef, onClick: preventEventDefaultAndPropagation, onMouseLeave: handleMouseLeave, className: cn(styles.root, className), "data-actions-visibility": actionsVisibility, children: [tooltip && (_jsx(Tooltip, { ...tooltipProps, open: visibleTooltip === 'info', onOpenChange: getHandleTooltipOpenChange('info'), tip: tooltip.tip, trigger: tooltipTrigger, hoverDelayOpen: TOOLTIP_HOVER_DELAY_OPEN_MS, triggerClassName: styles.tooltipTrigger, children: _jsx(Button, { as: 'span', role: 'button', "aria-label": t('actions.info'), size: 'm', appearance: 'neutral', view: 'simple', icon: _jsx(InfoOutlineSVG, {}), tabIndex: -1, onClick: preventEventDefault, innerRef: tooltipButtonRef, "data-test-id": tooltipTestId }) })), favorite?.enabled && (_jsx(Tooltip, { tip: favorite.checked ? t('actions.favoriteRemove') : t('actions.favoriteAdd'), trigger: tooltipTrigger, triggerClassName: styles.tooltipTrigger, hoverDelayOpen: TOOLTIP_HOVER_DELAY_OPEN_MS, open: visibleTooltip === 'favorite', onOpenChange: getHandleTooltipOpenChange('favorite'), children: _jsx(Button, { as: 'span', role: 'button', "aria-pressed": Boolean(favorite.checked), size: 'm', appearance: 'neutral', view: 'simple', icon: favorite.checked ? _jsx(StarFilledSVG, {}) : _jsx(StarSVG, {}), onClick: handleFavoriteClick, className: styles.favorite, innerRef: favorite.buttonRef, tabIndex: -1, "data-test-id": favorite['data-test-id'], "data-checked": favorite.checked || undefined }) })), expandable && (_jsx(Tooltip, { tip: expandable.value ? t('actions.collapse') : t('actions.expand'), trigger: tooltipTrigger, triggerClassName: styles.tooltipTrigger, hoverDelayOpen: TOOLTIP_HOVER_DELAY_OPEN_MS, open: visibleTooltip === 'expandable', onOpenChange: getHandleTooltipOpenChange('expandable'), children: _jsx(Button, { as: 'span', role: 'button', "aria-expanded": expandable.value, size: 'm', appearance: 'neutral', view: 'simple', icon: expandable.value ? _jsx(CollapseVerticalSVG, {}) : _jsx(ExpandVerticalSVG, {}), onClick: handleExpandButtonClick, className: styles.expandButton, innerRef: expandable.buttonRef, tabIndex: -1 }) }))] }));
|
|
57
49
|
}
|