@cloud-ru/ds-uikit-product-header 1.1.6-preview-5926424e.0 → 1.1.6
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/README.md +2 -61
- package/dist/cjs/components/HeaderLayout/HeaderLayout.js +2 -2
- package/dist/cjs/components/HeaderLayout/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/MainMenu.js +2 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/Content.js +9 -8
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/ContentToolbar/styles.module.css +0 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/SortableGroup.d.ts +3 -3
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/SortableGroup.js +2 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.d.ts +3 -3
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.js +2 -8
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +0 -4
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.d.ts +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +3 -4
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +5 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.d.ts +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +4 -4
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/styles.module.css +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/ServiceCard/ServiceCard.js +1 -5
- package/dist/cjs/components/MainMenu/helperComponents/ServiceCard/styles.module.css +0 -1
- package/dist/cjs/components/MainMenu/types.d.ts +9 -14
- package/dist/cjs/components/MainMenu/utils/getAvatarNameFromLabel.d.ts +14 -0
- package/dist/cjs/components/MainMenu/utils/getAvatarNameFromLabel.js +24 -0
- package/dist/cjs/components/MainMenu/utils/getLinkEmblem.d.ts +1 -1
- package/dist/cjs/components/MainMenu/utils/getLinkEmblem.js +9 -1
- package/dist/cjs/components/MainMenu/utils/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/utils/index.js +1 -0
- package/dist/cjs/components/PathBreadcrumbs/styles.module.css +0 -3
- package/dist/cjs/components/UserMenu/UserMenu.d.ts +2 -2
- package/dist/cjs/components/UserMenu/UserMenu.js +4 -8
- package/dist/cjs/constants.d.ts +0 -3
- package/dist/cjs/constants.js +1 -5
- package/dist/cjs/style.css +7 -25
- package/dist/esm/components/HeaderLayout/HeaderLayout.js +2 -2
- package/dist/esm/components/HeaderLayout/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/MainMenu.js +2 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/Content.js +10 -9
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/ContentToolbar/styles.module.css +0 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/SortableGroup.d.ts +3 -3
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/SortableGroup.js +2 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.d.ts +3 -3
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.js +2 -8
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +0 -4
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.d.ts +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +3 -4
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +5 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.d.ts +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +5 -5
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/styles.module.css +1 -1
- package/dist/esm/components/MainMenu/helperComponents/ServiceCard/ServiceCard.js +1 -5
- package/dist/esm/components/MainMenu/helperComponents/ServiceCard/styles.module.css +0 -1
- package/dist/esm/components/MainMenu/types.d.ts +9 -14
- package/dist/esm/components/MainMenu/utils/getAvatarNameFromLabel.d.ts +14 -0
- package/dist/esm/components/MainMenu/utils/getAvatarNameFromLabel.js +21 -0
- package/dist/esm/components/MainMenu/utils/getLinkEmblem.d.ts +1 -1
- package/dist/esm/components/MainMenu/utils/getLinkEmblem.js +9 -1
- package/dist/esm/components/MainMenu/utils/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/utils/index.js +1 -0
- package/dist/esm/components/PathBreadcrumbs/styles.module.css +0 -3
- package/dist/esm/components/UserMenu/UserMenu.d.ts +2 -2
- package/dist/esm/components/UserMenu/UserMenu.js +5 -9
- package/dist/esm/constants.d.ts +0 -3
- package/dist/esm/constants.js +0 -4
- package/dist/esm/style.css +7 -25
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/src/components/HeaderLayout/HeaderLayout.tsx +2 -2
- package/src/components/HeaderLayout/styles.module.scss +1 -1
- package/src/components/MainMenu/MainMenu.tsx +2 -2
- package/src/components/MainMenu/helperComponents/Content/Content.tsx +14 -10
- package/src/components/MainMenu/helperComponents/Content/helperComponents/ContentToolbar/styles.module.scss +0 -1
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/SortableGroup.tsx +8 -11
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.tsx +4 -28
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.scss +7 -18
- package/src/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.tsx +4 -4
- package/src/components/MainMenu/helperComponents/MenuDesktop/styles.module.scss +5 -1
- package/src/components/MainMenu/helperComponents/MenuMobile/MenuMobile.tsx +7 -7
- package/src/components/MainMenu/helperComponents/MenuMobile/styles.module.scss +1 -1
- package/src/components/MainMenu/helperComponents/ServiceCard/ServiceCard.tsx +1 -7
- package/src/components/MainMenu/helperComponents/ServiceCard/styles.module.scss +0 -1
- package/src/components/MainMenu/types.ts +9 -15
- package/src/components/MainMenu/utils/getAvatarNameFromLabel.ts +24 -0
- package/src/components/MainMenu/utils/getLinkEmblem.tsx +18 -3
- package/src/components/MainMenu/utils/index.ts +1 -0
- package/src/components/PathBreadcrumbs/styles.module.scss +0 -4
- package/src/components/UserMenu/UserMenu.tsx +6 -13
- package/src/constants.ts +0 -5
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/MenuBottom.d.ts +0 -8
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/MenuBottom.js +0 -16
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/index.d.ts +0 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/index.js +0 -17
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/styles.module.css +0 -13
- package/dist/cjs/hooks/useMobileLayout.d.ts +0 -1
- package/dist/cjs/hooks/useMobileLayout.js +0 -8
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/MenuBottom.d.ts +0 -8
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/MenuBottom.js +0 -10
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/index.d.ts +0 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/index.js +0 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/styles.module.css +0 -13
- package/dist/esm/hooks/useMobileLayout.d.ts +0 -1
- package/dist/esm/hooks/useMobileLayout.js +0 -5
- package/src/components/MainMenu/helperComponents/MenuBottom/MenuBottom.tsx +0 -42
- package/src/components/MainMenu/helperComponents/MenuBottom/index.ts +0 -1
- package/src/components/MainMenu/helperComponents/MenuBottom/styles.module.scss +0 -15
- package/src/hooks/useMobileLayout.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
## 1.1.6 (2026-08-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ds/uikit-product-header
|
|
9
|
+
|
|
6
10
|
## 1.1.5 (2026-08-28)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -206,7 +206,6 @@ export function WithFavorites() {
|
|
|
206
206
|
| `disabled` | `boolean` | — | |
|
|
207
207
|
| `draggerTooltip` | `string` | — | Текст подсказки для драггера (desktop only) |
|
|
208
208
|
| `favorite` | `FavoriteProps` | — | |
|
|
209
|
-
| `leftBottom` | `ReactNode` | — | |
|
|
210
209
|
| `leftTop` | `ReactNode` | — | |
|
|
211
210
|
| `loading` | `boolean` | — | Флаг загрузки данных |
|
|
212
211
|
| `logo` | `ReactNode` | — | |
|
|
@@ -222,7 +221,7 @@ export function WithFavorites() {
|
|
|
222
221
|
| `segmentPrefs` | `MainMenuSegmentPrefs` | — | Пользовательские prefs сегментов (порядок / раскрытие групп). <br/> Нет записи для сегмента или omit `order` / `expanded` → uncontrolled для этого поля. |
|
|
223
222
|
| `segments` | `MainMenuSegment` | — | Сегменты правой панели (сетка карточек) — только каталог. <br/> При поиске: совпадения из сегментов без `pinBottomOnSearch` → `platformGroups` → сегменты с `pinBottomOnSearch`. <br/> Если один и тот же {@link InnerLink.id} совпал сразу в нескольких сегментах — остаётся только <br/> первое по этому приоритету вхождение, остальные (и опустевшие после этого группы) не показываются. <br/> При `segments.length > 1` показывается SegmentControl (скрывается во время поиска). <br/> Порядок и раскрытие групп — через `segmentPrefs` и колбэки ниже. |
|
|
224
223
|
| `setOpen` | `((open: boolean) => void)` | — | |
|
|
225
|
-
| `settingItems` | `
|
|
224
|
+
| `settingItems` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `ListProps` \| `ScrollProps` | — | Пункты левой колонки (desktop) / нижней части списка (mobile). <br/> Плоский список `List` (`BaseItem` и при необходимости `type: 'group'` с `divider` для разделителей). <br/> Не связан с сегментами правой панели и не меняется при сортировке групп в сегментах. |
|
|
226
225
|
|
|
227
226
|
##### Related types
|
|
228
227
|
|
|
@@ -241,24 +240,6 @@ export function WithFavorites() {
|
|
|
241
240
|
| `segment` | `"favorites"` \| `"recent"` | — | Активный сегмент («Избранное» / «Недавнее») в панели избранного. <br/> Не передано — неуправляемое состояние (дефолт `'favorites'`). |
|
|
242
241
|
| `value` | `string[]` | — | Список id избранных сервисов |
|
|
243
242
|
|
|
244
|
-
- `FavoritesSegment` = `"favorites"` \| `"recent"`
|
|
245
|
-
|
|
246
|
-
**InnerLink**
|
|
247
|
-
|
|
248
|
-
| Prop | Type | Default | Description |
|
|
249
|
-
|------|------|---------|-------------|
|
|
250
|
-
| `aliases` | `string[]` | — | Синонимы для fuzzy-поиска. |
|
|
251
|
-
| `badge` | `CardServiceLightProps` \| `PromoTagPredefinedBaseProps` | — | |
|
|
252
|
-
| `description` | `string \| undefined` | — | Краткое описание сервиса — отображается при включённом переключателе «Описание». |
|
|
253
|
-
| `disabled` | `boolean \| undefined` | — | |
|
|
254
|
-
| `hidden` | `boolean \| undefined` | — | |
|
|
255
|
-
| `href` | `string \| undefined` | — | |
|
|
256
|
-
| `icon` | `JSXElementConstructor<{ size?: number; className?: string; }> \| undefined` | — | Иконка карточки. |
|
|
257
|
-
| `id` | `string` | — | Уникальный идентификатор карточки (также используется в избранном и при поиске). <br/> Один и тот же сервис может быть представлен в разных сегментах с разной <br/> детализацией (простая карточка в общем каталоге и раскрытая с вложенными <br/> сервисами версия в другом сегменте) — в этом случае обеим версиям задаётся <br/> общий `id`. При поиске из совпадений с одинаковым `id` в разных сегментах <br/> остаётся только первое по приоритету сегментов (см. <br/> {@link <br/> MainMenuProps.segments <br/> } <br/> ). |
|
|
258
|
-
| `items` | `InnerLink` | — | Вложенные сервисы подкатегории. <br/> При наличии карточка раскрывается аккордеоном: в свёрнутом виде — обычная карточка <br/> с кнопкой раскрытия, в развёрнутом — заголовок <br/> {@link <br/> TitleClickable <br/> } <br/> и сетка вложенных сервисов. |
|
|
259
|
-
| `label` | `string` | — | Заголовок карточки. |
|
|
260
|
-
| `onClick` | `(e?: MouseEvent<HTMLElement>) => void` | — | |
|
|
261
|
-
|
|
262
243
|
**LinksGroup**
|
|
263
244
|
|
|
264
245
|
| Prop | Type | Default | Description |
|
|
@@ -268,16 +249,11 @@ export function WithFavorites() {
|
|
|
268
249
|
| `favoritesEnabled` | `boolean \| undefined` | — | Разрешено ли добавление карточек группы в избранное. |
|
|
269
250
|
| `hidden` | `boolean \| undefined` | — | |
|
|
270
251
|
| `highlight` | `boolean \| undefined` | — | Визуальное выделение группы |
|
|
271
|
-
| `icon` | `JSXElementConstructor<{ size?: number; className?: string; }> \| undefined` | — | |
|
|
272
252
|
| `id` | `string` | — | Уникальный идентификатор группы (якорь скролла, поиск по id). |
|
|
273
253
|
| `items` | `InnerLink` | — | Карточки сервисов или ссылок внутри группы. |
|
|
274
254
|
| `label` | `LinksGroupTitle` \| `TitleClickable` \| `TitleStatic` | — | Заголовок группы в сетке карточек и в боковой навигации. |
|
|
275
255
|
| `onClick` | `((e?: MouseEvent<HTMLElement>) => void) \| undefined` | — | |
|
|
276
256
|
|
|
277
|
-
- `LinksGroupBlockColor` = `"blue"` \| `"green"` \| `"neutral"` \| `"orange"` \| `"pink"` \| `"primary"` \| `"red"` \| `"violet"` \| `"yellow"`
|
|
278
|
-
|
|
279
|
-
- `LinksGroupTitle` = `TitleStatic | TitleClickable`
|
|
280
|
-
|
|
281
257
|
**MainMenuPreferencesProps**
|
|
282
258
|
|
|
283
259
|
| Prop | Type | Default | Description |
|
|
@@ -305,25 +281,6 @@ export function WithFavorites() {
|
|
|
305
281
|
| `id` | `string` | — | Id сегмента из <br/> {@link <br/> MainMenuSegment.id <br/> } <br/> . |
|
|
306
282
|
| `order` | `string[] \| undefined` | — | Порядок id групп. Если не передан — uncontrolled для этого сегмента <br/> (дефолт = порядок `items`; новые группы добавляются в конец). |
|
|
307
283
|
|
|
308
|
-
**MainMenuSettingsItem**
|
|
309
|
-
|
|
310
|
-
| Prop | Type | Default | Description |
|
|
311
|
-
|------|------|---------|-------------|
|
|
312
|
-
| `divider` | `"after"` \| `"before"` | — | |
|
|
313
|
-
| `hidden` | `boolean \| undefined` | — | |
|
|
314
|
-
| `href` | `string \| undefined` | — | |
|
|
315
|
-
| `icon` | `JSXElementConstructor<{ size?: number; className?: string; }> \| undefined` | — | Иконка карточки. |
|
|
316
|
-
| `id` | `string` | — | Уникальный идентификатор карточки (также используется в избранном и при поиске). <br/> Один и тот же сервис может быть представлен в разных сегментах с разной <br/> детализацией (простая карточка в общем каталоге и раскрытая с вложенными <br/> сервисами версия в другом сегменте) — в этом случае обеим версиям задаётся <br/> общий `id`. При поиске из совпадений с одинаковым `id` в разных сегментах <br/> остаётся только первое по приоритету сегментов (см. <br/> {@link <br/> MainMenuProps.segments <br/> } <br/> ). |
|
|
317
|
-
| `label` | `string` | — | Заголовок карточки. |
|
|
318
|
-
| `onClick` | `(e?: MouseEvent<HTMLElement>) => void` | — | |
|
|
319
|
-
|
|
320
|
-
**MainMenuToggleProps**
|
|
321
|
-
|
|
322
|
-
| Prop | Type | Default | Description |
|
|
323
|
-
|------|------|---------|-------------|
|
|
324
|
-
| `onChange` | `(value: boolean) => void` | — | |
|
|
325
|
-
| `value` | `boolean` | — | |
|
|
326
|
-
|
|
327
284
|
**SearchProps**
|
|
328
285
|
|
|
329
286
|
| Prop | Type | Default | Description |
|
|
@@ -334,22 +291,6 @@ export function WithFavorites() {
|
|
|
334
291
|
| `onSearchNoResult` | `((value: string) => void) \| undefined` | — | |
|
|
335
292
|
| `value` | `string` | — | |
|
|
336
293
|
|
|
337
|
-
**TitleClickable**
|
|
338
|
-
|
|
339
|
-
| Prop | Type | Default | Description |
|
|
340
|
-
|------|------|---------|-------------|
|
|
341
|
-
| `href` | `string \| undefined` | — | |
|
|
342
|
-
| `onClick` | `((e?: MouseEvent<HTMLElement>) => void) \| undefined` | — | |
|
|
343
|
-
| `text` | `string` | — | |
|
|
344
|
-
|
|
345
|
-
**TitleStatic**
|
|
346
|
-
|
|
347
|
-
| Prop | Type | Default | Description |
|
|
348
|
-
|------|------|---------|-------------|
|
|
349
|
-
| `href` | `undefined` | — | |
|
|
350
|
-
| `onClick` | `undefined` | — | |
|
|
351
|
-
| `text` | `string` | — | |
|
|
352
|
-
|
|
353
294
|
## UserMenu
|
|
354
295
|
|
|
355
296
|
Меню пользователя — профиль, переключатель темы, пункты настроек и выход.
|
|
@@ -415,7 +356,7 @@ export function ControlledTheme() {
|
|
|
415
356
|
|
|
416
357
|
| Prop | Type | Default | Description |
|
|
417
358
|
|------|------|---------|-------------|
|
|
418
|
-
| `items` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `
|
|
359
|
+
| `items` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `ListProps` \| `ScrollProps` | — | |
|
|
419
360
|
| `onClick` | `(() => void)` | — | |
|
|
420
361
|
| `onLogout` | `(() => void)` | — | |
|
|
421
362
|
| `open` | `boolean` | — | |
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HeaderLayout = HeaderLayout;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const adaptive_1 = require("@cloud-ru/ds-adaptive");
|
|
8
9
|
const divider_1 = require("@cloud-ru/ds-divider");
|
|
9
10
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
10
11
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
12
|
const constants_1 = require("../../constants");
|
|
12
|
-
const useMobileLayout_1 = require("../../hooks/useMobileLayout");
|
|
13
13
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
14
|
function HeaderLayout({ menu, logo, select, breadcrumbs, toolbar, className, ...rest }) {
|
|
15
|
-
const isMobile = (0,
|
|
15
|
+
const isMobile = (0, adaptive_1.isMobileLayout)((0, adaptive_1.useAdaptiveLayout)().layoutType);
|
|
16
16
|
return ((0, jsx_runtime_1.jsxs)("header", { className: (0, classnames_1.default)(styles_module_scss_1.default.header, className), ...(0, utils_1.extractSupportProps)({ 'data-test-id': constants_1.TEST_IDS.headerLayout.root, ...rest }), children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.top, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.left, children: [logo && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: logo }), menu && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical' }), menu] })), !isMobile && select && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical' }), select] })), !isMobile && breadcrumbs && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical' }), breadcrumbs] }))] }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.right, children: toolbar })] }), (0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'horizontal' }), isMobile && Boolean(breadcrumbs) && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bottom, children: breadcrumbs })] }));
|
|
17
17
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
align-items:center;
|
|
19
19
|
box-sizing:border-box;
|
|
20
20
|
height:var(--sn-primitive-dimension-24, 24px);
|
|
21
|
-
border-bottom:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-
|
|
21
|
+
border-bottom:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-neutral-decor, var(--sn-brand-color-neutral-80, var(--sn-primitive-color-gray-80, #e3e5ed)));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.left{
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MainMenu = MainMenu;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const adaptive_1 = require("@cloud-ru/ds-adaptive");
|
|
5
6
|
const product_1 = require("@cloud-ru/ds-icons/interface/product");
|
|
6
7
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
7
8
|
const react_1 = require("react");
|
|
8
9
|
const constants_1 = require("../../constants");
|
|
9
|
-
const useMobileLayout_1 = require("../../hooks/useMobileLayout");
|
|
10
10
|
const locale_1 = require("../../locale");
|
|
11
11
|
const HeaderButton_1 = require("../HeaderButton");
|
|
12
12
|
const MenuDesktop_1 = require("./helperComponents/MenuDesktop");
|
|
@@ -18,7 +18,7 @@ function MainMenu({ open: openProp, setOpen: setOpenProp, settingItems, platform
|
|
|
18
18
|
if (!open && search?.value)
|
|
19
19
|
search?.onChange('');
|
|
20
20
|
}, [open, search]);
|
|
21
|
-
const isMobile = (0,
|
|
21
|
+
const isMobile = (0, adaptive_1.isMobileLayout)((0, adaptive_1.useAdaptiveLayout)().layoutType);
|
|
22
22
|
const MenuComponent = isMobile ? MenuMobile_1.MenuMobile : MenuDesktop_1.MenuDesktop;
|
|
23
23
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(HeaderButton_1.HeaderButton, { tooltip: open ? undefined : { tip: t('services') }, isMobile: isMobile, disabled: disabled, icon: (0, jsx_runtime_1.jsx)(product_1.MainMenuSVG, {}), onClick: () => {
|
|
24
24
|
setOpen(true);
|
|
@@ -25,7 +25,8 @@ function Content({ searchValue, search, rightTop, segments, searchGroups = [], s
|
|
|
25
25
|
const { t } = locale_1.headerLocale.useTranslations();
|
|
26
26
|
const showDescription = (0, react_1.useDeferredValue)(preferences?.showDescription.value ?? false);
|
|
27
27
|
const segmentPrefsById = (0, react_1.useMemo)(() => new Map((segmentPrefs ?? []).map(prefs => [prefs.id, prefs])), [segmentPrefs]);
|
|
28
|
-
const
|
|
28
|
+
const visibleSegments = (0, react_1.useMemo)(() => segments.filter(segment => segment.items.some(group => (0, utils_2.getLinksGroupVisibleItemsCount)(group) > 0)), [segments]);
|
|
29
|
+
const defaultSegmentId = visibleSegments[0]?.id ?? segments[0]?.id ?? '';
|
|
29
30
|
const [segmentId = defaultSegmentId, setSegmentId] = (0, utils_1.useValueControl)({
|
|
30
31
|
value: activeSegmentId,
|
|
31
32
|
defaultValue: defaultSegmentId,
|
|
@@ -34,10 +35,10 @@ function Content({ searchValue, search, rightTop, segments, searchGroups = [], s
|
|
|
34
35
|
const isSearching = Boolean(searchValue);
|
|
35
36
|
const enableServiceDrag = Boolean(favorite) && !isMobile && !isSearching;
|
|
36
37
|
(0, react_1.useEffect)(() => {
|
|
37
|
-
if (!
|
|
38
|
+
if (!visibleSegments.some(segment => segment.id === segmentId) && defaultSegmentId) {
|
|
38
39
|
setSegmentId(defaultSegmentId);
|
|
39
40
|
}
|
|
40
|
-
}, [defaultSegmentId, segmentId, setSegmentId,
|
|
41
|
+
}, [defaultSegmentId, segmentId, setSegmentId, visibleSegments]);
|
|
41
42
|
const handleLinkClick = (0, react_1.useCallback)(({ disabled, onClick }, e) => {
|
|
42
43
|
if (disabled) {
|
|
43
44
|
e?.preventDefault();
|
|
@@ -78,23 +79,23 @@ function Content({ searchValue, search, rightTop, segments, searchGroups = [], s
|
|
|
78
79
|
}
|
|
79
80
|
onExpandedChange([...new Set([...expandedIds, ...visibleIds])]);
|
|
80
81
|
}, [allGroupsExpanded, expandedIds, onExpandedChange, visibleGroups]);
|
|
81
|
-
const segmentItems = (0, react_1.useMemo)(() =>
|
|
82
|
+
const segmentItems = (0, react_1.useMemo)(() => visibleSegments.map(segment => ({
|
|
82
83
|
value: segment.id,
|
|
83
84
|
label: segment.label,
|
|
84
85
|
icon: segment.icon,
|
|
85
|
-
})), [
|
|
86
|
+
})), [visibleSegments]);
|
|
86
87
|
const hasCards = visibleGroups.length > 0;
|
|
87
88
|
const cards = (() => {
|
|
88
89
|
if (loading) {
|
|
89
90
|
return Array.from({ length: 5 }).map((_, index) => (0, jsx_runtime_1.jsx)(SortableGroup_1.SortableGroupSkeleton, { isMobile: isMobile }, index));
|
|
90
91
|
}
|
|
91
92
|
if (hasCards) {
|
|
92
|
-
return ((0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: visibleGroups.map(({ id }) => id), strategy: sortable_1.verticalListSortingStrategy, children: (0, jsx_runtime_1.jsx)(accordion_1.Accordion, { selectionMode: 'multiple', expanded: expandedIds, onExpandedChange: onExpandedChange, children: visibleGroups.map(({ id, label,
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: visibleGroups.map(({ id }) => id), strategy: sortable_1.verticalListSortingStrategy, children: (0, jsx_runtime_1.jsx)(accordion_1.Accordion, { selectionMode: 'multiple', expanded: expandedIds, onExpandedChange: onExpandedChange, children: visibleGroups.map(({ id, label, items, favoritesEnabled = true, blockColor, highlight }) => ((0, jsx_runtime_1.jsx)(SortableGroup_1.SortableGroup, { id: id, label: label, items: items, isExpanded: expandedIds.includes(id), blockColor: (0, utils_2.resolveGroupBlockColor)(blockColor, preferences?.showGroupsColors?.value), showDescription: showDescription, isMobile: isMobile, enableServiceDrag: enableServiceDrag, favorite: favoritesEnabled ? favorite : undefined, onServiceClick: handleLinkClick, highlight: highlight }, id))) }) }));
|
|
93
94
|
}
|
|
94
95
|
return ((0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, { size: 'm', icon: {
|
|
95
|
-
icon:
|
|
96
|
+
icon: system_1.SearchSVG,
|
|
96
97
|
appearance: 'neutral',
|
|
97
98
|
}, content: isSearching ? t('noDataFound') : t('noData'), "data-test-id": isSearching ? constants_1.TEST_IDS.noDataFound : constants_1.TEST_IDS.noData }));
|
|
98
99
|
})();
|
|
99
|
-
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":
|
|
100
|
+
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": !hasCards || undefined, children: [!isSearching && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isMobile && rightTop, (0, jsx_runtime_1.jsx)(ContentToolbar_1.ContentToolbar, { segment: segmentId, onSegmentChange: setSegmentId, segmentItems: segmentItems, allGroupsExpanded: allGroupsExpanded, onToggleAllGroupsExpanded: handleToggleAllGroupsExpanded, preferences: preferences, isMobile: isMobile }), !isMobile && rightTop] })), cards, footer] })] }));
|
|
100
101
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinksGroupBlockColor, LinksGroupTitle } from '../../../../types';
|
|
2
2
|
import { SortableGroupCardsProps } from './components';
|
|
3
|
-
export type SortableGroupProps = Omit<SortableGroupCardsProps, 'groupId'> &
|
|
3
|
+
export type SortableGroupProps = Omit<SortableGroupCardsProps, 'groupId'> & {
|
|
4
4
|
id: string;
|
|
5
5
|
label: LinksGroupTitle;
|
|
6
6
|
isExpanded?: boolean;
|
|
7
7
|
blockColor?: LinksGroupBlockColor;
|
|
8
8
|
highlight?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare function SortableGroup({ id,
|
|
10
|
+
export declare function SortableGroup({ id, label, items, isExpanded, showDescription, isMobile, enableServiceDrag, favorite, onServiceClick, blockColor, highlight, }: SortableGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export declare function SortableGroupDragPreview({ id, label, items, isExpanded, showDescription, isMobile, favorite, blockColor, highlight, }: Omit<SortableGroupProps, 'enableServiceDrag'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ const theme_1 = require("@cloud-ru/ds-theme");
|
|
|
14
14
|
const constants_1 = require("../../constants");
|
|
15
15
|
const components_1 = require("./components");
|
|
16
16
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
17
|
-
function SortableGroup({ id,
|
|
17
|
+
function SortableGroup({ id, label, items, isExpanded, showDescription, isMobile, enableServiceDrag, favorite, onServiceClick, blockColor, highlight, }) {
|
|
18
18
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = (0, sortable_1.useSortable)({
|
|
19
19
|
id,
|
|
20
20
|
disabled: !enableServiceDrag,
|
|
@@ -28,7 +28,7 @@ function SortableGroup({ id, icon, label, items, isExpanded, showDescription, is
|
|
|
28
28
|
transition,
|
|
29
29
|
};
|
|
30
30
|
const { colorScheme } = (0, theme_1.useThemeAppearance)().appearance;
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(drag_and_drop_1.DragGhost, { innerRef: setNodeRef, id: id, style: style, className: styles_module_scss_1.default.group, dragging: isDragging, mode: drag_and_drop_1.DRAG_MODE.Dynamic, "data-test-id": `${constants_1.TEST_IDS.groupCard}-${id}`, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.decoration, "data-color-scheme": colorScheme, "data-is-highlighted": highlight || undefined, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.decorationBackground, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.colorMarker, "data-block-color": blockColor }) }) }), (0, jsx_runtime_1.jsx)(accordion_1.Accordion.CollapseBlockTertiary, { id: id, showChevron: false, afterTitle: (0, jsx_runtime_1.jsx)(components_1.SortableGroupHeader, { label: label,
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(drag_and_drop_1.DragGhost, { innerRef: setNodeRef, id: id, style: style, className: styles_module_scss_1.default.group, dragging: isDragging, mode: drag_and_drop_1.DRAG_MODE.Dynamic, "data-test-id": `${constants_1.TEST_IDS.groupCard}-${id}`, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.decoration, "data-color-scheme": colorScheme, "data-is-highlighted": highlight || undefined, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.decorationBackground, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.colorMarker, "data-block-color": blockColor }) }) }), (0, jsx_runtime_1.jsx)(accordion_1.Accordion.CollapseBlockTertiary, { id: id, showChevron: false, afterTitle: (0, jsx_runtime_1.jsx)(components_1.SortableGroupHeader, { label: label, isExpanded: isExpanded, enableServiceDrag: enableServiceDrag, attributes: attributes, listeners: listeners, isMobile: isMobile }), children: (0, jsx_runtime_1.jsx)(components_1.SortableGroupCards, { groupId: id, items: items, showDescription: showDescription, isMobile: isMobile, enableServiceDrag: enableServiceDrag, favorite: favorite, onServiceClick: onServiceClick }) })] }));
|
|
32
32
|
}
|
|
33
33
|
function SortableGroupDragPreview({ id, label, items, isExpanded, showDescription, isMobile, favorite, blockColor, highlight, }) {
|
|
34
34
|
const { colorScheme } = (0, theme_1.useThemeAppearance)().appearance;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinksGroupTitle } from '../../../../../types';
|
|
2
2
|
import { SortableGroupDragHandleProps } from './SortableGroupDragHandle';
|
|
3
|
-
export type SortableGroupHeaderProps =
|
|
3
|
+
export type SortableGroupHeaderProps = {
|
|
4
4
|
label: LinksGroupTitle;
|
|
5
5
|
isExpanded?: boolean;
|
|
6
6
|
enableServiceDrag?: boolean;
|
|
7
7
|
isMobile?: boolean;
|
|
8
8
|
} & SortableGroupDragHandleProps;
|
|
9
|
-
export declare function SortableGroupHeader({ label,
|
|
9
|
+
export declare function SortableGroupHeader({ label, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }: SortableGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,14 +8,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const button_1 = require("@cloud-ru/ds-button");
|
|
9
9
|
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
10
10
|
const typography_1 = require("@cloud-ru/ds-typography");
|
|
11
|
-
const uikit_product_title_clickable_1 = require("@cloud-ru/ds-uikit-product-title-clickable");
|
|
12
|
-
const utils_1 = require("../../../../../utils");
|
|
13
11
|
const styles_module_scss_1 = __importDefault(require('../styles.module.css'));
|
|
14
12
|
const SortableGroupDragHandle_1 = require("./SortableGroupDragHandle");
|
|
15
|
-
function SortableGroupHeader({ label,
|
|
16
|
-
|
|
17
|
-
e.stopPropagation();
|
|
18
|
-
label?.onClick?.(e);
|
|
19
|
-
};
|
|
20
|
-
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, { attributes: attributes, listeners: listeners }), !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' }))] }))] }));
|
|
13
|
+
function SortableGroupHeader({ label, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }) {
|
|
14
|
+
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, children: 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, { attributes: attributes, listeners: listeners }), !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' }))] }))] }));
|
|
21
15
|
}
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
overflow-x:clip;
|
|
51
51
|
display:flex;
|
|
52
52
|
flex-direction:column;
|
|
53
|
-
width:100%;
|
|
54
53
|
min-width:0;
|
|
55
54
|
padding:var(--sn-primitive-dimension-4, 4px) var(--sn-primitive-dimension-8, 8px) var(--sn-primitive-dimension-8, 8px) var(--sn-primitive-dimension-12, 12px);
|
|
56
55
|
border-radius:var(--sn-density-radius-2xs, var(--sn-primitive-dimension-4, 4px));
|
|
@@ -116,9 +115,6 @@
|
|
|
116
115
|
.groupBody[data-mobile]{
|
|
117
116
|
grid-template-columns:repeat(1, minmax(200px, 1fr));
|
|
118
117
|
}
|
|
119
|
-
.groupBody[data-subcategory-body]{
|
|
120
|
-
padding-bottom:var(--sn-primitive-dimension-4, 4px);
|
|
121
|
-
}
|
|
122
118
|
|
|
123
119
|
.decoration{
|
|
124
120
|
--highlight-border-width:1px;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MainMenuProps } from '../../types';
|
|
2
|
-
export declare function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, logo, rightTop, leftTop,
|
|
2
|
+
export declare function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, logo, rightTop, leftTop, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,7 @@ exports.MenuDesktop = MenuDesktop;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const divider_1 = require("@cloud-ru/ds-divider");
|
|
9
9
|
const drawer_1 = require("@cloud-ru/ds-drawer");
|
|
10
|
+
const list_1 = require("@cloud-ru/ds-list");
|
|
10
11
|
const scroll_1 = require("@cloud-ru/ds-scroll");
|
|
11
12
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
12
13
|
const react_1 = require("react");
|
|
@@ -15,13 +16,12 @@ const useMainMenuDnd_1 = require("../../hooks/useMainMenuDnd");
|
|
|
15
16
|
const useMenuItems_1 = require("../../hooks/useMenuItems");
|
|
16
17
|
const Content_1 = require("../Content");
|
|
17
18
|
const Favorites_1 = require("../Favorites");
|
|
18
|
-
const MenuBottom_1 = require("../MenuBottom");
|
|
19
19
|
const MenuHeaderBrand_1 = require("../MenuHeaderBrand");
|
|
20
20
|
const MountAnimation_1 = require("../MountAnimation");
|
|
21
21
|
const Search_1 = require("../Search");
|
|
22
22
|
const constants_2 = require("./constants");
|
|
23
23
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
24
|
-
function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, logo, rightTop, leftTop,
|
|
24
|
+
function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, logo, rightTop, leftTop, defaultWidth = constants_2.MENU_WIDTH_MAX, onWidthChangeEnd, draggerTooltip, loading, }) {
|
|
25
25
|
const [open = false, setOpen] = (0, utils_1.useValueControl)({ value: openProp, onChange: setOpenProp });
|
|
26
26
|
const { scrollRef, searchRef, resultItems } = (0, useMenuItems_1.useMenuItems)({
|
|
27
27
|
segments,
|
|
@@ -41,7 +41,6 @@ function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platf
|
|
|
41
41
|
return () => cancelAnimationFrame(frameId);
|
|
42
42
|
}, [open, hasSearch, searchRef]);
|
|
43
43
|
const isNeedRightBlock = segments && segments.some(segment => segment.items.length > 0);
|
|
44
|
-
const hasBottomItems = Boolean(settingItems?.length) || Boolean(leftBottom);
|
|
45
44
|
const allServiceGroups = (0, react_1.useMemo)(() => segments?.flatMap(segment => segment.items) ?? [], [segments]);
|
|
46
45
|
const mainMenuDnd = (0, useMainMenuDnd_1.useMainMenuDnd)({
|
|
47
46
|
favorite,
|
|
@@ -51,7 +50,7 @@ function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platf
|
|
|
51
50
|
const handleCloseDrawer = (0, react_1.useCallback)(() => {
|
|
52
51
|
setOpen(false);
|
|
53
52
|
}, [setOpen]);
|
|
54
|
-
const menu = ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menu, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menuHeader, children: [(0, jsx_runtime_1.jsx)(MenuHeaderBrand_1.MenuHeaderBrand, { logo: logo, onClose: handleCloseDrawer, className: styles_module_scss_1.default.menuHeaderBrand }), isNeedRightBlock && search && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical' }), (0, jsx_runtime_1.jsx)(Search_1.Search, { ...search, ref: searchRef })] }))] }), (0, jsx_runtime_1.jsx)(divider_1.Divider, {}), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menuBody, children: [(0, jsx_runtime_1.jsxs)(MountAnimation_1.MountAnimation, { className: styles_module_scss_1.default.left, "data-test-id": constants_1.TEST_IDS.mainMenu.left, type: 'slide-right', children: [leftTop && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftTop, children: leftTop }), isNeedRightBlock && favorite && (0, jsx_runtime_1.jsx)(Favorites_1.Favorites, { favorite: favorite, allServiceGroups: allServiceGroups }),
|
|
53
|
+
const menu = ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menu, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menuHeader, children: [(0, jsx_runtime_1.jsx)(MenuHeaderBrand_1.MenuHeaderBrand, { logo: logo, onClose: handleCloseDrawer, className: styles_module_scss_1.default.menuHeaderBrand }), isNeedRightBlock && search && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical' }), (0, jsx_runtime_1.jsx)(Search_1.Search, { ...search, ref: searchRef })] }))] }), (0, jsx_runtime_1.jsx)(divider_1.Divider, {}), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menuBody, children: [(0, jsx_runtime_1.jsxs)(MountAnimation_1.MountAnimation, { className: styles_module_scss_1.default.left, "data-test-id": constants_1.TEST_IDS.mainMenu.left, type: 'slide-right', children: [leftTop && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftTop, children: leftTop }), isNeedRightBlock && favorite && (0, jsx_runtime_1.jsx)(Favorites_1.Favorites, { favorite: favorite, allServiceGroups: allServiceGroups }), Boolean(settingItems?.length) && ((0, jsx_runtime_1.jsx)(list_1.List, { items: settingItems ?? [], size: 'm', barHideStrategy: 'never', className: styles_module_scss_1.default.settingItems }))] }), isNeedRightBlock && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(MountAnimation_1.MountAnimation, { type: 'fade-in', children: (0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical' }) }), (0, jsx_runtime_1.jsx)(MountAnimation_1.MountAnimation, { type: 'fade-slide-up-right', className: styles_module_scss_1.default.right, "data-test-id": constants_1.TEST_IDS.mainMenu.right, children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { paddingAbsolute: true, className: styles_module_scss_1.default.scroll, ref: scrollRef, barHideStrategy: 'never', overflow: { x: 'hidden' }, children: (0, jsx_runtime_1.jsx)(Content_1.Content, { onClose: handleCloseDrawer, className: styles_module_scss_1.default.rightContent, searchValue: search?.value, rightTop: rightTop, favorite: favorite, segments: segments, searchGroups: resultItems, segmentPrefs: segmentPrefs, activeSegmentId: activeSegmentId, onActiveSegmentChange: onActiveSegmentChange, onSegmentOrderChange: onSegmentOrderChange, onSegmentExpandedChange: onSegmentExpandedChange, preferences: preferences, loading: loading }) }) })] }))] })] }));
|
|
55
54
|
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
|
|
56
55
|
? {
|
|
57
56
|
min: constants_2.MENU_WIDTH_MIN,
|
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
min-height:0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.settingItems{
|
|
47
|
+
flex-shrink:0;
|
|
48
|
+
height:auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
.right{
|
|
47
52
|
position:relative;
|
|
48
53
|
display:flex;
|
|
@@ -58,7 +63,6 @@
|
|
|
58
63
|
display:flex;
|
|
59
64
|
flex-direction:column;
|
|
60
65
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
61
|
-
width:100%;
|
|
62
66
|
min-width:0;
|
|
63
67
|
padding:var(--sn-primitive-dimension-16, 16px);
|
|
64
68
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MainMenuProps } from '../../types';
|
|
2
|
-
export declare function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, logo, rightTop, leftTop,
|
|
2
|
+
export declare function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, logo, rightTop, leftTop, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MenuMobile = MenuMobile;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const list_1 = require("@cloud-ru/ds-list");
|
|
8
9
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
9
10
|
const react_1 = require("react");
|
|
10
11
|
const constants_1 = require("../../../../constants");
|
|
@@ -13,16 +14,15 @@ const useMainMenuDnd_1 = require("../../hooks/useMainMenuDnd");
|
|
|
13
14
|
const useMenuItems_1 = require("../../hooks/useMenuItems");
|
|
14
15
|
const Content_1 = require("../Content");
|
|
15
16
|
const Favorites_1 = require("../Favorites");
|
|
16
|
-
const MenuBottom_1 = require("../MenuBottom");
|
|
17
17
|
const MenuHeaderBrand_1 = require("../MenuHeaderBrand");
|
|
18
18
|
const MountAnimation_1 = require("../MountAnimation");
|
|
19
19
|
const ScrollWithAnimatedStickyPanel_1 = require("../ScrollWithAnimatedStickyPanel");
|
|
20
20
|
const Search_1 = require("../Search");
|
|
21
21
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
22
|
-
|
|
22
|
+
const SNAP_POINTS = [1];
|
|
23
|
+
function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, logo, rightTop, leftTop, loading, }) {
|
|
23
24
|
const [open = false, setOpen] = (0, utils_1.useValueControl)({ value: openProp, onChange: setOpenProp });
|
|
24
25
|
const hasSegments = segments && segments.some(segment => segment.items.length > 0);
|
|
25
|
-
const hasBottomItems = Boolean(settingItems?.length) || Boolean(leftBottom);
|
|
26
26
|
const isSearching = Boolean(search?.value);
|
|
27
27
|
const { searchRef, resultItems } = (0, useMenuItems_1.useMenuItems)({
|
|
28
28
|
segments,
|
|
@@ -33,5 +33,5 @@ function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platfo
|
|
|
33
33
|
const handleClose = (0, react_1.useCallback)(() => {
|
|
34
34
|
setOpen(false);
|
|
35
35
|
}, [setOpen]);
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(mobileOverlays_1.MobileDrawerCustom, { open: open, onClose: handleClose, position: 'bottom', className: styles_module_scss_1.default.drawerMobile, swipeEnabled: false, "data-test-id": constants_1.TEST_IDS.mainMenu.drawerMobile, closeOnPopstate: true, snapPoints:
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(mobileOverlays_1.MobileDrawerCustom, { open: open, onClose: handleClose, position: 'bottom', className: styles_module_scss_1.default.drawerMobile, swipeEnabled: false, "data-test-id": constants_1.TEST_IDS.mainMenu.drawerMobile, closeOnPopstate: true, snapPoints: SNAP_POINTS, disableMotions: true, children: (0, jsx_runtime_1.jsx)(ScrollWithAnimatedStickyPanel_1.ScrollWithAnimatedStickyPanel, { panel: (0, jsx_runtime_1.jsx)(MenuHeaderBrand_1.MenuHeaderBrand, { logo: logo, onClose: handleClose, className: styles_module_scss_1.default.menuHeader }), children: (0, jsx_runtime_1.jsxs)(MountAnimation_1.MountAnimation, { className: styles_module_scss_1.default.scrollMobile, type: 'fade-slide-up', children: [search && (0, jsx_runtime_1.jsx)(Search_1.Search, { ...search, ref: searchRef, isMobile: true }), favorite && (0, jsx_runtime_1.jsx)(Favorites_1.Favorites, { favorite: favorite, allServiceGroups: allServiceGroups, isMobile: true }), leftTop && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.rightContent, children: leftTop }), hasSegments && ((0, jsx_runtime_1.jsx)(useMainMenuDnd_1.MainMenuDndContext, { children: (0, jsx_runtime_1.jsx)(Content_1.Content, { isMobile: true, onClose: handleClose, className: styles_module_scss_1.default.rightContent, searchValue: search && search.value, rightTop: rightTop, favorite: favorite, segments: segments, searchGroups: resultItems, segmentPrefs: segmentPrefs, activeSegmentId: activeSegmentId, onActiveSegmentChange: onActiveSegmentChange, onSegmentOrderChange: onSegmentOrderChange, onSegmentExpandedChange: onSegmentExpandedChange, loading: loading }) })), !isSearching && settingItems && (0, jsx_runtime_1.jsx)(list_1.List, { items: settingItems, size: 'm', barHideStrategy: 'never' })] }) }) }));
|
|
37
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.menuHeader{
|
|
2
2
|
height:var(--sn-primitive-dimension-40, 40px);
|
|
3
3
|
padding:0 var(--sn-primitive-dimension-4, 4px);
|
|
4
|
-
border-bottom:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-
|
|
4
|
+
border-bottom:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-neutral-decor, var(--sn-brand-color-neutral-80, var(--sn-primitive-color-gray-80, #e3e5ed)));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.rightContent{
|
|
@@ -43,14 +43,10 @@ function ServiceCard({ service, favorite, isMobile, onServiceClick, showDescript
|
|
|
43
43
|
return dragPreview ? (0, jsx_runtime_1.jsx)(drag_and_drop_1.DragPreview, { className: styles_module_scss_1.default.dragCardPreview, children: card }) : card;
|
|
44
44
|
}
|
|
45
45
|
function DraggableServiceCard({ groupId, service, favorite, dragDisabled, ...props }) {
|
|
46
|
-
const disabled = dragDisabled || service.disabled || favorite?.value.includes(service.id);
|
|
47
46
|
const { attributes, listeners, setNodeRef, isDragging } = (0, core_1.useDraggable)({
|
|
48
47
|
id: (0, utils_1.getServiceSourceDragId)(groupId, service.id),
|
|
49
|
-
disabled,
|
|
48
|
+
disabled: dragDisabled || service.disabled || favorite?.value.includes(service.id),
|
|
50
49
|
});
|
|
51
50
|
const { tabIndex, ...restAttributes } = attributes ?? {};
|
|
52
|
-
if (disabled) {
|
|
53
|
-
return (0, jsx_runtime_1.jsx)(ServiceCard, { service: service, favorite: favorite, ...props, tabIndex: tabIndex });
|
|
54
|
-
}
|
|
55
51
|
return ((0, jsx_runtime_1.jsx)(drag_and_drop_1.DragGhost, { innerRef: setNodeRef, className: styles_module_scss_1.default.draggableCard, dragging: isDragging, mode: drag_and_drop_1.DRAG_MODE.Static, ...listeners, ...restAttributes, children: (0, jsx_runtime_1.jsx)(ServiceCard, { service: service, favorite: favorite, ...props, tabIndex: tabIndex }) }));
|
|
56
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseItemProps } from '@cloud-ru/ds-list';
|
|
1
|
+
import { BaseItemProps, ListProps } from '@cloud-ru/ds-list';
|
|
2
2
|
import { SearchProps as SearchPropsSnack } from '@cloud-ru/ds-search';
|
|
3
3
|
import { CardServiceLightProps } from '@cloud-ru/ds-uikit-product-card-predefined';
|
|
4
4
|
import { JSXElementConstructor, MouseEvent, ReactNode } from 'react';
|
|
@@ -19,7 +19,12 @@ export type InnerLink = {
|
|
|
19
19
|
* остаётся только первое по приоритету сегментов (см. {@link MainMenuProps.segments}).
|
|
20
20
|
*/
|
|
21
21
|
id: string;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Иконка карточки.
|
|
24
|
+
*
|
|
25
|
+
* Если не задана, вместо иконки рендерится `Avatar` с двухбуквенным текстом по `label`
|
|
26
|
+
* (см. `getAvatarNameFromLabel`).
|
|
27
|
+
*/
|
|
23
28
|
icon?: JSXElementConstructor<{
|
|
24
29
|
size?: number;
|
|
25
30
|
className?: string;
|
|
@@ -48,11 +53,9 @@ export type InnerLink = {
|
|
|
48
53
|
type TitleStatic = {
|
|
49
54
|
text: string;
|
|
50
55
|
onClick?: never;
|
|
51
|
-
href?: never;
|
|
52
56
|
};
|
|
53
57
|
type TitleClickable = {
|
|
54
58
|
text: string;
|
|
55
|
-
href?: string;
|
|
56
59
|
onClick?(e?: MouseEvent<HTMLElement>): void;
|
|
57
60
|
};
|
|
58
61
|
export type LinksGroupTitle = TitleStatic | TitleClickable;
|
|
@@ -68,10 +71,6 @@ export type LinksGroup = {
|
|
|
68
71
|
id: string;
|
|
69
72
|
/** Заголовок группы в сетке карточек и в боковой навигации. */
|
|
70
73
|
label: LinksGroupTitle;
|
|
71
|
-
icon?: JSXElementConstructor<{
|
|
72
|
-
size?: number;
|
|
73
|
-
className?: string;
|
|
74
|
-
}>;
|
|
75
74
|
/**
|
|
76
75
|
* Синонимы заголовка группы для fuzzy-поиска.
|
|
77
76
|
*/
|
|
@@ -203,16 +202,12 @@ export type MainMenuPreferencesProps = {
|
|
|
203
202
|
*/
|
|
204
203
|
showGroupsColors?: MainMenuToggleProps;
|
|
205
204
|
};
|
|
206
|
-
export type MainMenuSettingsItem = Pick<InnerLink, 'id' | 'label' | 'icon' | 'onClick' | 'href' | 'hidden'> & {
|
|
207
|
-
divider?: 'before' | 'after';
|
|
208
|
-
};
|
|
209
205
|
export type MainMenuProps = {
|
|
210
206
|
disabled?: boolean;
|
|
211
207
|
open?: boolean;
|
|
212
208
|
setOpen?(open: boolean): void;
|
|
213
209
|
logo?: ReactNode;
|
|
214
210
|
leftTop?: ReactNode;
|
|
215
|
-
leftBottom?: ReactNode;
|
|
216
211
|
rightTop?: ReactNode;
|
|
217
212
|
/**
|
|
218
213
|
* Сегменты правой панели (сетка карточек) — только каталог.
|
|
@@ -250,10 +245,10 @@ export type MainMenuProps = {
|
|
|
250
245
|
/**
|
|
251
246
|
* Пункты левой колонки (desktop) / нижней части списка (mobile).
|
|
252
247
|
*
|
|
253
|
-
* Плоский список (`
|
|
248
|
+
* Плоский список `List` (`BaseItem` и при необходимости `type: 'group'` с `divider` для разделителей).
|
|
254
249
|
* Не связан с сегментами правой панели и не меняется при сортировке групп в сегментах.
|
|
255
250
|
*/
|
|
256
|
-
settingItems?:
|
|
251
|
+
settingItems?: ListProps['items'];
|
|
257
252
|
/**
|
|
258
253
|
* Платформенные группы (например «Облачные продукты», «Другие продукты»).
|
|
259
254
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Формирует двухбуквенный текст для пропа `name` компонента Avatar в MainMenu.
|
|
3
|
+
*
|
|
4
|
+
* - Одно слово — первые две буквы в верхнем регистре (`Маркетплейс` → `МА`).
|
|
5
|
+
* - Два и более слов — первая буква первых двух слов (`Партнерский кабинет` → `ПК`).
|
|
6
|
+
*
|
|
7
|
+
* @param label — подпись карточки (`InnerLink.label`).
|
|
8
|
+
* @returns Строка из двух символов для отображения в аватаре.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* getAvatarNameFromLabel('Маркетплейс'); // 'МА'
|
|
12
|
+
* getAvatarNameFromLabel('Партнерский кабинет'); // 'ПК'
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAvatarNameFromLabel(label: string): string;
|