@cloud-ru/ds-uikit-product-header 1.5.0 → 1.5.1-preview-a2208aeb.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/dist/cjs/components/HeaderLayout/HeaderLayout.js +12 -1
- package/dist/cjs/components/HeaderLayout/styles.module.css +1 -1
- package/dist/cjs/components/Logo/Logo.js +3 -3
- package/dist/cjs/components/Logo/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/ContentToolbar/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SubCategory/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +13 -13
- package/dist/cjs/components/MainMenu/helperComponents/Favorites/components/EmptyState/styles.module.css +2 -2
- package/dist/cjs/components/MainMenu/helperComponents/Favorites/styles.module.css +5 -5
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +3 -3
- package/dist/cjs/components/MainMenu/helperComponents/MenuHeaderBrand/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +6 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/styles.module.css +5 -1
- package/dist/cjs/components/MainMenu/helperComponents/ServiceCard/styles.module.css +1 -1
- package/dist/cjs/components/PlatformLogo/styles.module.css +2 -2
- package/dist/cjs/style.css +37 -33
- package/dist/esm/components/HeaderLayout/HeaderLayout.js +12 -1
- package/dist/esm/components/HeaderLayout/styles.module.css +1 -1
- package/dist/esm/components/Logo/Logo.js +3 -3
- package/dist/esm/components/Logo/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/ContentToolbar/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SubCategory/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +13 -13
- package/dist/esm/components/MainMenu/helperComponents/Favorites/components/EmptyState/styles.module.css +2 -2
- package/dist/esm/components/MainMenu/helperComponents/Favorites/styles.module.css +5 -5
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +3 -3
- package/dist/esm/components/MainMenu/helperComponents/MenuHeaderBrand/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +6 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/styles.module.css +5 -1
- package/dist/esm/components/MainMenu/helperComponents/ServiceCard/styles.module.css +1 -1
- package/dist/esm/components/PlatformLogo/styles.module.css +2 -2
- package/dist/esm/style.css +37 -33
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +28 -28
- package/src/components/HeaderLayout/HeaderLayout.tsx +19 -2
- package/src/components/Logo/Logo.tsx +4 -4
- package/src/components/MainMenu/helperComponents/MenuMobile/MenuMobile.tsx +52 -46
- package/src/components/MainMenu/helperComponents/MenuMobile/styles.module.scss +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-uikit-product-header",
|
|
3
|
-
"version": "1.5.0",
|
|
3
|
+
"version": "1.5.1-preview-a2208aeb.0",
|
|
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-
|
|
49
|
-
"@cloud-ru/ds-
|
|
50
|
-
"@cloud-ru/ds-avatar": "
|
|
51
|
-
"@cloud-ru/ds-breadcrumbs": "
|
|
52
|
-
"@cloud-ru/ds-
|
|
53
|
-
"@cloud-ru/ds-
|
|
54
|
-
"@cloud-ru/ds-
|
|
55
|
-
"@cloud-ru/ds-
|
|
56
|
-
"@cloud-ru/ds-
|
|
57
|
-
"@cloud-ru/ds-icons": "
|
|
58
|
-
"@cloud-ru/ds-
|
|
59
|
-
"@cloud-ru/ds-
|
|
60
|
-
"@cloud-ru/ds-
|
|
61
|
-
"@cloud-ru/ds-
|
|
62
|
-
"@cloud-ru/ds-promo-tag": "
|
|
63
|
-
"@cloud-ru/ds-
|
|
64
|
-
"@cloud-ru/ds-scroll": "
|
|
65
|
-
"@cloud-ru/ds-search": "
|
|
66
|
-
"@cloud-ru/ds-segment-control": "
|
|
67
|
-
"@cloud-ru/ds-skeleton": "
|
|
68
|
-
"@cloud-ru/ds-
|
|
69
|
-
"@cloud-ru/ds-
|
|
70
|
-
"@cloud-ru/ds-typography": "
|
|
71
|
-
"@cloud-ru/ds-uikit-product-
|
|
72
|
-
"@cloud-ru/ds-uikit-product-
|
|
73
|
-
"@cloud-ru/ds-uikit-product-title-clickable": "
|
|
74
|
-
"@cloud-ru/ds-utils": "
|
|
48
|
+
"@cloud-ru/ds-accordion": "1.0.8-preview-a2208aeb.0",
|
|
49
|
+
"@cloud-ru/ds-button": "1.0.3-preview-a2208aeb.0",
|
|
50
|
+
"@cloud-ru/ds-avatar": "1.0.5-preview-a2208aeb.0",
|
|
51
|
+
"@cloud-ru/ds-breadcrumbs": "1.0.18-preview-a2208aeb.0",
|
|
52
|
+
"@cloud-ru/ds-card": "1.0.14-preview-a2208aeb.0",
|
|
53
|
+
"@cloud-ru/ds-adaptive": "1.0.1",
|
|
54
|
+
"@cloud-ru/ds-divider": "1.0.1",
|
|
55
|
+
"@cloud-ru/ds-drag-and-drop": "1.1.2-preview-a2208aeb.0",
|
|
56
|
+
"@cloud-ru/ds-drawer": "1.2.2-preview-a2208aeb.0",
|
|
57
|
+
"@cloud-ru/ds-icons": "1.2.1-preview-a2208aeb.0",
|
|
58
|
+
"@cloud-ru/ds-list": "2.2.1-preview-a2208aeb.0",
|
|
59
|
+
"@cloud-ru/ds-locale": "1.0.0",
|
|
60
|
+
"@cloud-ru/ds-info-block": "1.0.2-preview-a2208aeb.0",
|
|
61
|
+
"@cloud-ru/ds-modal": "1.1.3-preview-a2208aeb.0",
|
|
62
|
+
"@cloud-ru/ds-promo-tag": "1.0.2-preview-a2208aeb.0",
|
|
63
|
+
"@cloud-ru/ds-portal-context": "1.0.1",
|
|
64
|
+
"@cloud-ru/ds-scroll": "1.0.3-preview-a2208aeb.0",
|
|
65
|
+
"@cloud-ru/ds-search": "1.0.9-preview-a2208aeb.0",
|
|
66
|
+
"@cloud-ru/ds-segment-control": "1.0.7-preview-a2208aeb.0",
|
|
67
|
+
"@cloud-ru/ds-skeleton": "1.0.1",
|
|
68
|
+
"@cloud-ru/ds-theme": "1.1.1-preview-a2208aeb.0",
|
|
69
|
+
"@cloud-ru/ds-tooltip": "1.0.6-preview-a2208aeb.0",
|
|
70
|
+
"@cloud-ru/ds-typography": "1.0.0",
|
|
71
|
+
"@cloud-ru/ds-uikit-product-card-predefined": "3.1.4-preview-a2208aeb.0",
|
|
72
|
+
"@cloud-ru/ds-uikit-product-switch-row": "1.0.8-preview-a2208aeb.0",
|
|
73
|
+
"@cloud-ru/ds-uikit-product-title-clickable": "1.0.10-preview-a2208aeb.0",
|
|
74
|
+
"@cloud-ru/ds-utils": "1.1.0"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Divider } from '@cloud-ru/ds-divider';
|
|
2
|
+
import { ChildThemeProvider, DENSITY } from '@cloud-ru/ds-theme';
|
|
2
3
|
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
4
|
import cn from 'classnames';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
|
+
import { ReactNode, useRef } from 'react';
|
|
5
6
|
|
|
6
7
|
import { TEST_IDS } from '../../constants';
|
|
7
8
|
import { useMobileLayout } from '../../hooks/useMobileLayout';
|
|
@@ -18,9 +19,11 @@ export type HeaderLayoutProps = WithSupportProps<{
|
|
|
18
19
|
|
|
19
20
|
export function HeaderLayout({ menu, logo, select, breadcrumbs, toolbar, className, ...rest }: HeaderLayoutProps) {
|
|
20
21
|
const isMobile = useMobileLayout();
|
|
22
|
+
const headerRef = useRef<HTMLElement>(null);
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
const header = (
|
|
23
25
|
<header
|
|
26
|
+
ref={headerRef}
|
|
24
27
|
className={cn(styles.header, className)}
|
|
25
28
|
{...extractSupportProps({ 'data-test-id': TEST_IDS.headerLayout.root, ...rest })}
|
|
26
29
|
>
|
|
@@ -57,4 +60,18 @@ export function HeaderLayout({ menu, logo, select, breadcrumbs, toolbar, classNa
|
|
|
57
60
|
{isMobile && Boolean(breadcrumbs) && <div className={styles.bottom}>{breadcrumbs}</div>}
|
|
58
61
|
</header>
|
|
59
62
|
);
|
|
63
|
+
|
|
64
|
+
// Временная фиксация: на mobile прикладная тема переключилась на compact, а шапка сверстана
|
|
65
|
+
// под comfort и на compact ещё не переехала. Провайдер (а не класс на `<header>`) нужен потому,
|
|
66
|
+
// что поверхности шапки — порталы: они переэмитят набор `sn-*` из контекста на своём корне,
|
|
67
|
+
// и класс, поставленный поверх, проиграл бы их собственному.
|
|
68
|
+
if (isMobile) {
|
|
69
|
+
return (
|
|
70
|
+
<ChildThemeProvider value={{ density: DENSITY.Comfort }} rootRef={headerRef}>
|
|
71
|
+
{header}
|
|
72
|
+
</ChildThemeProvider>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return header;
|
|
60
77
|
}
|
|
@@ -23,7 +23,7 @@ export type LogoProps = WithSupportProps<{
|
|
|
23
23
|
|
|
24
24
|
export function Logo({ path, loading, mode, href, onClick, className, tooltip, ...rest }: LogoProps) {
|
|
25
25
|
const [error, setError] = useState<boolean>(false);
|
|
26
|
-
const
|
|
26
|
+
const logoThemeClassName = useThemeClassnames({ brand: 'hrGreen' });
|
|
27
27
|
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
setError(false);
|
|
@@ -49,8 +49,8 @@ export function Logo({ path, loading, mode, href, onClick, className, tooltip, .
|
|
|
49
49
|
return (
|
|
50
50
|
<span className={styles.logoWrap}>
|
|
51
51
|
<span className={styles.iconStack}>
|
|
52
|
-
<CloudLogo size={24} className={cn(styles.icon,
|
|
53
|
-
<HomeFilledSVG size={24} className={cn(styles.icon,
|
|
52
|
+
<CloudLogo size={24} className={cn(styles.icon, logoThemeClassName, styles.iconDefault)} />
|
|
53
|
+
<HomeFilledSVG size={24} className={cn(styles.icon, logoThemeClassName, styles.iconHover)} />
|
|
54
54
|
</span>
|
|
55
55
|
|
|
56
56
|
{mode && mode !== HEADER_LOGO_MODE.Prod && (
|
|
@@ -58,7 +58,7 @@ export function Logo({ path, loading, mode, href, onClick, className, tooltip, .
|
|
|
58
58
|
)}
|
|
59
59
|
</span>
|
|
60
60
|
);
|
|
61
|
-
}, [error, mode, path,
|
|
61
|
+
}, [error, mode, path, logoThemeClassName]);
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
64
|
<HeaderButton
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Divider } from '@cloud-ru/ds-divider';
|
|
2
|
+
import { ChildThemeProvider, DENSITY } from '@cloud-ru/ds-theme';
|
|
2
3
|
import { useValueControl } from '@cloud-ru/ds-utils';
|
|
3
4
|
import { useCallback, useMemo } from 'react';
|
|
4
5
|
|
|
@@ -61,54 +62,59 @@ export function MenuMobile({
|
|
|
61
62
|
}, [setOpen]);
|
|
62
63
|
|
|
63
64
|
return (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<MenuHeaderBrand logo={logo} onClose={handleClose} className={styles.menuHeader} />
|
|
79
|
-
<Divider orientation='horizontal' />
|
|
80
|
-
</>
|
|
81
|
-
}
|
|
65
|
+
// Временная фиксация comfort (см. `HeaderLayout`): `MainMenu` используется и отдельно от
|
|
66
|
+
// `HeaderLayout`, поэтому объявляем плотность здесь же. Обёртка провайдера layout-прозрачная
|
|
67
|
+
// (`display: contents`) — меню рендерится порталом, лишний бокс в строке шапки не нужен.
|
|
68
|
+
<ChildThemeProvider value={{ density: DENSITY.Comfort }} className={styles.densityScope}>
|
|
69
|
+
<MobileDrawerCustom
|
|
70
|
+
open={open}
|
|
71
|
+
onClose={handleClose}
|
|
72
|
+
position='bottom'
|
|
73
|
+
className={styles.drawerMobile}
|
|
74
|
+
swipeEnabled={false}
|
|
75
|
+
data-test-id={TEST_IDS.mainMenu.drawerMobile}
|
|
76
|
+
closeOnPopstate
|
|
77
|
+
snapPoints={BOTTOM_SHEET_FULLSCREEN_SNAP_POINTS}
|
|
78
|
+
disableMotions={true}
|
|
82
79
|
>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
<ScrollWithAnimatedStickyPanel
|
|
81
|
+
panel={
|
|
82
|
+
<>
|
|
83
|
+
<MenuHeaderBrand logo={logo} onClose={handleClose} className={styles.menuHeader} />
|
|
84
|
+
<Divider orientation='horizontal' />
|
|
85
|
+
</>
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
<MountAnimation className={styles.scrollMobile} type='fade-slide-up'>
|
|
89
|
+
{leftTop && <div className={styles.rightContent}>{leftTop}</div>}
|
|
90
|
+
{search && <Search {...search} ref={searchRef} isMobile />}
|
|
91
|
+
{!isSearching && favorite && <Favorites favorite={favorite} allServiceGroups={allServiceGroups} isMobile />}
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
{hasSegments && (
|
|
94
|
+
<MainMenuDndContext>
|
|
95
|
+
<Content
|
|
96
|
+
isMobile
|
|
97
|
+
className={styles.rightContent}
|
|
98
|
+
searchValue={search && search.value}
|
|
99
|
+
rightTop={rightTop}
|
|
100
|
+
favorite={favorite}
|
|
101
|
+
segments={segments}
|
|
102
|
+
searchGroups={resultItems}
|
|
103
|
+
segmentPrefs={segmentPrefs}
|
|
104
|
+
activeSegmentId={activeSegmentId}
|
|
105
|
+
onActiveSegmentChange={onActiveSegmentChange}
|
|
106
|
+
onSegmentOrderChange={onSegmentOrderChange}
|
|
107
|
+
onSegmentExpandedChange={onSegmentExpandedChange}
|
|
108
|
+
onSegmentServiceClick={onSegmentServiceClick}
|
|
109
|
+
loading={loading}
|
|
110
|
+
/>
|
|
111
|
+
</MainMenuDndContext>
|
|
112
|
+
)}
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
{!isSearching && hasBottomItems && <MenuBottom settingItems={settingItems} leftBottom={leftBottom} />}
|
|
115
|
+
</MountAnimation>
|
|
116
|
+
</ScrollWithAnimatedStickyPanel>
|
|
117
|
+
</MobileDrawerCustom>
|
|
118
|
+
</ChildThemeProvider>
|
|
113
119
|
);
|
|
114
120
|
}
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
$menuHeaderHeight: base.$sn-primitive-dimension-40;
|
|
5
5
|
$menuHeaderHeightWithDivider: calc(#{$menuHeaderHeight} + #{divider.$sn-divider-anatomy-container-height});
|
|
6
6
|
|
|
7
|
+
// Обёртка провайдера плотности вокруг портала меню: собственного бокса у неё быть не должно,
|
|
8
|
+
// иначе в строке шапки появляется лишний flex-элемент и лишний gap.
|
|
9
|
+
.densityScope {
|
|
10
|
+
display: contents;
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
.menuHeader {
|
|
8
14
|
height: $menuHeaderHeight;
|
|
9
15
|
padding: 0 base.$sn-primitive-dimension-4;
|