@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 2.1.2 (2026-10-05)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **FF-9172:** allow header breadcrumbs wrapper to shrink ([12a0633](https://github.com/cloud-ru-tech/snack-v2/commit/12a0633f85980128a14af6c467f9cfd7566e395e))
|
|
11
|
+
- **FF-9172:** gen-props resolves indexed access to the field type ([baf31c4](https://github.com/cloud-ru-tech/snack-v2/commit/baf31c4053e76c81d681c9c19a6622f009f40413))
|
|
12
|
+
- **FF-9172:** keep menu banner close button in flow and always visible on mobile ([ad48053](https://github.com/cloud-ru-tech/snack-v2/commit/ad480531898d9ab8f75f2aba2a066afe233e04da))
|
|
13
|
+
- **FF-9172:** render user menu as single list when no organizations passed ([363ca6a](https://github.com/cloud-ru-tech/snack-v2/commit/363ca6abfc44575c45fd2687e6aa4bf1608ed70f))
|
|
14
|
+
|
|
6
15
|
## 2.1.1 (2026-10-05)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @ds/uikit-product-header
|
package/README.md
CHANGED
|
@@ -339,7 +339,7 @@ function LocalMainMenu() {
|
|
|
339
339
|
| Prop | Type | Default | Description |
|
|
340
340
|
|------|------|---------|-------------|
|
|
341
341
|
| `aliases` | `string[]` | — | Синонимы для fuzzy-поиска. |
|
|
342
|
-
| `badge` | `
|
|
342
|
+
| `badge` | `CardPromoTagProps` \| `PromoTagPredefinedBaseProps` | — | Промо-тег карточки. |
|
|
343
343
|
| `description` | `string \| undefined` | — | Краткое описание сервиса — отображается при включённом переключателе «Описание». |
|
|
344
344
|
| `disabled` | `boolean \| undefined` | — | Карточка недоступна для клика/drag и визуально приглушена. |
|
|
345
345
|
| `favoritesEnabled` | `boolean \| undefined` | — | Разрешено ли добавление карточки в избранное. default=true - разрешено |
|
|
@@ -513,7 +513,7 @@ import { MainMenu, MenuMobile } from '@cloud-ru/ds-uikit-product-header';
|
|
|
513
513
|
| Prop | Type | Default | Description |
|
|
514
514
|
|------|------|---------|-------------|
|
|
515
515
|
| `aliases` | `string[]` | — | Синонимы для fuzzy-поиска. |
|
|
516
|
-
| `badge` | `
|
|
516
|
+
| `badge` | `CardPromoTagProps` \| `PromoTagPredefinedBaseProps` | — | Промо-тег карточки. |
|
|
517
517
|
| `description` | `string \| undefined` | — | Краткое описание сервиса — отображается при включённом переключателе «Описание». |
|
|
518
518
|
| `disabled` | `boolean \| undefined` | — | Карточка недоступна для клика/drag и визуально приглушена. |
|
|
519
519
|
| `favoritesEnabled` | `boolean \| undefined` | — | Разрешено ли добавление карточки в избранное. default=true - разрешено |
|
|
@@ -693,16 +693,16 @@ export function ControlledTheme() {
|
|
|
693
693
|
|
|
694
694
|
| Prop | Type | Default | Description |
|
|
695
695
|
|------|------|---------|-------------|
|
|
696
|
-
| `bottomItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `
|
|
696
|
+
| `bottomItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `Item` \| `ScrollProps` | — | Пункты перед «Выйти из аккаунта». На desktop закреплены снизу |
|
|
697
697
|
| `onClick` | `(() => void)` | — | Колбэк клика по кнопке-триггеру. |
|
|
698
698
|
| `onLogout` | `(() => void)` | — | Колбэк клика по пункту «Выйти». |
|
|
699
699
|
| `open` | `boolean` | — | Открыто ли меню. <br/> Не передано — состояние открытия неуправляемое (меню само переключает себя по клику на кнопку). |
|
|
700
|
-
| `organizationItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `
|
|
700
|
+
| `organizationItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `Item` \| `ScrollProps` | — | Список организаций. На desktop — единственная прокручиваемая часть меню. <br/> Не передан или пуст — меню отображается единым списком без закреплённых частей. |
|
|
701
701
|
| `profile` | `UserProfileProps` | `{}` | Профиль пользователя (имя, email, счётчик приглашений). |
|
|
702
702
|
| `setOpen` | `((open: boolean) => void)` | — | Колбэк открытия/закрытия меню. |
|
|
703
703
|
| `settingItems` | `BaseItemProps` | — | Пункты настроек в нижней части меню. |
|
|
704
704
|
| `theme` | `ThemeProps` | — | Переключатель темы в меню. Без пропа не отображается. |
|
|
705
|
-
| `topItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `
|
|
705
|
+
| `topItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `Item` \| `ScrollProps` | — | Пункты после темы. На desktop закреплены сверху вместе с профилем и темой |
|
|
706
706
|
| `triggerTooltip` | `string` | — | Текст подсказки для кнопки-триггера. |
|
|
707
707
|
|
|
708
708
|
##### Related types
|
|
@@ -823,4 +823,4 @@ export function Basic() {
|
|
|
823
823
|
|
|
824
824
|
| Prop | Type | Default | Description |
|
|
825
825
|
|------|------|---------|-------------|
|
|
826
|
-
| `items` | `
|
|
826
|
+
| `items` | `Item` | — | Пункты хлебных крошек. |
|
|
@@ -12,15 +12,17 @@ const promo_tag_1 = require("@cloud-ru/ds-promo-tag");
|
|
|
12
12
|
const typography_1 = require("@cloud-ru/ds-typography");
|
|
13
13
|
const classnames_1 = __importDefault(require("classnames"));
|
|
14
14
|
const react_1 = require("react");
|
|
15
|
+
const useMobileLayout_1 = require("../../../../hooks/useMobileLayout");
|
|
15
16
|
const locale_1 = require("../../../../locale");
|
|
16
17
|
const constants_1 = require("./constants");
|
|
17
18
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
18
19
|
function MenuBanner({ title, promoTag, afterTitle, onClose, className, href = '#', 'data-test-id': dataTestId, ...rest }) {
|
|
19
20
|
const { t } = locale_1.headerLocale.useTranslations();
|
|
21
|
+
const isMobile = (0, useMobileLayout_1.useMobileLayout)();
|
|
20
22
|
const handleClose = (0, react_1.useCallback)(e => {
|
|
21
23
|
e.preventDefault();
|
|
22
24
|
e.stopPropagation();
|
|
23
25
|
onClose?.(e);
|
|
24
26
|
}, [onClose]);
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)(card_1.Card, { as: 'a', href: href, radius: 'l', view: 'simple', className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-test-id": dataTestId ?? constants_1.MENU_BANNER_TEST_IDS.root, ...rest, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentRow, children: [(0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.titleWrapper, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { as: 'span', variant: 'body', size: 'm', className: styles_module_scss_1.default.title, "data-test-id": constants_1.MENU_BANNER_TEST_IDS.title, children: title }), promoTag && ((0, jsx_runtime_1.jsx)(promo_tag_1.PromoTag, { ...promoTag, className: styles_module_scss_1.default.promoTag, roleAppearance: promo_tag_1.ROLE_APPEARANCE.Decor, size: promo_tag_1.SIZE.Xs, "data-test-id": constants_1.MENU_BANNER_TEST_IDS.promoTag }))] }), afterTitle && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.afterTitle, "data-test-id": constants_1.MENU_BANNER_TEST_IDS.afterTitle, children: afterTitle })), onClose && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.closeButton, view: 'elevated', appearance: 'neutral', size: 's', icon: (0, jsx_runtime_1.jsx)(system_1.CrossSVG, {}), onClick: handleClose, "aria-label": t('close'), "data-test-id": constants_1.MENU_BANNER_TEST_IDS.close }))] }) }));
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(card_1.Card, { as: 'a', href: href, radius: 'l', view: 'simple', className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-mobile": isMobile || undefined, "data-test-id": dataTestId ?? constants_1.MENU_BANNER_TEST_IDS.root, ...rest, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentRow, "data-closable": Boolean(onClose) || undefined, children: [(0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.titleWrapper, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { as: 'span', variant: 'body', size: 'm', className: styles_module_scss_1.default.title, "data-test-id": constants_1.MENU_BANNER_TEST_IDS.title, children: title }), promoTag && ((0, jsx_runtime_1.jsx)(promo_tag_1.PromoTag, { ...promoTag, className: styles_module_scss_1.default.promoTag, roleAppearance: promo_tag_1.ROLE_APPEARANCE.Decor, size: promo_tag_1.SIZE.Xs, "data-test-id": constants_1.MENU_BANNER_TEST_IDS.promoTag }))] }), afterTitle && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.afterTitle, "data-test-id": constants_1.MENU_BANNER_TEST_IDS.afterTitle, children: afterTitle })), onClose && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.closeButton, view: 'elevated', appearance: 'neutral', size: 's', icon: (0, jsx_runtime_1.jsx)(system_1.CrossSVG, {}), onClick: handleClose, "aria-label": t('close'), "data-test-id": constants_1.MENU_BANNER_TEST_IDS.close }))] }) }));
|
|
26
28
|
}
|
|
@@ -18,6 +18,16 @@
|
|
|
18
18
|
.root:hover .closeButton, .root:focus-visible .closeButton, .root:has(*:focus-visible) .closeButton{
|
|
19
19
|
visibility:visible;
|
|
20
20
|
}
|
|
21
|
+
.root[data-mobile] .closeButton{
|
|
22
|
+
position:relative;
|
|
23
|
+
top:auto;
|
|
24
|
+
right:auto;
|
|
25
|
+
flex-shrink:0;
|
|
26
|
+
visibility:visible;
|
|
27
|
+
}
|
|
28
|
+
.root[data-mobile] .contentRow[data-closable]{
|
|
29
|
+
padding-right:var(--sn-primitive-dimension-4, 4px);
|
|
30
|
+
}
|
|
21
31
|
|
|
22
32
|
.contentRow{
|
|
23
33
|
position:relative;
|
|
@@ -116,5 +116,5 @@ function Content({ searchValue, search, rightTop, segments, searchGroups = empty
|
|
|
116
116
|
appearance: 'neutral',
|
|
117
117
|
}, content: isSearching ? t('noDataFound') : t('noData'), "data-test-id": isSearching ? constants_1.TEST_IDS.noDataFound : constants_1.TEST_IDS.noData, "data-mobile": isMobile || undefined, className: styles_module_scss_1.default.noData }));
|
|
118
118
|
})();
|
|
119
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [search, (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.content, className), "data-mobile": isMobile || undefined, "data-empty": (!loading && !hasCards) || undefined, children: [!isSearching && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(MountAnimation_1.MountAnimation, { type: mountAnimationType, className: styles_module_scss_1.default.top, children: [(0, jsx_runtime_1.jsx)(ContentToolbar_1.ContentToolbar, { segment: segmentId, onSegmentChange: setSegmentId, segmentItems: segmentItems, allGroupsExpanded: allGroupsExpanded, onToggleAllGroupsExpanded: handleToggleAllGroupsExpanded, preferences: preferences, isMobile: isMobile, loading: loading }), rightTop] }) })), cards, footer] })] }));
|
|
119
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [search, (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.content, className), "data-mobile": isMobile || undefined, "data-empty": (!loading && !hasCards) || undefined, children: [!isSearching && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(MountAnimation_1.MountAnimation, { type: mountAnimationType, className: styles_module_scss_1.default.top, children: [(0, jsx_runtime_1.jsx)(ContentToolbar_1.ContentToolbar, { segment: segmentId, onSegmentChange: setSegmentId, segmentItems: segmentItems, allGroupsExpanded: allGroupsExpanded, onToggleAllGroupsExpanded: handleToggleAllGroupsExpanded, preferences: preferences, isMobile: isMobile, loading: loading }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.rightTop, "data-mobile": isMobile || undefined, children: rightTop })] }) })), cards, footer] })] }));
|
|
120
120
|
}
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type SortableGroupDragHandleProps = {
|
|
3
|
-
/** ARIA-атрибуты `dnd-kit` draggable-элемента. */
|
|
4
|
-
attributes?: DraggableAttributes;
|
|
5
|
-
/** Обработчики событий `dnd-kit` для инициации перетаскивания. */
|
|
6
|
-
listeners?: DraggableSyntheticListeners;
|
|
7
|
-
};
|
|
8
|
-
export declare function SortableGroupDragHandle({ attributes, listeners }: SortableGroupDragHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function SortableGroupDragHandle(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
|
9
9
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
10
10
|
const locale_1 = require("../../../../../../../locale");
|
|
11
11
|
const styles_module_scss_1 = __importDefault(require('../styles.module.css'));
|
|
12
|
-
function SortableGroupDragHandle(
|
|
12
|
+
function SortableGroupDragHandle() {
|
|
13
13
|
const { t } = locale_1.headerLocale.useTranslations();
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)("button", {
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: 'button', className: styles_module_scss_1.default.dragHandle, "aria-label": t('dragGroup'), "data-test-id": 'header__drawer-menu__group-card-drag-handle', onClick: utils_1.stopEventPropagation, children: (0, jsx_runtime_1.jsx)(system_1.DragDropSVG, { size: 24 }) }));
|
|
15
15
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { DraggableAttributes, DraggableSyntheticListeners } from '@dnd-kit/core';
|
|
1
2
|
import { LinksGroup, LinksGroupTitle } from '../../../../../types';
|
|
2
|
-
import { SortableGroupDragHandleProps } from './SortableGroupDragHandle';
|
|
3
3
|
export type SortableGroupHeaderProps = Pick<LinksGroup, 'icon'> & {
|
|
4
4
|
label: LinksGroupTitle;
|
|
5
5
|
isExpanded?: boolean;
|
|
6
6
|
enableServiceDrag?: boolean;
|
|
7
7
|
isMobile?: boolean;
|
|
8
|
-
|
|
8
|
+
/** ARIA-атрибуты `dnd-kit` draggable-элемента. */
|
|
9
|
+
attributes?: DraggableAttributes;
|
|
10
|
+
/** Обработчики событий `dnd-kit` для инициации перетаскивания. */
|
|
11
|
+
listeners?: DraggableSyntheticListeners;
|
|
12
|
+
};
|
|
9
13
|
declare function SortableGroupHeaderBase({ label, icon, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }: SortableGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
export declare const SortableGroupHeader: import("react").MemoExoticComponent<typeof SortableGroupHeaderBase>;
|
|
11
15
|
export {};
|
|
@@ -18,6 +18,6 @@ function SortableGroupHeaderBase({ label, icon, isExpanded, enableServiceDrag, a
|
|
|
18
18
|
e.stopPropagation();
|
|
19
19
|
label?.onClick?.(e);
|
|
20
20
|
}, [label]);
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, "data-expanded": isExpanded || undefined, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: 'title', size: 'm', className: styles_module_scss_1.default.headerTitle, "data-test-id": 'header__drawer-menu__group-card-title', children: label.onClick || label.href ? ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { ...(label.href ? { as: 'a', href: label.href } : { as: 'div' }), onClick: handleLabelClick, title: label.text, icon: (0, utils_1.getLinkEmblem)({ icon }) })) : (label.text) }), (enableServiceDrag || !isMobile) && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.headerActions, "data-always-visible": isMobile || undefined, children: [enableServiceDrag && (0, jsx_runtime_1.jsx)(SortableGroupDragHandle_1.SortableGroupDragHandle, {
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, "data-expanded": isExpanded || undefined, ...attributes, ...listeners, tabIndex: -1, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: 'title', size: 'm', className: styles_module_scss_1.default.headerTitle, "data-test-id": 'header__drawer-menu__group-card-title', children: label.onClick || label.href ? ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { ...(label.href ? { as: 'a', href: label.href } : { as: 'div' }), onClick: handleLabelClick, title: label.text, icon: (0, utils_1.getLinkEmblem)({ icon }) })) : (label.text) }), (enableServiceDrag || !isMobile) && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.headerActions, "data-always-visible": isMobile || undefined, children: [enableServiceDrag && (0, jsx_runtime_1.jsx)(SortableGroupDragHandle_1.SortableGroupDragHandle, {}), !isMobile && ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'elevated', appearance: 'neutral', size: 's', icon: isExpanded ? (0, jsx_runtime_1.jsx)(system_1.ChevronUpSVG, {}) : (0, jsx_runtime_1.jsx)(system_1.ChevronDownSVG, {}), "data-test-id": 'header__drawer-menu__group-card-collapse' }))] }))] }));
|
|
22
22
|
}
|
|
23
23
|
exports.SortableGroupHeader = (0, react_1.memo)(SortableGroupHeaderBase);
|
|
@@ -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;
|
|
@@ -60,7 +60,7 @@ function MenuDesktop({ open = false, setOpen, settingItems, platformGroups, segm
|
|
|
60
60
|
return ((0, jsx_runtime_1.jsx)(drawer_1.DrawerCustom, { open: open, onClose: handleCloseDrawer, width: isNeedRightBlock ? 'm' : 's', position: 'left', className: styles_module_scss_1.default.drawer, rootClassName: styles_module_scss_1.default.drawerRoot, "data-test-id": constants_1.TEST_IDS.mainMenu.drawer, "data-small": !isNeedRightBlock || undefined, disableMotions: true, showButtonClosed: false, resizable: isNeedRightBlock
|
|
61
61
|
? {
|
|
62
62
|
min: constants_2.MENU_WIDTH_MIN,
|
|
63
|
-
max:
|
|
63
|
+
max: 'full',
|
|
64
64
|
default: Math.min(Math.max(defaultWidth, constants_2.MENU_WIDTH_MIN), constants_2.MENU_WIDTH_MAX),
|
|
65
65
|
onResizeEnd: onWidthChangeEnd,
|
|
66
66
|
draggerTooltip,
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MENU_WIDTH_MAX = exports.MENU_WIDTH_MIN = exports.MENU_WIDTH_STORAGE_KEY = void 0;
|
|
4
4
|
exports.MENU_WIDTH_STORAGE_KEY = 'cloud-ru-main-menu-user-width';
|
|
5
5
|
// паддинг справа 24px у дровера нужно компенсировать
|
|
6
|
-
exports.MENU_WIDTH_MIN =
|
|
6
|
+
exports.MENU_WIDTH_MIN = 630 + 24;
|
|
7
7
|
exports.MENU_WIDTH_MAX = 1208 + 24;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.useMainMenuDndOverlay = useMainMenuDndOverlay;
|
|
4
7
|
exports.useMainMenuDnd = useMainMenuDnd;
|
|
@@ -11,6 +14,7 @@ const portal_context_1 = require("@cloud-ru/ds-portal-context");
|
|
|
11
14
|
const react_1 = require("react");
|
|
12
15
|
const react_dom_1 = require("react-dom");
|
|
13
16
|
const ServiceCard_1 = require("../helperComponents/ServiceCard");
|
|
17
|
+
const styles_module_scss_1 = __importDefault(require('../styles.module.css'));
|
|
14
18
|
const utils_1 = require("../utils");
|
|
15
19
|
const restrictGroupDragToVerticalAxis = args => {
|
|
16
20
|
if (args.active?.id != null && (0, utils_1.isServiceSourceDragId)(args.active.id)) {
|
|
@@ -87,6 +91,14 @@ function useMainMenuDnd({ favorite, servicesById, showDescription }) {
|
|
|
87
91
|
}
|
|
88
92
|
function MainMenuDndContext({ children, sensors, modifiers, collisionDetection, onDragStart, onDragEnd, onDragCancel, dragOverlay, overlayContextValue, }) {
|
|
89
93
|
const portalContextRef = (0, portal_context_1.usePortalContext)();
|
|
94
|
+
const isDragging = Boolean(dragOverlay);
|
|
95
|
+
(0, react_1.useEffect)(() => {
|
|
96
|
+
if (!isDragging)
|
|
97
|
+
return;
|
|
98
|
+
/* Для предотвращения случайных взаимодействий с любыми другими элементами при перетаскивании */
|
|
99
|
+
document.body.classList.add(styles_module_scss_1.default.dragging);
|
|
100
|
+
return () => document.body.classList.remove(styles_module_scss_1.default.dragging);
|
|
101
|
+
}, [isDragging]);
|
|
90
102
|
// `DragOverlay` рендерит `position: fixed` без собственного портала. Drawer-обёртка
|
|
91
103
|
// (`.snack-rc-drawer-content-wrapper`) держит `will-change: transform`, а это, как и
|
|
92
104
|
// настоящий 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'];
|
|
@@ -49,6 +49,10 @@ function useUserMenuItems({ profile, theme, onLogout, topItems = emptyArray_1.EM
|
|
|
49
49
|
pinBottom: [],
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
// Без организаций прокручивать нечего: пустой `items` показал бы заглушку «Нет данных»
|
|
53
|
+
if (!organizationItems.length) {
|
|
54
|
+
return { pinTop: [], items: withClose([...pinTop, DIVIDER_ITEM, ...pinBottom]), pinBottom: [] };
|
|
55
|
+
}
|
|
52
56
|
return { pinTop: withClose(pinTop), items: withClose(organizationItems), pinBottom: withClose(pinBottom) };
|
|
53
57
|
}, [bottomItems, isMobile, logoutItem, onClose, organizationItems, profileItem, settingItems, themeItem, topItems]);
|
|
54
58
|
}
|
package/dist/cjs/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;
|
|
@@ -6,15 +6,17 @@ import { PromoTag, ROLE_APPEARANCE, SIZE } from '@cloud-ru/ds-promo-tag';
|
|
|
6
6
|
import { Typography } from '@cloud-ru/ds-typography';
|
|
7
7
|
import cn from 'classnames';
|
|
8
8
|
import { useCallback } from 'react';
|
|
9
|
+
import { useMobileLayout } from '../../../../hooks/useMobileLayout.js';
|
|
9
10
|
import { headerLocale } from '../../../../locale/index.js';
|
|
10
11
|
import { MENU_BANNER_TEST_IDS } from './constants.js';
|
|
11
12
|
import styles from './styles.module.css';
|
|
12
13
|
export function MenuBanner({ title, promoTag, afterTitle, onClose, className, href = '#', 'data-test-id': dataTestId, ...rest }) {
|
|
13
14
|
const { t } = headerLocale.useTranslations();
|
|
15
|
+
const isMobile = useMobileLayout();
|
|
14
16
|
const handleClose = useCallback(e => {
|
|
15
17
|
e.preventDefault();
|
|
16
18
|
e.stopPropagation();
|
|
17
19
|
onClose?.(e);
|
|
18
20
|
}, [onClose]);
|
|
19
|
-
return (_jsx(Card, { as: 'a', href: href, radius: 'l', view: 'simple', className: cn(styles.root, className), "data-test-id": dataTestId ?? MENU_BANNER_TEST_IDS.root, ...rest, children: _jsxs("div", { className: styles.contentRow, children: [_jsxs("span", { className: styles.titleWrapper, children: [_jsx(Typography, { as: 'span', variant: 'body', size: 'm', className: styles.title, "data-test-id": MENU_BANNER_TEST_IDS.title, children: title }), promoTag && (_jsx(PromoTag, { ...promoTag, className: styles.promoTag, roleAppearance: ROLE_APPEARANCE.Decor, size: SIZE.Xs, "data-test-id": MENU_BANNER_TEST_IDS.promoTag }))] }), afterTitle && (_jsx("div", { className: styles.afterTitle, "data-test-id": MENU_BANNER_TEST_IDS.afterTitle, children: afterTitle })), onClose && (_jsx(Button, { className: styles.closeButton, view: 'elevated', appearance: 'neutral', size: 's', icon: _jsx(CrossSVG, {}), onClick: handleClose, "aria-label": t('close'), "data-test-id": MENU_BANNER_TEST_IDS.close }))] }) }));
|
|
21
|
+
return (_jsx(Card, { as: 'a', href: href, radius: 'l', view: 'simple', className: cn(styles.root, className), "data-mobile": isMobile || undefined, "data-test-id": dataTestId ?? MENU_BANNER_TEST_IDS.root, ...rest, children: _jsxs("div", { className: styles.contentRow, "data-closable": Boolean(onClose) || undefined, children: [_jsxs("span", { className: styles.titleWrapper, children: [_jsx(Typography, { as: 'span', variant: 'body', size: 'm', className: styles.title, "data-test-id": MENU_BANNER_TEST_IDS.title, children: title }), promoTag && (_jsx(PromoTag, { ...promoTag, className: styles.promoTag, roleAppearance: ROLE_APPEARANCE.Decor, size: SIZE.Xs, "data-test-id": MENU_BANNER_TEST_IDS.promoTag }))] }), afterTitle && (_jsx("div", { className: styles.afterTitle, "data-test-id": MENU_BANNER_TEST_IDS.afterTitle, children: afterTitle })), onClose && (_jsx(Button, { className: styles.closeButton, view: 'elevated', appearance: 'neutral', size: 's', icon: _jsx(CrossSVG, {}), onClick: handleClose, "aria-label": t('close'), "data-test-id": MENU_BANNER_TEST_IDS.close }))] }) }));
|
|
20
22
|
}
|
|
@@ -18,6 +18,16 @@
|
|
|
18
18
|
.root:hover .closeButton, .root:focus-visible .closeButton, .root:has(*:focus-visible) .closeButton{
|
|
19
19
|
visibility:visible;
|
|
20
20
|
}
|
|
21
|
+
.root[data-mobile] .closeButton{
|
|
22
|
+
position:relative;
|
|
23
|
+
top:auto;
|
|
24
|
+
right:auto;
|
|
25
|
+
flex-shrink:0;
|
|
26
|
+
visibility:visible;
|
|
27
|
+
}
|
|
28
|
+
.root[data-mobile] .contentRow[data-closable]{
|
|
29
|
+
padding-right:var(--sn-primitive-dimension-4, 4px);
|
|
30
|
+
}
|
|
21
31
|
|
|
22
32
|
.contentRow{
|
|
23
33
|
position:relative;
|
|
@@ -110,5 +110,5 @@ export function Content({ searchValue, search, rightTop, segments, searchGroups
|
|
|
110
110
|
appearance: 'neutral',
|
|
111
111
|
}, content: isSearching ? t('noDataFound') : t('noData'), "data-test-id": isSearching ? TEST_IDS.noDataFound : TEST_IDS.noData, "data-mobile": isMobile || undefined, className: styles.noData }));
|
|
112
112
|
})();
|
|
113
|
-
return (_jsxs(_Fragment, { children: [search, _jsxs("div", { className: cn(styles.content, className), "data-mobile": isMobile || undefined, "data-empty": (!loading && !hasCards) || undefined, children: [!isSearching && (_jsx(_Fragment, { children: _jsxs(MountAnimation, { type: mountAnimationType, className: styles.top, children: [_jsx(ContentToolbar, { segment: segmentId, onSegmentChange: setSegmentId, segmentItems: segmentItems, allGroupsExpanded: allGroupsExpanded, onToggleAllGroupsExpanded: handleToggleAllGroupsExpanded, preferences: preferences, isMobile: isMobile, loading: loading }), rightTop] }) })), cards, footer] })] }));
|
|
113
|
+
return (_jsxs(_Fragment, { children: [search, _jsxs("div", { className: cn(styles.content, className), "data-mobile": isMobile || undefined, "data-empty": (!loading && !hasCards) || undefined, children: [!isSearching && (_jsx(_Fragment, { children: _jsxs(MountAnimation, { type: mountAnimationType, className: styles.top, children: [_jsx(ContentToolbar, { segment: segmentId, onSegmentChange: setSegmentId, segmentItems: segmentItems, allGroupsExpanded: allGroupsExpanded, onToggleAllGroupsExpanded: handleToggleAllGroupsExpanded, preferences: preferences, isMobile: isMobile, loading: loading }), _jsx("div", { className: styles.rightTop, "data-mobile": isMobile || undefined, children: rightTop })] }) })), cards, footer] })] }));
|
|
114
114
|
}
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type SortableGroupDragHandleProps = {
|
|
3
|
-
/** ARIA-атрибуты `dnd-kit` draggable-элемента. */
|
|
4
|
-
attributes?: DraggableAttributes;
|
|
5
|
-
/** Обработчики событий `dnd-kit` для инициации перетаскивания. */
|
|
6
|
-
listeners?: DraggableSyntheticListeners;
|
|
7
|
-
};
|
|
8
|
-
export declare function SortableGroupDragHandle({ attributes, listeners }: SortableGroupDragHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function SortableGroupDragHandle(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { DragDropSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
|
3
3
|
import { stopEventPropagation } from '@cloud-ru/ds-utils';
|
|
4
4
|
import { headerLocale } from '../../../../../../../locale/index.js';
|
|
5
5
|
import styles from '../styles.module.css';
|
|
6
|
-
export function SortableGroupDragHandle(
|
|
6
|
+
export function SortableGroupDragHandle() {
|
|
7
7
|
const { t } = headerLocale.useTranslations();
|
|
8
|
-
return (_jsx("button", {
|
|
8
|
+
return (_jsx("button", { type: 'button', className: styles.dragHandle, "aria-label": t('dragGroup'), "data-test-id": 'header__drawer-menu__group-card-drag-handle', onClick: stopEventPropagation, children: _jsx(DragDropSVG, { size: 24 }) }));
|
|
9
9
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { DraggableAttributes, DraggableSyntheticListeners } from '@dnd-kit/core';
|
|
1
2
|
import { LinksGroup, LinksGroupTitle } from '../../../../../types.js';
|
|
2
|
-
import { SortableGroupDragHandleProps } from './SortableGroupDragHandle.js';
|
|
3
3
|
export type SortableGroupHeaderProps = Pick<LinksGroup, 'icon'> & {
|
|
4
4
|
label: LinksGroupTitle;
|
|
5
5
|
isExpanded?: boolean;
|
|
6
6
|
enableServiceDrag?: boolean;
|
|
7
7
|
isMobile?: boolean;
|
|
8
|
-
|
|
8
|
+
/** ARIA-атрибуты `dnd-kit` draggable-элемента. */
|
|
9
|
+
attributes?: DraggableAttributes;
|
|
10
|
+
/** Обработчики событий `dnd-kit` для инициации перетаскивания. */
|
|
11
|
+
listeners?: DraggableSyntheticListeners;
|
|
12
|
+
};
|
|
9
13
|
declare function SortableGroupHeaderBase({ label, icon, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }: SortableGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
export declare const SortableGroupHeader: import("react").MemoExoticComponent<typeof SortableGroupHeaderBase>;
|
|
11
15
|
export {};
|
|
@@ -12,6 +12,6 @@ function SortableGroupHeaderBase({ label, icon, isExpanded, enableServiceDrag, a
|
|
|
12
12
|
e.stopPropagation();
|
|
13
13
|
label?.onClick?.(e);
|
|
14
14
|
}, [label]);
|
|
15
|
-
return (_jsxs("div", { className: styles.header, "data-expanded": isExpanded || undefined, children: [_jsx(Typography, { variant: 'title', size: 'm', className: styles.headerTitle, "data-test-id": 'header__drawer-menu__group-card-title', children: label.onClick || label.href ? (_jsx(TitleClickable, { ...(label.href ? { as: 'a', href: label.href } : { as: 'div' }), onClick: handleLabelClick, title: label.text, icon: getLinkEmblem({ icon }) })) : (label.text) }), (enableServiceDrag || !isMobile) && (_jsxs("div", { className: styles.headerActions, "data-always-visible": isMobile || undefined, children: [enableServiceDrag && _jsx(SortableGroupDragHandle, {
|
|
15
|
+
return (_jsxs("div", { className: styles.header, "data-expanded": isExpanded || undefined, ...attributes, ...listeners, tabIndex: -1, children: [_jsx(Typography, { variant: 'title', size: 'm', className: styles.headerTitle, "data-test-id": 'header__drawer-menu__group-card-title', children: label.onClick || label.href ? (_jsx(TitleClickable, { ...(label.href ? { as: 'a', href: label.href } : { as: 'div' }), onClick: handleLabelClick, title: label.text, icon: getLinkEmblem({ icon }) })) : (label.text) }), (enableServiceDrag || !isMobile) && (_jsxs("div", { className: styles.headerActions, "data-always-visible": isMobile || undefined, children: [enableServiceDrag && _jsx(SortableGroupDragHandle, {}), !isMobile && (_jsx(Button, { view: 'elevated', appearance: 'neutral', size: 's', icon: isExpanded ? _jsx(ChevronUpSVG, {}) : _jsx(ChevronDownSVG, {}), "data-test-id": 'header__drawer-menu__group-card-collapse' }))] }))] }));
|
|
16
16
|
}
|
|
17
17
|
export const SortableGroupHeader = memo(SortableGroupHeaderBase);
|