@cloud-ru/ds-uikit-product-header 2.1.1 → 2.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-uikit-product-header",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
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.2.0",
49
- "@cloud-ru/ds-breadcrumbs": "^1.0.27",
50
48
  "@cloud-ru/ds-adaptive": "^1.0.2",
51
- "@cloud-ru/ds-avatar": "^1.0.10",
49
+ "@cloud-ru/ds-avatar": "^1.0.11",
50
+ "@cloud-ru/ds-accordion": "^1.2.1",
51
+ "@cloud-ru/ds-breadcrumbs": "^1.0.28",
52
52
  "@cloud-ru/ds-button": "^1.0.4",
53
- "@cloud-ru/ds-card": "^1.0.21",
53
+ "@cloud-ru/ds-card": "^1.0.22",
54
54
  "@cloud-ru/ds-divider": "^1.0.2",
55
55
  "@cloud-ru/ds-drag-and-drop": "^1.1.3",
56
- "@cloud-ru/ds-drawer": "^1.2.8",
57
- "@cloud-ru/ds-icons": "^1.4.0",
58
- "@cloud-ru/ds-list": "^2.3.0",
56
+ "@cloud-ru/ds-drawer": "^2.0.0",
57
+ "@cloud-ru/ds-icons": "^1.5.0",
59
58
  "@cloud-ru/ds-info-block": "^1.0.3",
59
+ "@cloud-ru/ds-list": "^2.3.1",
60
60
  "@cloud-ru/ds-locale": "^1.0.0",
61
+ "@cloud-ru/ds-modal": "^2.0.0",
61
62
  "@cloud-ru/ds-portal-context": "^1.0.2",
62
- "@cloud-ru/ds-modal": "^1.1.9",
63
63
  "@cloud-ru/ds-promo-tag": "^1.0.3",
64
- "@cloud-ru/ds-segment-control": "^1.0.12",
64
+ "@cloud-ru/ds-scroll": "^1.0.5",
65
+ "@cloud-ru/ds-search": "^1.0.14",
66
+ "@cloud-ru/ds-segment-control": "^1.0.13",
65
67
  "@cloud-ru/ds-skeleton": "^1.0.2",
66
- "@cloud-ru/ds-tooltip": "^1.0.10",
67
- "@cloud-ru/ds-theme": "^2.0.0",
68
+ "@cloud-ru/ds-tooltip": "^1.0.11",
68
69
  "@cloud-ru/ds-typography": "^1.0.1",
69
- "@cloud-ru/ds-uikit-product-switch-row": "^1.0.13",
70
- "@cloud-ru/ds-uikit-product-card-predefined": "^4.0.7",
71
- "@cloud-ru/ds-uikit-product-title-clickable": "^1.0.15",
72
- "@cloud-ru/ds-utils": "^1.2.0",
73
- "@cloud-ru/ds-scroll": "^1.0.5",
74
- "@cloud-ru/ds-search": "^1.0.13"
70
+ "@cloud-ru/ds-theme": "^2.1.0",
71
+ "@cloud-ru/ds-uikit-product-card-predefined": "^4.0.8",
72
+ "@cloud-ru/ds-uikit-product-switch-row": "^1.0.14",
73
+ "@cloud-ru/ds-uikit-product-title-clickable": "^1.0.16",
74
+ "@cloud-ru/ds-utils": "^1.2.0"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
@@ -11,6 +11,7 @@
11
11
  }
12
12
 
13
13
  .breadcrums {
14
+ min-width: 0;
14
15
  padding: 0 base.$sn-primitive-dimension-8;
15
16
  }
16
17
 
@@ -7,6 +7,7 @@ import { WithSupportProps } from '@cloud-ru/ds-utils';
7
7
  import cn from 'classnames';
8
8
  import { AnchorHTMLAttributes, MouseEventHandler, ReactElement, ReactNode, useCallback } from 'react';
9
9
 
10
+ import { useMobileLayout } from '../../../../hooks/useMobileLayout';
10
11
  import { headerLocale } from '../../../../locale';
11
12
  import { MENU_BANNER_TEST_IDS } from './constants';
12
13
  import styles from './styles.module.scss';
@@ -37,6 +38,7 @@ export function MenuBanner({
37
38
  ...rest
38
39
  }: MenuBannerProps): ReactElement {
39
40
  const { t } = headerLocale.useTranslations();
41
+ const isMobile = useMobileLayout();
40
42
 
41
43
  const handleClose: MouseEventHandler<HTMLButtonElement> = useCallback(
42
44
  e => {
@@ -54,10 +56,11 @@ export function MenuBanner({
54
56
  radius='l'
55
57
  view='simple'
56
58
  className={cn(styles.root, className)}
59
+ data-mobile={isMobile || undefined}
57
60
  data-test-id={dataTestId ?? MENU_BANNER_TEST_IDS.root}
58
61
  {...rest}
59
62
  >
60
- <div className={styles.contentRow}>
63
+ <div className={styles.contentRow} data-closable={Boolean(onClose) || undefined}>
61
64
  <span className={styles.titleWrapper}>
62
65
  <Typography
63
66
  as='span'
@@ -24,6 +24,22 @@
24
24
  visibility: visible;
25
25
  }
26
26
  }
27
+
28
+ &[data-mobile] {
29
+ .closeButton {
30
+ position: relative;
31
+ top: auto;
32
+ right: auto;
33
+
34
+ flex-shrink: 0;
35
+
36
+ visibility: visible;
37
+ }
38
+
39
+ .contentRow[data-closable] {
40
+ padding-right: base.$sn-primitive-dimension-4;
41
+ }
42
+ }
27
43
  }
28
44
 
29
45
  .contentRow {
@@ -29,7 +29,11 @@ export type UserMenuProps = {
29
29
  /** Пункты после темы. На desktop закреплены сверху вместе с профилем и темой */
30
30
  topItems?: DroplistProps['items'];
31
31
 
32
- /** Список организаций. На desktop — единственная прокручиваемая часть меню */
32
+ /**
33
+ * Список организаций. На desktop — единственная прокручиваемая часть меню.
34
+ *
35
+ * Не передан или пуст — меню отображается единым списком без закреплённых частей.
36
+ */
33
37
  organizationItems?: DroplistProps['items'];
34
38
 
35
39
  /** Пункты перед «Выйти из аккаунта». На desktop закреплены снизу */
@@ -92,6 +92,11 @@ export function useUserMenuItems({
92
92
  };
93
93
  }
94
94
 
95
+ // Без организаций прокручивать нечего: пустой `items` показал бы заглушку «Нет данных»
96
+ if (!organizationItems.length) {
97
+ return { pinTop: [], items: withClose([...pinTop, DIVIDER_ITEM, ...pinBottom]), pinBottom: [] };
98
+ }
99
+
95
100
  return { pinTop: withClose(pinTop), items: withClose(organizationItems), pinBottom: withClose(pinBottom) };
96
101
  }, [bottomItems, isMobile, logoutItem, onClose, organizationItems, profileItem, settingItems, themeItem, topItems]);
97
102
  }