@cloud-ru/ds-uikit-product-card-predefined 3.1.4-preview-d90ac2be.0 → 3.1.4
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 +7 -0
- package/dist/cjs/components/CardCustom/Footer/components/CallToAction/styles.module.css +4 -4
- package/dist/cjs/components/CardCustom/FunctionBadge/styles.module.css +4 -3
- package/dist/cjs/components/CardCustom/Header/styles.module.css +1 -7
- package/dist/cjs/components/CardCustom/Image/styles.module.css +3 -3
- package/dist/cjs/components/CardServiceInfo/styles.module.css +11 -11
- package/dist/cjs/components/CardServiceLight/styles.module.css +7 -7
- package/dist/cjs/components/CardServiceSmall/CardServiceSmall.js +1 -1
- package/dist/cjs/components/CardServiceSmall/styles.module.css +6 -0
- package/dist/cjs/components/index.d.ts +0 -1
- package/dist/cjs/components/index.js +0 -1
- package/dist/cjs/constants.d.ts +0 -7
- package/dist/cjs/constants.js +0 -7
- package/dist/cjs/helperComponents/CardAction/CardAction.js +1 -1
- package/dist/cjs/helperComponents/CardAction/styles.module.css +8 -1
- package/dist/cjs/helperComponents/CardActionsSurface/styles.module.css +5 -4
- package/dist/cjs/helperComponents/FunctionBadgeWrapper/styles.module.css +4 -3
- package/dist/cjs/style.css +53 -503
- package/dist/esm/components/CardCustom/Footer/components/CallToAction/styles.module.css +4 -4
- package/dist/esm/components/CardCustom/FunctionBadge/styles.module.css +4 -3
- package/dist/esm/components/CardCustom/Header/styles.module.css +1 -7
- package/dist/esm/components/CardCustom/Image/styles.module.css +3 -3
- package/dist/esm/components/CardServiceInfo/styles.module.css +11 -11
- package/dist/esm/components/CardServiceLight/styles.module.css +7 -7
- package/dist/esm/components/CardServiceSmall/CardServiceSmall.js +1 -1
- package/dist/esm/components/CardServiceSmall/styles.module.css +6 -0
- package/dist/esm/components/index.d.ts +0 -1
- package/dist/esm/components/index.js +0 -1
- package/dist/esm/constants.d.ts +0 -7
- package/dist/esm/constants.js +0 -7
- package/dist/esm/helperComponents/CardAction/CardAction.js +1 -1
- package/dist/esm/helperComponents/CardAction/styles.module.css +8 -1
- package/dist/esm/helperComponents/CardActionsSurface/styles.module.css +5 -4
- package/dist/esm/helperComponents/FunctionBadgeWrapper/styles.module.css +4 -3
- package/dist/esm/style.css +53 -503
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/CardCustom/Footer/components/CallToAction/styles.module.scss +2 -2
- package/src/components/CardCustom/FunctionBadge/styles.module.scss +2 -1
- package/src/components/CardCustom/Header/styles.module.scss +2 -6
- package/src/components/CardCustom/Image/styles.module.scss +2 -3
- package/src/components/CardServiceInfo/styles.module.scss +2 -2
- package/src/components/CardServiceLight/styles.module.scss +2 -2
- package/src/components/CardServiceSmall/CardServiceSmall.tsx +2 -1
- package/src/components/CardServiceSmall/styles.module.scss +6 -0
- package/src/components/CardSuggest/styles.module.scss +18 -11
- package/src/components/index.ts +0 -1
- package/src/constants.ts +0 -7
- package/src/helperComponents/CardAction/CardAction.tsx +2 -2
- package/src/helperComponents/CardAction/styles.module.scss +7 -0
- package/src/helperComponents/CardActionsSurface/styles.module.scss +1 -0
- package/src/helperComponents/FunctionBadgeWrapper/styles.module.scss +1 -0
- package/dist/cjs/components/CardNavigation/CardNavigation.d.ts +0 -61
- package/dist/cjs/components/CardNavigation/CardNavigation.js +0 -139
- package/dist/cjs/components/CardNavigation/index.d.ts +0 -1
- package/dist/cjs/components/CardNavigation/index.js +0 -17
- package/dist/cjs/components/CardNavigation/styles.module.css +0 -460
- package/dist/esm/components/CardNavigation/CardNavigation.d.ts +0 -61
- package/dist/esm/components/CardNavigation/CardNavigation.js +0 -133
- package/dist/esm/components/CardNavigation/index.d.ts +0 -1
- package/dist/esm/components/CardNavigation/index.js +0 -1
- package/dist/esm/components/CardNavigation/styles.module.css +0 -460
- package/src/components/CardNavigation/CardNavigation.tsx +0 -331
- package/src/components/CardNavigation/index.ts +0 -1
- package/src/components/CardNavigation/styles.module.scss +0 -246
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
2
|
-
import { PolymorphicRef } from '@cloud-ru/ds-card';
|
|
3
|
-
import { BACKGROUND_PREDEFINED_FILL, backgroundPredefinedFillToAcrylic } from '@cloud-ru/ds-materials';
|
|
4
|
-
import { useThemeClassnames } from '@cloud-ru/ds-theme';
|
|
5
|
-
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
6
|
-
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
7
|
-
import { Typography } from '@cloud-ru/ds-typography';
|
|
8
|
-
import { useValueControl, withInnerRefSupport } from '@cloud-ru/ds-utils';
|
|
9
|
-
import cn from 'classnames';
|
|
10
|
-
import mergeRefs from 'merge-refs';
|
|
11
|
-
import {
|
|
12
|
-
ComponentPropsWithoutRef,
|
|
13
|
-
ElementType,
|
|
14
|
-
FocusEvent,
|
|
15
|
-
KeyboardEventHandler,
|
|
16
|
-
MouseEvent,
|
|
17
|
-
MouseEventHandler,
|
|
18
|
-
PointerEvent,
|
|
19
|
-
ReactElement,
|
|
20
|
-
useMemo,
|
|
21
|
-
useRef,
|
|
22
|
-
useState,
|
|
23
|
-
} from 'react';
|
|
24
|
-
|
|
25
|
-
import { TEST_IDS, VISIBILITY_STRATEGY } from '../../constants';
|
|
26
|
-
import { CardActionsSurface, CardPromoTag, createCardActionsKeyDownHandler } from '../../helperComponents';
|
|
27
|
-
import { CardPromoTagProps, CardSize, FavoriteProps, VisibilityStrategy } from '../../types';
|
|
28
|
-
import styles from './styles.module.scss';
|
|
29
|
-
|
|
30
|
-
const TARGET_BLANK = '_blank';
|
|
31
|
-
|
|
32
|
-
const { appearance: ACRYLIC_APPEARANCE, level: ACRYLIC_LEVEL } = backgroundPredefinedFillToAcrylic(
|
|
33
|
-
BACKGROUND_PREDEFINED_FILL.NeutralBackground1Level,
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
type BaseCardNavigationProps = {
|
|
37
|
-
/** Иконка сервиса */
|
|
38
|
-
icon?: ReactElement;
|
|
39
|
-
/** Заголовок карточки */
|
|
40
|
-
title: string;
|
|
41
|
-
/**
|
|
42
|
-
* Описание сервиса. Передано (в том числе пустой строкой) — карточка в подробном виде: с рамкой
|
|
43
|
-
* и описанием под заголовком. Не передано — компактный вид в одну строку.
|
|
44
|
-
*
|
|
45
|
-
* Вид меняется без пересоздания DOM: переключение описания — обновление пропа, а не перемонтирование.
|
|
46
|
-
*/
|
|
47
|
-
description?: string;
|
|
48
|
-
/** Настройки promo tag. При отсутствии не отображается */
|
|
49
|
-
promoTag?: CardPromoTagProps;
|
|
50
|
-
/** Настройки обрезки текста заголовка. В подробном виде заголовок всегда в одну строку */
|
|
51
|
-
truncate?: {
|
|
52
|
-
/** Максимальное количество строк заголовка */
|
|
53
|
-
title?: number;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Формат отображения дополнительных действий: всегда или при наведении и фокусе
|
|
57
|
-
* @default 'hover'
|
|
58
|
-
*/
|
|
59
|
-
actionsVisibility?: VisibilityStrategy;
|
|
60
|
-
/** Размер кнопок действий. По умолчанию — по раскладке (`s` на mobile, `m` на desktop) */
|
|
61
|
-
actionsSize?: CardSize;
|
|
62
|
-
/** Подсказка с иконкой «?» рядом с заголовком. Показывается только в компактном виде */
|
|
63
|
-
tooltip?: Omit<TooltipProps, 'trigger' | 'size'>;
|
|
64
|
-
/**
|
|
65
|
-
* Настройки кнопки «Избранное».
|
|
66
|
-
* Keyboard: ArrowRight на карточке → promo tag → tooltip (если есть) → Favorite → expand; ArrowLeft — в обратном порядке.
|
|
67
|
-
*/
|
|
68
|
-
favorite?: FavoriteProps;
|
|
69
|
-
/** Неактивное состояние */
|
|
70
|
-
disabled?: boolean;
|
|
71
|
-
/** CSS-класс корневого элемента */
|
|
72
|
-
className?: string;
|
|
73
|
-
/** Support prop для тестов */
|
|
74
|
-
'data-test-id'?: string;
|
|
75
|
-
/** Настройки кнопки раскрытия */
|
|
76
|
-
expandable?: {
|
|
77
|
-
value: boolean;
|
|
78
|
-
onClick(): void;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export type CardNavigationProps<T extends ElementType = 'button'> = BaseCardNavigationProps & {
|
|
83
|
-
/** Полиморфный элемент: `'button'`, `'a'`, `{Link}` и т.д. */
|
|
84
|
-
as?: T;
|
|
85
|
-
/** Ref на реальный DOM-элемент / инстанс */
|
|
86
|
-
innerRef?: PolymorphicRef<T>;
|
|
87
|
-
} & Omit<ComponentPropsWithoutRef<T>, keyof BaseCardNavigationProps | 'as' | 'ref'>;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Карточка навигации к сервису: объединяет `CardServiceLight` (компактный вид) и `CardServiceInfo`
|
|
91
|
-
* (вид с описанием) в один компонент с одним деревом DOM.
|
|
92
|
-
*/
|
|
93
|
-
export function CardNavigation<T extends ElementType = 'button'>({
|
|
94
|
-
as,
|
|
95
|
-
innerRef,
|
|
96
|
-
icon,
|
|
97
|
-
title,
|
|
98
|
-
description,
|
|
99
|
-
promoTag,
|
|
100
|
-
truncate,
|
|
101
|
-
actionsVisibility: actionsVisibilityProp,
|
|
102
|
-
actionsSize: actionsSizeProp,
|
|
103
|
-
favorite,
|
|
104
|
-
tooltip,
|
|
105
|
-
className,
|
|
106
|
-
disabled = false,
|
|
107
|
-
expandable,
|
|
108
|
-
'data-test-id': dataTestId,
|
|
109
|
-
...rest
|
|
110
|
-
}: CardNavigationProps<T>): ReactElement | null {
|
|
111
|
-
const { layoutType } = useAdaptiveLayout();
|
|
112
|
-
const isMobile = isMobileLayout(layoutType);
|
|
113
|
-
const Component: ElementType = as ?? 'button';
|
|
114
|
-
const cardRef = useRef<HTMLElement>(null);
|
|
115
|
-
const tooltipTriggerRef = useRef<HTMLButtonElement>(null);
|
|
116
|
-
const promoTagTooltipTriggerRef = useRef<HTMLElement>(null);
|
|
117
|
-
const favoriteRef = useRef<HTMLButtonElement>(null);
|
|
118
|
-
const expandButtonRef = useRef<HTMLButtonElement>(null);
|
|
119
|
-
|
|
120
|
-
const compactThemeClassName = useThemeClassnames({ density: 'compact' });
|
|
121
|
-
|
|
122
|
-
const isDetailed = description !== undefined;
|
|
123
|
-
const actionsVisibility = actionsVisibilityProp ?? VISIBILITY_STRATEGY.hover;
|
|
124
|
-
const actionsSize = actionsSizeProp ?? (isMobile ? 's' : 'm');
|
|
125
|
-
// Подсказка «?» есть только у компактного вида: в подробном её роль играет описание.
|
|
126
|
-
const cardTooltip = isDetailed ? undefined : tooltip;
|
|
127
|
-
const visibleActionsCount = Number(Boolean(favorite?.enabled)) + Number(Boolean(expandable));
|
|
128
|
-
|
|
129
|
-
const [isFavorite, setIsFavorite] = useValueControl<boolean>({
|
|
130
|
-
value: favorite?.checked,
|
|
131
|
-
defaultValue: false,
|
|
132
|
-
onChange: favorite?.onChange,
|
|
133
|
-
});
|
|
134
|
-
const [isTooltipOpen, setIsTooltipOpen] = useState<boolean>(false);
|
|
135
|
-
|
|
136
|
-
// Панель действий (`Tooltip` на floating-ui + кнопки) в режиме `hover` скрыта до наведения, `always` показывает панель сразу.
|
|
137
|
-
// При рендере большого количества карточек на одном экране может вызывать лаги, поэтому монтируем её при первом наведении или фокусе.
|
|
138
|
-
const [isActionsRequested, setIsActionsRequested] = useState<boolean>(false);
|
|
139
|
-
const shouldRenderActions = isActionsRequested || actionsVisibility === VISIBILITY_STRATEGY.always;
|
|
140
|
-
|
|
141
|
-
const tooltipTrigger = actionsVisibility === VISIBILITY_STRATEGY.hover ? 'hoverAndFocusVisible' : 'click';
|
|
142
|
-
|
|
143
|
-
const {
|
|
144
|
-
onKeyDown: onKeyDownProp,
|
|
145
|
-
onPointerEnter: onPointerEnterProp,
|
|
146
|
-
onFocus: onFocusProp,
|
|
147
|
-
...restWithoutKeyDown
|
|
148
|
-
} = rest as ComponentPropsWithoutRef<T> & {
|
|
149
|
-
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
150
|
-
onPointerEnter?(event: PointerEvent<HTMLElement>): void;
|
|
151
|
-
onFocus?(event: FocusEvent<HTMLElement>): void;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const handlePointerEnter = (event: PointerEvent<HTMLElement>) => {
|
|
155
|
-
setIsActionsRequested(true);
|
|
156
|
-
onPointerEnterProp?.(event);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const handleFocus = (event: FocusEvent<HTMLElement>) => {
|
|
160
|
-
setIsActionsRequested(true);
|
|
161
|
-
onFocusProp?.(event);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const handleKeyDown = useMemo(
|
|
165
|
-
() =>
|
|
166
|
-
createCardActionsKeyDownHandler({
|
|
167
|
-
disabled,
|
|
168
|
-
cardRef,
|
|
169
|
-
onKeyDown: onKeyDownProp,
|
|
170
|
-
items: [
|
|
171
|
-
promoTag && { ref: promoTagTooltipTriggerRef },
|
|
172
|
-
cardTooltip && { ref: tooltipTriggerRef },
|
|
173
|
-
favorite?.enabled && {
|
|
174
|
-
ref: favoriteRef,
|
|
175
|
-
onActivate: () => setIsFavorite(!isFavorite),
|
|
176
|
-
},
|
|
177
|
-
expandable && {
|
|
178
|
-
ref: expandButtonRef,
|
|
179
|
-
onActivate: () => expandable.onClick(),
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
}),
|
|
183
|
-
[disabled, onKeyDownProp, promoTag, cardTooltip, favorite?.enabled, expandable, isFavorite, setIsFavorite],
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
let polymorphicProps: Record<string, unknown>;
|
|
187
|
-
if (Component === 'a') {
|
|
188
|
-
const { href, target, onClick, ...anchorRest } = restWithoutKeyDown as ComponentPropsWithoutRef<'a'>;
|
|
189
|
-
polymorphicProps = {
|
|
190
|
-
...anchorRest,
|
|
191
|
-
href: href ?? '#',
|
|
192
|
-
target,
|
|
193
|
-
rel: target === TARGET_BLANK ? 'noopener noreferrer' : undefined,
|
|
194
|
-
onClick: disabled
|
|
195
|
-
? (e: MouseEvent<HTMLAnchorElement>) => {
|
|
196
|
-
e.preventDefault();
|
|
197
|
-
onClick?.(e);
|
|
198
|
-
}
|
|
199
|
-
: onClick,
|
|
200
|
-
};
|
|
201
|
-
} else if (Component === 'button') {
|
|
202
|
-
const { type = 'button', onClick, ...buttonRest } = restWithoutKeyDown as ComponentPropsWithoutRef<'button'>;
|
|
203
|
-
polymorphicProps = {
|
|
204
|
-
type,
|
|
205
|
-
disabled,
|
|
206
|
-
onClick: disabled ? undefined : onClick,
|
|
207
|
-
...buttonRest,
|
|
208
|
-
};
|
|
209
|
-
} else {
|
|
210
|
-
// Кастомный компонент (роутерный Link и т.п.) нативный `disabled` не понимает: гасим переход
|
|
211
|
-
// тем же preventDefault, что и на анкоре — иначе disabled-карточка остаётся кликабельной.
|
|
212
|
-
const { onClick, ...componentRest } = restWithoutKeyDown as { onClick?: MouseEventHandler<HTMLElement> };
|
|
213
|
-
polymorphicProps = {
|
|
214
|
-
...componentRest,
|
|
215
|
-
onClick: disabled
|
|
216
|
-
? (e: MouseEvent<HTMLElement>) => {
|
|
217
|
-
e.preventDefault();
|
|
218
|
-
}
|
|
219
|
-
: onClick,
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return (
|
|
224
|
-
<Component
|
|
225
|
-
ref={mergeRefs(innerRef, cardRef)}
|
|
226
|
-
className={cn(styles.root, className)}
|
|
227
|
-
data-test-id={dataTestId ?? TEST_IDS.cardNavigation}
|
|
228
|
-
data-detailed={isDetailed || undefined}
|
|
229
|
-
data-disabled={disabled || undefined}
|
|
230
|
-
data-mobile={isMobile || undefined}
|
|
231
|
-
data-actions-size={actionsSize}
|
|
232
|
-
data-actions-visibility={actionsVisibility}
|
|
233
|
-
data-visible-actions={visibleActionsCount}
|
|
234
|
-
data-acrylic-appearance={ACRYLIC_APPEARANCE}
|
|
235
|
-
data-acrylic-level={ACRYLIC_LEVEL}
|
|
236
|
-
aria-disabled={Component !== 'button' && disabled ? true : undefined}
|
|
237
|
-
tabIndex={Component !== 'button' && disabled ? -1 : undefined}
|
|
238
|
-
onKeyDown={handleKeyDown}
|
|
239
|
-
onPointerEnter={handlePointerEnter}
|
|
240
|
-
onFocus={handleFocus}
|
|
241
|
-
data-tooltip-open={isTooltipOpen || undefined}
|
|
242
|
-
{...polymorphicProps}
|
|
243
|
-
>
|
|
244
|
-
{/* Порядок узлов фиксирован: условные слои занимают свои позиции, остальные не пересоздаются. */}
|
|
245
|
-
{isDetailed && <span className={styles.acrylic} aria-hidden data-acrylic-background />}
|
|
246
|
-
<span className={styles.stateLayer} data-state='emptyNeutralOnBackground' aria-hidden />
|
|
247
|
-
|
|
248
|
-
<div className={styles.container}>
|
|
249
|
-
{icon && <div className={styles.icon}>{icon}</div>}
|
|
250
|
-
|
|
251
|
-
<div className={styles.textContent}>
|
|
252
|
-
<div className={styles.titleRow}>
|
|
253
|
-
<Typography
|
|
254
|
-
as='span'
|
|
255
|
-
variant='body'
|
|
256
|
-
size='m'
|
|
257
|
-
className={styles.title}
|
|
258
|
-
data-test-id={TEST_IDS.cardNavigationTitle}
|
|
259
|
-
>
|
|
260
|
-
<TruncateString text={title} maxLines={isDetailed ? 1 : truncate?.title} variant='end' />
|
|
261
|
-
</Typography>
|
|
262
|
-
|
|
263
|
-
{promoTag && (
|
|
264
|
-
<CardPromoTag
|
|
265
|
-
promoTag={promoTag}
|
|
266
|
-
tooltipTrigger={tooltipTrigger}
|
|
267
|
-
innerRef={promoTagTooltipTriggerRef}
|
|
268
|
-
data-test-id={TEST_IDS.cardNavigationPromoTag}
|
|
269
|
-
className={compactThemeClassName}
|
|
270
|
-
/>
|
|
271
|
-
)}
|
|
272
|
-
</div>
|
|
273
|
-
|
|
274
|
-
{isDetailed && (
|
|
275
|
-
<Typography
|
|
276
|
-
as='p'
|
|
277
|
-
variant='body'
|
|
278
|
-
size='s'
|
|
279
|
-
className={styles.description}
|
|
280
|
-
data-test-id={TEST_IDS.cardNavigationDescription}
|
|
281
|
-
>
|
|
282
|
-
<TruncateString text={description} maxLines={2} variant='end' />
|
|
283
|
-
</Typography>
|
|
284
|
-
)}
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
|
|
288
|
-
{shouldRenderActions && (
|
|
289
|
-
<CardActionsSurface
|
|
290
|
-
actionsSize={actionsSize}
|
|
291
|
-
actionsVisibility={actionsVisibility}
|
|
292
|
-
className={styles.cardActions}
|
|
293
|
-
onTooltipOpenChange={setIsTooltipOpen}
|
|
294
|
-
tooltip={
|
|
295
|
-
cardTooltip
|
|
296
|
-
? {
|
|
297
|
-
...cardTooltip,
|
|
298
|
-
'data-test-id': TEST_IDS.cardNavigationTooltip,
|
|
299
|
-
buttonRef: tooltipTriggerRef,
|
|
300
|
-
}
|
|
301
|
-
: undefined
|
|
302
|
-
}
|
|
303
|
-
favorite={
|
|
304
|
-
favorite?.enabled
|
|
305
|
-
? {
|
|
306
|
-
enabled: favorite.enabled,
|
|
307
|
-
checked: isFavorite,
|
|
308
|
-
onChange: setIsFavorite,
|
|
309
|
-
buttonRef: favoriteRef,
|
|
310
|
-
'data-test-id': TEST_IDS.cardNavigationFavorite,
|
|
311
|
-
}
|
|
312
|
-
: undefined
|
|
313
|
-
}
|
|
314
|
-
expandable={
|
|
315
|
-
expandable
|
|
316
|
-
? {
|
|
317
|
-
value: expandable.value,
|
|
318
|
-
onClick: expandable.onClick,
|
|
319
|
-
buttonRef: expandButtonRef,
|
|
320
|
-
}
|
|
321
|
-
: undefined
|
|
322
|
-
}
|
|
323
|
-
/>
|
|
324
|
-
)}
|
|
325
|
-
|
|
326
|
-
{isDetailed && <span className={styles.outlineBorder} aria-hidden />}
|
|
327
|
-
</Component>
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
withInnerRefSupport(CardNavigation);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './CardNavigation';
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
@use '@cloud-ru/ds-figma-variables/build/scss/components/button.module' as btn;
|
|
2
|
-
@use '@cloud-ru/ds-figma-variables/build/scss/components/card.module' as card;
|
|
3
|
-
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
4
|
-
@use '@cloud-ru/ds-materials' as m;
|
|
5
|
-
|
|
6
|
-
$actions-sizes: 's', 'm';
|
|
7
|
-
$actions-counts: 1, 2;
|
|
8
|
-
|
|
9
|
-
// Резерв места под действия равен ширине icon-only кнопки того же размера — иначе при
|
|
10
|
-
// `actionsSize='s'` отступ был бы избыточным, а при смене плотности не совпал бы с реальной кнопкой.
|
|
11
|
-
@mixin actions-reserve {
|
|
12
|
-
@each $size in $actions-sizes {
|
|
13
|
-
$width: base.simple-var(btn.$button, 'anatomy', 'size', $size, 'container', 'iconOnly', 'min-width');
|
|
14
|
-
|
|
15
|
-
&[data-actions-size='#{$size}'] {
|
|
16
|
-
@each $count in $actions-counts {
|
|
17
|
-
&[data-visible-actions='#{$count}'] {
|
|
18
|
-
.titleRow {
|
|
19
|
-
padding-right: calc(#{$count} * #{$width});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.acrylic {
|
|
28
|
-
pointer-events: none;
|
|
29
|
-
position: absolute;
|
|
30
|
-
inset: 0;
|
|
31
|
-
border-radius: inherit;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.stateLayer {
|
|
35
|
-
visibility: initial;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.outlineBorder {
|
|
39
|
-
pointer-events: none;
|
|
40
|
-
|
|
41
|
-
position: absolute;
|
|
42
|
-
inset: 0;
|
|
43
|
-
|
|
44
|
-
border-color: base.$sn-theme-color-material-stateLayer-neutral-border-default-borderColor;
|
|
45
|
-
border-style: solid;
|
|
46
|
-
border-width: card.$sn-card-anatomy-radius-s-container-borderWidth;
|
|
47
|
-
border-radius: inherit;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// `actionsVisibility='always'` (мобильный вид) оставляет панель в потоке: чтобы она, как и
|
|
51
|
-
// `.container`, не рисовалась под `.stateLayer`, ей нужна позиция.
|
|
52
|
-
.cardActions[data-actions-visibility='always'] {
|
|
53
|
-
position: relative;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.container {
|
|
57
|
-
position: relative;
|
|
58
|
-
|
|
59
|
-
display: flex;
|
|
60
|
-
gap: base.$sn-primitive-dimension-8;
|
|
61
|
-
align-items: center;
|
|
62
|
-
|
|
63
|
-
box-sizing: border-box;
|
|
64
|
-
width: 100%;
|
|
65
|
-
min-width: 0;
|
|
66
|
-
min-height: base.$sn-primitive-dimension-32;
|
|
67
|
-
padding: base.$sn-primitive-dimension-4;
|
|
68
|
-
border-radius: inherit;
|
|
69
|
-
|
|
70
|
-
.root[data-mobile] & {
|
|
71
|
-
min-height: base.$sn-primitive-dimension-40;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.root[data-detailed] & {
|
|
75
|
-
gap: base.$sn-primitive-dimension-4;
|
|
76
|
-
align-items: flex-start;
|
|
77
|
-
min-height: 0;
|
|
78
|
-
padding: base.$sn-density-spacing-interval-s;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.root {
|
|
83
|
-
cursor: pointer;
|
|
84
|
-
|
|
85
|
-
position: relative;
|
|
86
|
-
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
|
|
90
|
-
box-sizing: border-box;
|
|
91
|
-
width: 100%;
|
|
92
|
-
min-width: 228px;
|
|
93
|
-
padding: 0;
|
|
94
|
-
border: none;
|
|
95
|
-
border-radius: base.$sn-density-radius-3xs;
|
|
96
|
-
|
|
97
|
-
font: inherit;
|
|
98
|
-
color: inherit;
|
|
99
|
-
text-decoration: none;
|
|
100
|
-
|
|
101
|
-
background-color: transparent;
|
|
102
|
-
|
|
103
|
-
&[data-disabled] {
|
|
104
|
-
pointer-events: none;
|
|
105
|
-
cursor: default;
|
|
106
|
-
opacity: base.$sn-theme-effect-opacity-disabled;
|
|
107
|
-
|
|
108
|
-
.stateLayer {
|
|
109
|
-
visibility: hidden;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&:focus-visible {
|
|
114
|
-
outline: base.$sn-theme-color-primary-accent solid base.$sn-primitive-strokeWeight-strokeSemiBold;
|
|
115
|
-
outline-offset: 0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Компактный вид: при hover/focus панель действий встаёт в строку и сдвигает заголовок.
|
|
119
|
-
&:not([data-detailed], [data-disabled]):hover,
|
|
120
|
-
&:not([data-detailed], [data-disabled]):focus-visible,
|
|
121
|
-
&:not([data-detailed], [data-disabled])[data-tooltip-open],
|
|
122
|
-
&:not([data-detailed], [data-disabled]):has(*:focus-visible) {
|
|
123
|
-
.cardActions {
|
|
124
|
-
position: relative;
|
|
125
|
-
visibility: visible;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@include m.has-state-layer-as-child('stateLayer');
|
|
130
|
-
|
|
131
|
-
// Подробный вид: рамка, подложка и описание; hover показывается цветом рамки, а не state layer.
|
|
132
|
-
&[data-detailed] {
|
|
133
|
-
isolation: isolate;
|
|
134
|
-
|
|
135
|
-
overflow: hidden;
|
|
136
|
-
align-items: flex-start;
|
|
137
|
-
|
|
138
|
-
min-width: 0;
|
|
139
|
-
border-radius: card.$sn-card-anatomy-radius-s-container-borderRadius;
|
|
140
|
-
|
|
141
|
-
outline: none;
|
|
142
|
-
|
|
143
|
-
.stateLayer {
|
|
144
|
-
display: none;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Гаснет только контент: подложка и рамка остаются в полную силу.
|
|
148
|
-
&[data-disabled] {
|
|
149
|
-
opacity: 1;
|
|
150
|
-
|
|
151
|
-
.container {
|
|
152
|
-
opacity: base.$sn-theme-effect-opacity-disabled;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
&:focus-visible::after {
|
|
157
|
-
pointer-events: none;
|
|
158
|
-
content: '';
|
|
159
|
-
|
|
160
|
-
position: absolute;
|
|
161
|
-
inset: 0;
|
|
162
|
-
|
|
163
|
-
border: base.$sn-primitive-strokeWeight-strokeSemiBold solid base.$sn-theme-color-primary-accent;
|
|
164
|
-
border-radius: inherit;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&:hover,
|
|
168
|
-
&:focus-visible,
|
|
169
|
-
&:has(*:focus-visible) {
|
|
170
|
-
.cardActions {
|
|
171
|
-
visibility: visible;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
&[data-actions-visibility='hover'] {
|
|
175
|
-
@include actions-reserve;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Панель — соседний с контентом элемент строки: под неё не нужен отступ в самом контенте.
|
|
180
|
-
&[data-actions-visibility='always']:not([data-visible-actions='0']) {
|
|
181
|
-
.container {
|
|
182
|
-
padding-right: 0;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.cardActions {
|
|
186
|
-
align-self: flex-start;
|
|
187
|
-
margin-top: base.$sn-density-spacing-interval-s;
|
|
188
|
-
margin-right: base.$sn-density-spacing-interval-s;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
@media (hover: hover) {
|
|
193
|
-
&:not([data-disabled]):hover .outlineBorder {
|
|
194
|
-
border-color: base.$sn-theme-color-material-stateLayer-neutral-border-hovered-borderColor;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@include m.with-material('acrylic', 'acrylic');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.icon {
|
|
203
|
-
flex-shrink: 0;
|
|
204
|
-
width: base.$sn-density-size-icon-s;
|
|
205
|
-
height: base.$sn-density-size-icon-s;
|
|
206
|
-
color: base.$sn-theme-color-available-version-textTertiary;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.textContent {
|
|
210
|
-
display: flex;
|
|
211
|
-
flex: 1;
|
|
212
|
-
flex-direction: column;
|
|
213
|
-
align-items: flex-start;
|
|
214
|
-
|
|
215
|
-
min-width: 0;
|
|
216
|
-
|
|
217
|
-
text-align: left;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.titleRow {
|
|
221
|
-
display: flex;
|
|
222
|
-
gap: base.$sn-primitive-dimension-4;
|
|
223
|
-
align-items: center;
|
|
224
|
-
|
|
225
|
-
box-sizing: border-box;
|
|
226
|
-
width: 100%;
|
|
227
|
-
min-width: 0;
|
|
228
|
-
min-height: base.$sn-primitive-dimension-24;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.title {
|
|
232
|
-
overflow: hidden;
|
|
233
|
-
display: block;
|
|
234
|
-
flex-shrink: 1;
|
|
235
|
-
|
|
236
|
-
min-width: 0;
|
|
237
|
-
|
|
238
|
-
color: base.$sn-theme-color-available-version-textMain;
|
|
239
|
-
text-overflow: ellipsis;
|
|
240
|
-
white-space: nowrap;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.description {
|
|
244
|
-
width: 100%;
|
|
245
|
-
color: base.$sn-theme-color-available-version-textTertiary;
|
|
246
|
-
}
|