@cloud-ru/ds-uikit-product-header 2.0.3-preview-c6bef496.0 → 2.0.3
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 +4 -0
- package/dist/cjs/components/HeaderLayout/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/Banners/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SubCategory/styles.module.css +2 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +7 -7
- package/dist/cjs/components/MainMenu/helperComponents/Favorites/components/EmptyState/styles.module.css +3 -3
- package/dist/cjs/components/MainMenu/helperComponents/Favorites/styles.module.css +3 -3
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/MenuBottom.js +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuHeaderBrand/styles.module.css +3 -3
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +1 -2
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/ScrollWithAnimatedStickyPanel/ScrollWithAnimatedStickyPanel.js +6 -18
- package/dist/cjs/components/PlatformLogo/styles.module.css +1 -1
- package/dist/cjs/components/UserMenu/UserMenu.js +4 -5
- package/dist/cjs/components/UserMenu/hooks/useLogoutItem.d.ts +2 -2
- package/dist/cjs/components/UserMenu/hooks/useLogoutItem.js +9 -12
- package/dist/cjs/components/UserMenu/hooks/useUserMenuItems.js +3 -3
- package/dist/cjs/components/UserMenu/styles.module.css +1 -10
- package/dist/cjs/constants.d.ts +1 -0
- package/dist/cjs/constants.js +3 -1
- package/dist/cjs/style.css +24 -33
- package/dist/esm/components/HeaderLayout/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/Banners/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SubCategory/styles.module.css +2 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +7 -7
- package/dist/esm/components/MainMenu/helperComponents/Favorites/components/EmptyState/styles.module.css +3 -3
- package/dist/esm/components/MainMenu/helperComponents/Favorites/styles.module.css +3 -3
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/MenuBottom.js +2 -2
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuHeaderBrand/styles.module.css +3 -3
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +2 -3
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/ScrollWithAnimatedStickyPanel/ScrollWithAnimatedStickyPanel.js +6 -18
- package/dist/esm/components/PlatformLogo/styles.module.css +1 -1
- package/dist/esm/components/UserMenu/UserMenu.js +7 -8
- package/dist/esm/components/UserMenu/hooks/useLogoutItem.d.ts +2 -2
- package/dist/esm/components/UserMenu/hooks/useLogoutItem.js +9 -9
- package/dist/esm/components/UserMenu/hooks/useUserMenuItems.js +3 -3
- package/dist/esm/components/UserMenu/styles.module.css +1 -10
- package/dist/esm/constants.d.ts +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/style.css +24 -33
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +28 -28
- package/src/components/MainMenu/helperComponents/MenuBottom/MenuBottom.tsx +2 -2
- package/src/components/MainMenu/helperComponents/MenuMobile/MenuMobile.tsx +2 -3
- package/src/components/MainMenu/helperComponents/ScrollWithAnimatedStickyPanel/ScrollWithAnimatedStickyPanel.tsx +10 -21
- package/src/components/UserMenu/UserMenu.tsx +7 -11
- package/src/components/UserMenu/hooks/useLogoutItem.tsx +12 -12
- package/src/components/UserMenu/hooks/useUserMenuItems.ts +4 -4
- package/src/components/UserMenu/styles.module.scss +0 -11
- package/src/constants.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-uikit-product-header",
|
|
3
|
-
"version": "2.0.3
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Продуктовая шапка консоли — HeaderLayout, MainMenu, UserMenu, Logo, PathBreadcrumbs и PlatformLogo.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,33 +45,33 @@
|
|
|
45
45
|
"@dnd-kit/utilities": "^3.2.2",
|
|
46
46
|
"classnames": "^2.5.1",
|
|
47
47
|
"fuse.js": "^7.1.0",
|
|
48
|
-
"@cloud-ru/ds-accordion": "1.1.
|
|
49
|
-
"@cloud-ru/ds-
|
|
50
|
-
"@cloud-ru/ds-
|
|
51
|
-
"@cloud-ru/ds-avatar": "1.0.
|
|
52
|
-
"@cloud-ru/ds-
|
|
53
|
-
"@cloud-ru/ds-card": "1.0.18
|
|
54
|
-
"@cloud-ru/ds-
|
|
55
|
-
"@cloud-ru/ds-drawer": "1.2.6
|
|
56
|
-
"@cloud-ru/ds-icons": "1.
|
|
57
|
-
"@cloud-ru/ds-
|
|
58
|
-
"@cloud-ru/ds-
|
|
59
|
-
"@cloud-ru/ds-
|
|
60
|
-
"@cloud-ru/ds-
|
|
61
|
-
"@cloud-ru/ds-modal": "1.1.7
|
|
62
|
-
"@cloud-ru/ds-portal-context": "1.0.2",
|
|
63
|
-
"@cloud-ru/ds-promo-tag": "1.0.3",
|
|
64
|
-
"@cloud-ru/ds-
|
|
65
|
-
"@cloud-ru/ds-
|
|
66
|
-
"@cloud-ru/ds-
|
|
67
|
-
"@cloud-ru/ds-skeleton": "1.0.2",
|
|
68
|
-
"@cloud-ru/ds-tooltip": "1.0.
|
|
69
|
-
"@cloud-ru/ds-
|
|
70
|
-
"@cloud-ru/ds-uikit-product-
|
|
71
|
-
"@cloud-ru/ds-
|
|
72
|
-
"@cloud-ru/ds-
|
|
73
|
-
"@cloud-ru/ds-
|
|
74
|
-
"@cloud-ru/ds-
|
|
48
|
+
"@cloud-ru/ds-accordion": "^1.1.4",
|
|
49
|
+
"@cloud-ru/ds-adaptive": "^1.0.2",
|
|
50
|
+
"@cloud-ru/ds-breadcrumbs": "^1.0.23",
|
|
51
|
+
"@cloud-ru/ds-avatar": "^1.0.9",
|
|
52
|
+
"@cloud-ru/ds-button": "^1.0.4",
|
|
53
|
+
"@cloud-ru/ds-card": "^1.0.18",
|
|
54
|
+
"@cloud-ru/ds-divider": "^1.0.2",
|
|
55
|
+
"@cloud-ru/ds-drawer": "^1.2.6",
|
|
56
|
+
"@cloud-ru/ds-icons": "^1.4.0",
|
|
57
|
+
"@cloud-ru/ds-drag-and-drop": "^1.1.3",
|
|
58
|
+
"@cloud-ru/ds-info-block": "^1.0.3",
|
|
59
|
+
"@cloud-ru/ds-locale": "^1.0.0",
|
|
60
|
+
"@cloud-ru/ds-list": "^2.2.6",
|
|
61
|
+
"@cloud-ru/ds-modal": "^1.1.7",
|
|
62
|
+
"@cloud-ru/ds-portal-context": "^1.0.2",
|
|
63
|
+
"@cloud-ru/ds-promo-tag": "^1.0.3",
|
|
64
|
+
"@cloud-ru/ds-scroll": "^1.0.5",
|
|
65
|
+
"@cloud-ru/ds-search": "^1.0.12",
|
|
66
|
+
"@cloud-ru/ds-segment-control": "^1.0.11",
|
|
67
|
+
"@cloud-ru/ds-skeleton": "^1.0.2",
|
|
68
|
+
"@cloud-ru/ds-tooltip": "^1.0.9",
|
|
69
|
+
"@cloud-ru/ds-uikit-product-card-predefined": "^4.0.3",
|
|
70
|
+
"@cloud-ru/ds-uikit-product-switch-row": "^1.0.12",
|
|
71
|
+
"@cloud-ru/ds-theme": "^2.0.0",
|
|
72
|
+
"@cloud-ru/ds-typography": "^1.0.1",
|
|
73
|
+
"@cloud-ru/ds-uikit-product-title-clickable": "^1.0.14",
|
|
74
|
+
"@cloud-ru/ds-utils": "^1.2.0"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Divider } from '@cloud-ru/ds-divider';
|
|
2
|
-
import {
|
|
2
|
+
import { CardServiceLight } from '@cloud-ru/ds-uikit-product-card-predefined';
|
|
3
3
|
import { Fragment, ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
import { TEST_IDS } from '../../../../constants';
|
|
@@ -23,7 +23,7 @@ export function MenuBottom({ settingItems, leftBottom }: MenuBottomProps) {
|
|
|
23
23
|
<Fragment key={item.id}>
|
|
24
24
|
{item.divider === 'before' && <Divider orientation='horizontal' className={styles.bottomDivider} />}
|
|
25
25
|
|
|
26
|
-
<
|
|
26
|
+
<CardServiceLight
|
|
27
27
|
{...(item.href ? { href: item.href, as: 'a' } : { as: 'button', type: 'button' })}
|
|
28
28
|
title={item.label}
|
|
29
29
|
icon={getLinkEmblem(item)}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Divider } from '@cloud-ru/ds-divider';
|
|
2
|
-
import { SNAP_POINTS_PRESET } from '@cloud-ru/ds-list';
|
|
3
2
|
import { useCallback, useMemo } from 'react';
|
|
4
3
|
|
|
5
|
-
import { TEST_IDS } from '../../../../constants';
|
|
4
|
+
import { BOTTOM_SHEET_FULLSCREEN_SNAP_POINTS, TEST_IDS } from '../../../../constants';
|
|
6
5
|
import { MobileDrawerCustom } from '../../../../mobileOverlays';
|
|
7
6
|
import { MainMenuDndContext } from '../../hooks/useMainMenuDnd';
|
|
8
7
|
import { useMenuItems } from '../../hooks/useMenuItems';
|
|
@@ -68,7 +67,7 @@ export function MenuMobile({
|
|
|
68
67
|
swipeEnabled={false}
|
|
69
68
|
data-test-id={TEST_IDS.mainMenu.drawerMobile}
|
|
70
69
|
closeOnPopstate
|
|
71
|
-
snapPoints={
|
|
70
|
+
snapPoints={BOTTOM_SHEET_FULLSCREEN_SNAP_POINTS}
|
|
72
71
|
disableMotions={true}
|
|
73
72
|
>
|
|
74
73
|
<ScrollWithAnimatedStickyPanel
|
|
@@ -7,11 +7,6 @@ type ScrollWithAnimatedStickyPanelProps = PropsWithChildren<{
|
|
|
7
7
|
panel: ReactNode;
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
|
-
// Упругая прокрутка у верхней границы (touch-скролл на мобильных не "упирается" жёстко в 0 —
|
|
11
|
-
// контент можно немного "оттянуть" дальше) даёт scrollTop, не совпадающий с реальным положением
|
|
12
|
-
// контента в этот момент. Диапазон запаса — единицы пикселей; двух хватает с большим запасом.
|
|
13
|
-
const TOP_OVERSCROLL_EPSILON_PX = 2;
|
|
14
|
-
|
|
15
10
|
export function ScrollWithAnimatedStickyPanel({ panel, children }: ScrollWithAnimatedStickyPanelProps) {
|
|
16
11
|
const [positions, setPositions] = useState({ panelTopShift: 0, containerScroll: 0 });
|
|
17
12
|
const [panelHeight, setPanelHeight] = useState(0);
|
|
@@ -28,14 +23,6 @@ export function ScrollWithAnimatedStickyPanel({ panel, children }: ScrollWithAni
|
|
|
28
23
|
|
|
29
24
|
setPanelHeight(panelHeight);
|
|
30
25
|
|
|
31
|
-
// У верхней границы панель всегда полностью видна — не доверяем накопленному diff. Иначе
|
|
32
|
-
// "лишний" ход упругой прокрутки у самого верха читается как скролл вниз и на возврате к
|
|
33
|
-
// началу списка панель может остаться скрытой, хотя пользователь как раз скроллит наверх.
|
|
34
|
-
if (target.scrollTop <= TOP_OVERSCROLL_EPSILON_PX) {
|
|
35
|
-
setPositions({ panelTopShift: 0, containerScroll: target.scrollTop });
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
26
|
setPositions(prev => {
|
|
40
27
|
const diff = prev.containerScroll - target.scrollTop;
|
|
41
28
|
|
|
@@ -46,19 +33,21 @@ export function ScrollWithAnimatedStickyPanel({ panel, children }: ScrollWithAni
|
|
|
46
33
|
});
|
|
47
34
|
}, []);
|
|
48
35
|
|
|
49
|
-
const setPanelRef = useCallback((element: HTMLDivElement | null) => {
|
|
50
|
-
if (element) {
|
|
51
|
-
setPanelHeight(element.offsetHeight);
|
|
52
|
-
panelRef.current = element;
|
|
53
|
-
}
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
36
|
return (
|
|
57
37
|
<div className={styles.container} style={{ '--snack-autohide-panel-height': `${panelHeight}px` }}>
|
|
58
38
|
<Scroll barHideStrategy='never' overflow={{ x: 'hidden' }} onScroll={handleScroll}>
|
|
59
39
|
{children}
|
|
60
40
|
</Scroll>
|
|
61
|
-
<div
|
|
41
|
+
<div
|
|
42
|
+
className={styles.panel}
|
|
43
|
+
ref={element => {
|
|
44
|
+
if (element) {
|
|
45
|
+
setPanelHeight(element.offsetHeight);
|
|
46
|
+
panelRef.current = element;
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
style={{ top: positions.panelTopShift }}
|
|
50
|
+
>
|
|
62
51
|
{panel}
|
|
63
52
|
</div>
|
|
64
53
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Avatar } from '@cloud-ru/ds-avatar';
|
|
2
|
-
import { BaseItemProps, Droplist, DroplistProps
|
|
2
|
+
import { BaseItemProps, Droplist, DroplistProps } from '@cloud-ru/ds-list';
|
|
3
3
|
import { useValueControl } from '@cloud-ru/ds-utils';
|
|
4
4
|
import cn from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { TEST_IDS } from '../../constants';
|
|
7
|
+
import { BOTTOM_SHEET_FULLSCREEN_SNAP_POINTS, TEST_IDS } from '../../constants';
|
|
8
8
|
import { useDesktopComfortClassName } from '../../hooks/useDesktopComfortClassName';
|
|
9
9
|
import { useMobileLayout } from '../../hooks/useMobileLayout';
|
|
10
10
|
import { headerLocale } from '../../locale';
|
|
@@ -77,10 +77,6 @@ export function UserMenu({
|
|
|
77
77
|
|
|
78
78
|
const { fullName = '', inviteCount } = profile;
|
|
79
79
|
|
|
80
|
-
const handleClose = useCallback(() => {
|
|
81
|
-
setOpen(false);
|
|
82
|
-
}, [setOpen]);
|
|
83
|
-
|
|
84
80
|
const {
|
|
85
81
|
pinTop,
|
|
86
82
|
items: menuItems,
|
|
@@ -93,7 +89,9 @@ export function UserMenu({
|
|
|
93
89
|
organizationItems,
|
|
94
90
|
bottomItems,
|
|
95
91
|
settingItems,
|
|
96
|
-
onClose:
|
|
92
|
+
onClose: () => {
|
|
93
|
+
setOpen(false);
|
|
94
|
+
},
|
|
97
95
|
onLogout,
|
|
98
96
|
});
|
|
99
97
|
|
|
@@ -138,9 +136,7 @@ export function UserMenu({
|
|
|
138
136
|
closeOnPopstate
|
|
139
137
|
data-test-id={TEST_IDS.userMenu.root}
|
|
140
138
|
label={t('user')}
|
|
141
|
-
snapPoints={
|
|
142
|
-
withDividers={false}
|
|
143
|
-
triggerClassName={styles.userMenuDroplistTrigger}
|
|
139
|
+
snapPoints={BOTTOM_SHEET_FULLSCREEN_SNAP_POINTS}
|
|
144
140
|
>
|
|
145
141
|
{trigger}
|
|
146
142
|
</Droplist>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { ExitSVG } from '@cloud-ru/ds-icons/interface/product';
|
|
2
|
-
import {
|
|
2
|
+
import { ListProps } from '@cloud-ru/ds-list';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
import { headerLocale } from '../../../locale';
|
|
6
|
-
import styles from '../styles.module.scss';
|
|
7
6
|
|
|
8
|
-
export function useLogoutItem({ onLogout }: { onLogout?(): void }):
|
|
7
|
+
export function useLogoutItem({ onLogout }: { onLogout?(): void }): ListProps['items'] {
|
|
9
8
|
const { t } = headerLocale.useTranslations();
|
|
10
9
|
|
|
11
|
-
return useMemo<
|
|
12
|
-
() =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
return useMemo<ListProps['items']>(
|
|
11
|
+
() => [
|
|
12
|
+
{
|
|
13
|
+
beforeContent: <ExitSVG />,
|
|
14
|
+
content: {
|
|
15
|
+
label: t('logout'),
|
|
16
|
+
},
|
|
17
|
+
onClick: onLogout,
|
|
18
|
+
'data-test-id': 'header__user-menu__logout',
|
|
16
19
|
},
|
|
17
|
-
|
|
18
|
-
onClick: onLogout,
|
|
19
|
-
'data-test-id': 'header__user-menu__logout',
|
|
20
|
-
}),
|
|
20
|
+
],
|
|
21
21
|
[onLogout, t],
|
|
22
22
|
);
|
|
23
23
|
}
|
|
@@ -79,12 +79,12 @@ export function useUserMenuItems({
|
|
|
79
79
|
|
|
80
80
|
let pinBottom = bottomItems.concat(logoutItem);
|
|
81
81
|
|
|
82
|
+
if (isMobile && Boolean(settingItems?.length)) {
|
|
83
|
+
pinBottom = pinBottom.concat([DIVIDER_ITEM, ...settingItems]);
|
|
84
|
+
}
|
|
85
|
+
|
|
82
86
|
// В шторке прокручивается всё меню, закреплять части незачем; разделитель над организациями добавляем сами
|
|
83
87
|
if (isMobile) {
|
|
84
|
-
if (settingItems?.length) {
|
|
85
|
-
pinBottom = [...bottomItems, ...settingItems, DIVIDER_ITEM, logoutItem];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
88
|
return {
|
|
89
89
|
pinTop: [],
|
|
90
90
|
items: withClose([...pinTop, DIVIDER_ITEM, ...organizationItems, ...pinBottom]),
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
2
|
|
|
3
|
-
.userMenuDroplistTrigger {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.userMenuDroplist {
|
|
8
4
|
width: 256px; // нет токена ширины дропдауна
|
|
9
5
|
}
|
|
@@ -12,10 +8,3 @@
|
|
|
12
8
|
.profileSettingsIcon {
|
|
13
9
|
color: base.$sn-theme-color-neutral-text;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
.logoutItem {
|
|
17
|
-
span,
|
|
18
|
-
svg {
|
|
19
|
-
color: base.$sn-theme-color-red-text;
|
|
20
|
-
}
|
|
21
|
-
}
|