@cloud-ru/ds-uikit-product-header 2.1.1 → 2.1.3-preview-97040951.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/CHANGELOG.md +9 -0
- package/README.md +6 -6
- package/dist/cjs/components/HeaderLayout/styles.module.css +1 -0
- package/dist/cjs/components/MainMenu/helperComponents/Banners/MenuBanner.js +3 -1
- package/dist/cjs/components/MainMenu/helperComponents/Banners/styles.module.css +10 -0
- package/dist/cjs/components/MainMenu/helperComponents/Content/Content.js +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupDragHandle.d.ts +1 -8
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupDragHandle.js +2 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.d.ts +6 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.js +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +13 -10
- package/dist/cjs/components/MainMenu/helperComponents/Content/styles.module.css +15 -0
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/constants.js +1 -1
- package/dist/cjs/components/MainMenu/hooks/useMainMenuDnd.js +12 -0
- package/dist/cjs/components/MainMenu/styles.module.css +8 -0
- package/dist/cjs/components/UserMenu/UserMenu.d.ts +5 -1
- package/dist/cjs/components/UserMenu/hooks/useUserMenuItems.js +4 -0
- package/dist/cjs/style.css +47 -10
- package/dist/esm/components/HeaderLayout/styles.module.css +1 -0
- package/dist/esm/components/MainMenu/helperComponents/Banners/MenuBanner.js +3 -1
- package/dist/esm/components/MainMenu/helperComponents/Banners/styles.module.css +10 -0
- package/dist/esm/components/MainMenu/helperComponents/Content/Content.js +1 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupDragHandle.d.ts +1 -8
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupDragHandle.js +2 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.d.ts +6 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.js +1 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +13 -10
- package/dist/esm/components/MainMenu/helperComponents/Content/styles.module.css +15 -0
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/constants.js +1 -1
- package/dist/esm/components/MainMenu/hooks/useMainMenuDnd.js +10 -1
- package/dist/esm/components/MainMenu/styles.module.css +8 -0
- package/dist/esm/components/UserMenu/UserMenu.d.ts +5 -1
- package/dist/esm/components/UserMenu/hooks/useUserMenuItems.js +4 -0
- package/dist/esm/style.css +47 -10
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +28 -28
- package/src/components/HeaderLayout/styles.module.scss +1 -0
- package/src/components/MainMenu/helperComponents/Banners/MenuBanner.tsx +4 -1
- package/src/components/MainMenu/helperComponents/Banners/styles.module.scss +16 -0
- package/src/components/MainMenu/helperComponents/Content/Content.tsx +3 -1
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupDragHandle.tsx +1 -11
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.tsx +9 -4
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.scss +27 -19
- package/src/components/MainMenu/helperComponents/Content/styles.module.scss +22 -0
- package/src/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.tsx +1 -1
- package/src/components/MainMenu/helperComponents/MenuDesktop/constants.ts +1 -1
- package/src/components/MainMenu/helperComponents/MenuDesktop/styles.module.scss +6 -2
- package/src/components/MainMenu/hooks/useMainMenuDnd.tsx +12 -1
- package/src/components/MainMenu/styles.module.scss +10 -0
- package/src/components/UserMenu/UserMenu.tsx +5 -1
- package/src/components/UserMenu/hooks/useUserMenuItems.ts +5 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
outline:none;
|
|
9
9
|
}
|
|
10
10
|
.headerActions[data-always-visible]{
|
|
11
|
+
pointer-events:auto;
|
|
11
12
|
opacity:1;
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -63,20 +64,25 @@
|
|
|
63
64
|
animation:none;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
.group[data-drag-preview]{
|
|
67
|
-
cursor:grabbing;
|
|
68
|
-
}
|
|
69
67
|
.group[data-drag-preview] .header{
|
|
70
|
-
cursor:grabbing;
|
|
71
68
|
background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(136, 146, 170, 0.0784313725)));
|
|
72
69
|
}
|
|
73
70
|
.group[data-drag-preview] .header .headerActions{
|
|
74
71
|
pointer-events:auto;
|
|
75
72
|
opacity:1;
|
|
76
73
|
}
|
|
74
|
+
.group:has(:focus-visible) .headerActions{
|
|
75
|
+
pointer-events:auto;
|
|
76
|
+
opacity:1;
|
|
77
|
+
}
|
|
78
|
+
@media (hover: hover){
|
|
79
|
+
.group:hover .headerActions{
|
|
80
|
+
pointer-events:auto;
|
|
81
|
+
opacity:1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
77
84
|
|
|
78
85
|
.groupDragPreview{
|
|
79
|
-
cursor:grabbing;
|
|
80
86
|
container-type:inline-size;
|
|
81
87
|
border-radius:var(--sn-density-radius-2xs, var(--sn-platform-comfort-radius-2xs, var(--sn-primitive-dimension-4, 4px)));
|
|
82
88
|
}
|
|
@@ -119,7 +125,6 @@
|
|
|
119
125
|
|
|
120
126
|
.groupBody{
|
|
121
127
|
display:grid;
|
|
122
|
-
grid-template-columns:repeat(3, minmax(auto, 1fr));
|
|
123
128
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
124
129
|
}
|
|
125
130
|
.groupBody:not([data-subcategory-body]){
|
|
@@ -128,10 +133,8 @@
|
|
|
128
133
|
.groupBody:not([data-show-description]){
|
|
129
134
|
gap:0;
|
|
130
135
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
grid-template-columns:repeat(2, minmax(auto, 1fr));
|
|
134
|
-
}
|
|
136
|
+
.groupBody:not([data-mobile]){
|
|
137
|
+
grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
|
|
135
138
|
}
|
|
136
139
|
.groupBody[data-mobile]{
|
|
137
140
|
grid-template-columns:repeat(1, minmax(200px, 1fr));
|
|
@@ -21,6 +21,21 @@
|
|
|
21
21
|
gap:inherit;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
.rightTop{
|
|
25
|
+
width:100%;
|
|
26
|
+
min-width:0;
|
|
27
|
+
}
|
|
28
|
+
.rightTop:not([data-mobile]){
|
|
29
|
+
display:grid;
|
|
30
|
+
grid-template-columns:repeat(auto-fit, minmax(max(286px, (100% - var(--sn-primitive-dimension-4, 4px)) / 2), 1fr));
|
|
31
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
32
|
+
}
|
|
33
|
+
.rightTop[data-mobile]{
|
|
34
|
+
display:flex;
|
|
35
|
+
flex-direction:column;
|
|
36
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
37
|
+
}
|
|
38
|
+
|
|
24
39
|
.noData{
|
|
25
40
|
flex:1 1 auto;
|
|
26
41
|
place-self:center center;
|
|
@@ -54,7 +54,7 @@ export function MenuDesktop({ open = false, setOpen, settingItems, platformGroup
|
|
|
54
54
|
return (_jsx(DrawerCustom, { open: open, onClose: handleCloseDrawer, width: isNeedRightBlock ? 'm' : 's', position: 'left', className: styles.drawer, rootClassName: styles.drawerRoot, "data-test-id": TEST_IDS.mainMenu.drawer, "data-small": !isNeedRightBlock || undefined, disableMotions: true, showButtonClosed: false, resizable: isNeedRightBlock
|
|
55
55
|
? {
|
|
56
56
|
min: MENU_WIDTH_MIN,
|
|
57
|
-
max:
|
|
57
|
+
max: 'full',
|
|
58
58
|
default: Math.min(Math.max(defaultWidth, MENU_WIDTH_MIN), MENU_WIDTH_MAX),
|
|
59
59
|
onResizeEnd: onWidthChangeEnd,
|
|
60
60
|
draggerTooltip,
|
|
@@ -3,9 +3,10 @@ import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, useSensor, useS
|
|
|
3
3
|
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
4
4
|
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
|
|
5
5
|
import { usePortalContext } from '@cloud-ru/ds-portal-context';
|
|
6
|
-
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
6
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { ServiceCard } from '../helperComponents/ServiceCard/index.js';
|
|
9
|
+
import styles from '../styles.module.css';
|
|
9
10
|
import { favoriteListCollisionDetection, getDragReferenceY, isServiceDragId, isServiceSourceDragId, parseServiceDragId, resolveFavoriteOrderOnDragEnd, } from '../utils/index.js';
|
|
10
11
|
const restrictGroupDragToVerticalAxis = args => {
|
|
11
12
|
if (args.active?.id != null && isServiceSourceDragId(args.active.id)) {
|
|
@@ -82,6 +83,14 @@ export function useMainMenuDnd({ favorite, servicesById, showDescription }) {
|
|
|
82
83
|
}
|
|
83
84
|
export function MainMenuDndContext({ children, sensors, modifiers, collisionDetection, onDragStart, onDragEnd, onDragCancel, dragOverlay, overlayContextValue, }) {
|
|
84
85
|
const portalContextRef = usePortalContext();
|
|
86
|
+
const isDragging = Boolean(dragOverlay);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!isDragging)
|
|
89
|
+
return;
|
|
90
|
+
/* Для предотвращения случайных взаимодействий с любыми другими элементами при перетаскивании */
|
|
91
|
+
document.body.classList.add(styles.dragging);
|
|
92
|
+
return () => document.body.classList.remove(styles.dragging);
|
|
93
|
+
}, [isDragging]);
|
|
85
94
|
// `DragOverlay` рендерит `position: fixed` без собственного портала. Drawer-обёртка
|
|
86
95
|
// (`.snack-rc-drawer-content-wrapper`) держит `will-change: transform`, а это, как и
|
|
87
96
|
// настоящий transform, создаёт containing block для fixed-потомков — оверлей резолвится
|
|
@@ -7,7 +7,11 @@ export type UserMenuProps = {
|
|
|
7
7
|
theme?: ThemeProps;
|
|
8
8
|
/** Пункты после темы. На desktop закреплены сверху вместе с профилем и темой */
|
|
9
9
|
topItems?: DroplistProps['items'];
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Список организаций. На desktop — единственная прокручиваемая часть меню.
|
|
12
|
+
*
|
|
13
|
+
* Не передан или пуст — меню отображается единым списком без закреплённых частей.
|
|
14
|
+
*/
|
|
11
15
|
organizationItems?: DroplistProps['items'];
|
|
12
16
|
/** Пункты перед «Выйти из аккаунта». На desktop закреплены снизу */
|
|
13
17
|
bottomItems?: DroplistProps['items'];
|
|
@@ -46,6 +46,10 @@ export function useUserMenuItems({ profile, theme, onLogout, topItems = EMPTY_AR
|
|
|
46
46
|
pinBottom: [],
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
+
// Без организаций прокручивать нечего: пустой `items` показал бы заглушку «Нет данных»
|
|
50
|
+
if (!organizationItems.length) {
|
|
51
|
+
return { pinTop: [], items: withClose([...pinTop, DIVIDER_ITEM, ...pinBottom]), pinBottom: [] };
|
|
52
|
+
}
|
|
49
53
|
return { pinTop: withClose(pinTop), items: withClose(organizationItems), pinBottom: withClose(pinBottom) };
|
|
50
54
|
}, [bottomItems, isMobile, logoutItem, onClose, organizationItems, profileItem, settingItems, themeItem, topItems]);
|
|
51
55
|
}
|
package/dist/esm/style.css
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.breadcrums{
|
|
14
|
+
min-width:0;
|
|
14
15
|
padding:0 var(--sn-primitive-dimension-8, 8px);
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -116,6 +117,16 @@
|
|
|
116
117
|
.root:hover .closeButton, .root:focus-visible .closeButton, .root:has(*:focus-visible) .closeButton{
|
|
117
118
|
visibility:visible;
|
|
118
119
|
}
|
|
120
|
+
.root[data-mobile] .closeButton{
|
|
121
|
+
position:relative;
|
|
122
|
+
top:auto;
|
|
123
|
+
right:auto;
|
|
124
|
+
flex-shrink:0;
|
|
125
|
+
visibility:visible;
|
|
126
|
+
}
|
|
127
|
+
.root[data-mobile] .contentRow[data-closable]{
|
|
128
|
+
padding-right:var(--sn-primitive-dimension-4, 4px);
|
|
129
|
+
}
|
|
119
130
|
|
|
120
131
|
.contentRow{
|
|
121
132
|
position:relative;
|
|
@@ -289,6 +300,7 @@
|
|
|
289
300
|
outline:none;
|
|
290
301
|
}
|
|
291
302
|
.headerActions[data-always-visible]{
|
|
303
|
+
pointer-events:auto;
|
|
292
304
|
opacity:1;
|
|
293
305
|
}
|
|
294
306
|
|
|
@@ -344,20 +356,25 @@
|
|
|
344
356
|
animation:none;
|
|
345
357
|
}
|
|
346
358
|
}
|
|
347
|
-
.group[data-drag-preview]{
|
|
348
|
-
cursor:grabbing;
|
|
349
|
-
}
|
|
350
359
|
.group[data-drag-preview] .header{
|
|
351
|
-
cursor:grabbing;
|
|
352
360
|
background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(136, 146, 170, 0.0784313725)));
|
|
353
361
|
}
|
|
354
362
|
.group[data-drag-preview] .header .headerActions{
|
|
355
363
|
pointer-events:auto;
|
|
356
364
|
opacity:1;
|
|
357
365
|
}
|
|
366
|
+
.group:has(:focus-visible) .headerActions{
|
|
367
|
+
pointer-events:auto;
|
|
368
|
+
opacity:1;
|
|
369
|
+
}
|
|
370
|
+
@media (hover: hover){
|
|
371
|
+
.group:hover .headerActions{
|
|
372
|
+
pointer-events:auto;
|
|
373
|
+
opacity:1;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
358
376
|
|
|
359
377
|
.groupDragPreview{
|
|
360
|
-
cursor:grabbing;
|
|
361
378
|
container-type:inline-size;
|
|
362
379
|
border-radius:var(--sn-density-radius-2xs, var(--sn-platform-comfort-radius-2xs, var(--sn-primitive-dimension-4, 4px)));
|
|
363
380
|
}
|
|
@@ -400,7 +417,6 @@
|
|
|
400
417
|
|
|
401
418
|
.groupBody{
|
|
402
419
|
display:grid;
|
|
403
|
-
grid-template-columns:repeat(3, minmax(auto, 1fr));
|
|
404
420
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
405
421
|
}
|
|
406
422
|
.groupBody:not([data-subcategory-body]){
|
|
@@ -409,10 +425,8 @@
|
|
|
409
425
|
.groupBody:not([data-show-description]){
|
|
410
426
|
gap:0;
|
|
411
427
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
grid-template-columns:repeat(2, minmax(auto, 1fr));
|
|
415
|
-
}
|
|
428
|
+
.groupBody:not([data-mobile]){
|
|
429
|
+
grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
|
|
416
430
|
}
|
|
417
431
|
.groupBody[data-mobile]{
|
|
418
432
|
grid-template-columns:repeat(1, minmax(200px, 1fr));
|
|
@@ -564,6 +578,21 @@
|
|
|
564
578
|
gap:inherit;
|
|
565
579
|
}
|
|
566
580
|
|
|
581
|
+
.rightTop{
|
|
582
|
+
width:100%;
|
|
583
|
+
min-width:0;
|
|
584
|
+
}
|
|
585
|
+
.rightTop:not([data-mobile]){
|
|
586
|
+
display:grid;
|
|
587
|
+
grid-template-columns:repeat(auto-fit, minmax(max(286px, (100% - var(--sn-primitive-dimension-4, 4px)) / 2), 1fr));
|
|
588
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
589
|
+
}
|
|
590
|
+
.rightTop[data-mobile]{
|
|
591
|
+
display:flex;
|
|
592
|
+
flex-direction:column;
|
|
593
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
594
|
+
}
|
|
595
|
+
|
|
567
596
|
.noData{
|
|
568
597
|
flex:1 1 auto;
|
|
569
598
|
place-self:center center;
|
|
@@ -928,6 +957,14 @@
|
|
|
928
957
|
.staticCard{
|
|
929
958
|
position:relative;
|
|
930
959
|
}
|
|
960
|
+
.dragging,
|
|
961
|
+
.dragging *{
|
|
962
|
+
cursor:grabbing !important;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.dragging *{
|
|
966
|
+
pointer-events:none !important;
|
|
967
|
+
}
|
|
931
968
|
.container{
|
|
932
969
|
display:flex;
|
|
933
970
|
align-items:center;
|