@cloud-ru/ds-uikit-product-header 1.1.6 → 1.1.7-preview-9b666394.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/README.md +61 -2
- 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.d.ts +1 -1
- package/dist/cjs/components/MainMenu/MainMenu.js +4 -4
- package/dist/cjs/components/MainMenu/helperComponents/Content/Content.js +9 -10
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/ContentToolbar/styles.module.css +1 -0
- 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 +8 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +4 -0
- package/dist/cjs/components/MainMenu/helperComponents/Content/styles.module.css +6 -2
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/MenuBottom.d.ts +8 -0
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/MenuBottom.js +16 -0
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/index.js +17 -0
- package/dist/cjs/components/MainMenu/helperComponents/MenuBottom/styles.module.css +13 -0
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.d.ts +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +4 -3
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +1 -5
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.d.ts +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +5 -4
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/styles.module.css +1 -2
- package/dist/cjs/components/MainMenu/helperComponents/ServiceCard/ServiceCard.js +5 -1
- package/dist/cjs/components/MainMenu/helperComponents/ServiceCard/styles.module.css +1 -0
- package/dist/cjs/components/MainMenu/types.d.ts +14 -9
- package/dist/cjs/components/MainMenu/utils/getLinkEmblem.d.ts +1 -1
- package/dist/cjs/components/MainMenu/utils/getLinkEmblem.js +1 -9
- package/dist/cjs/components/MainMenu/utils/index.d.ts +0 -1
- package/dist/cjs/components/MainMenu/utils/index.js +0 -1
- package/dist/cjs/components/PathBreadcrumbs/styles.module.css +3 -0
- package/dist/cjs/components/UserMenu/UserMenu.d.ts +2 -2
- package/dist/cjs/components/UserMenu/UserMenu.js +8 -4
- package/dist/cjs/constants.d.ts +3 -0
- package/dist/cjs/constants.js +5 -1
- package/dist/cjs/hooks/useMobileLayout.d.ts +1 -0
- package/dist/cjs/hooks/useMobileLayout.js +8 -0
- package/dist/cjs/style.css +31 -10
- 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.d.ts +1 -1
- package/dist/esm/components/MainMenu/MainMenu.js +4 -4
- package/dist/esm/components/MainMenu/helperComponents/Content/Content.js +10 -11
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/ContentToolbar/styles.module.css +1 -0
- 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 +8 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.css +4 -0
- package/dist/esm/components/MainMenu/helperComponents/Content/styles.module.css +6 -2
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/MenuBottom.d.ts +8 -0
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/MenuBottom.js +10 -0
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/index.js +1 -0
- package/dist/esm/components/MainMenu/helperComponents/MenuBottom/styles.module.css +13 -0
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.d.ts +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +4 -3
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/styles.module.css +1 -5
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.d.ts +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +7 -6
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/styles.module.css +1 -2
- package/dist/esm/components/MainMenu/helperComponents/ServiceCard/ServiceCard.js +5 -1
- package/dist/esm/components/MainMenu/helperComponents/ServiceCard/styles.module.css +1 -0
- package/dist/esm/components/MainMenu/types.d.ts +14 -9
- package/dist/esm/components/MainMenu/utils/getLinkEmblem.d.ts +1 -1
- package/dist/esm/components/MainMenu/utils/getLinkEmblem.js +1 -9
- package/dist/esm/components/MainMenu/utils/index.d.ts +0 -1
- package/dist/esm/components/MainMenu/utils/index.js +0 -1
- package/dist/esm/components/PathBreadcrumbs/styles.module.css +3 -0
- package/dist/esm/components/UserMenu/UserMenu.d.ts +2 -2
- package/dist/esm/components/UserMenu/UserMenu.js +9 -5
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.js +4 -0
- package/dist/esm/hooks/useMobileLayout.d.ts +1 -0
- package/dist/esm/hooks/useMobileLayout.js +5 -0
- package/dist/esm/style.css +31 -10
- 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 +4 -2
- package/src/components/MainMenu/helperComponents/Content/Content.tsx +12 -18
- package/src/components/MainMenu/helperComponents/Content/helperComponents/ContentToolbar/styles.module.scss +1 -0
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/SortableGroup.tsx +11 -8
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/components/SortableGroupHeader.tsx +28 -4
- package/src/components/MainMenu/helperComponents/Content/helperComponents/SortableGroup/styles.module.scss +18 -7
- package/src/components/MainMenu/helperComponents/Content/styles.module.scss +6 -2
- package/src/components/MainMenu/helperComponents/MenuBottom/MenuBottom.tsx +41 -0
- package/src/components/MainMenu/helperComponents/MenuBottom/index.ts +1 -0
- package/src/components/MainMenu/helperComponents/MenuBottom/styles.module.scss +15 -0
- package/src/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.tsx +4 -4
- package/src/components/MainMenu/helperComponents/MenuDesktop/styles.module.scss +1 -5
- package/src/components/MainMenu/helperComponents/MenuMobile/MenuMobile.tsx +15 -9
- package/src/components/MainMenu/helperComponents/MenuMobile/styles.module.scss +3 -2
- package/src/components/MainMenu/helperComponents/ServiceCard/ServiceCard.tsx +7 -1
- package/src/components/MainMenu/helperComponents/ServiceCard/styles.module.scss +1 -0
- package/src/components/MainMenu/types.ts +15 -9
- package/src/components/MainMenu/utils/getLinkEmblem.tsx +3 -18
- package/src/components/MainMenu/utils/index.ts +0 -1
- package/src/components/PathBreadcrumbs/styles.module.scss +4 -0
- package/src/components/UserMenu/UserMenu.tsx +13 -6
- package/src/constants.ts +5 -0
- package/src/hooks/useMobileLayout.ts +7 -0
- package/dist/cjs/components/MainMenu/utils/getAvatarNameFromLabel.d.ts +0 -14
- package/dist/cjs/components/MainMenu/utils/getAvatarNameFromLabel.js +0 -24
- package/dist/esm/components/MainMenu/utils/getAvatarNameFromLabel.d.ts +0 -14
- package/dist/esm/components/MainMenu/utils/getAvatarNameFromLabel.js +0 -21
- package/src/components/MainMenu/utils/getAvatarNameFromLabel.ts +0 -24
package/README.md
CHANGED
|
@@ -206,6 +206,7 @@ export function WithFavorites() {
|
|
|
206
206
|
| `disabled` | `boolean` | — | |
|
|
207
207
|
| `draggerTooltip` | `string` | — | Текст подсказки для драггера (desktop only) |
|
|
208
208
|
| `favorite` | `FavoriteProps` | — | |
|
|
209
|
+
| `leftBottom` | `ReactNode` | — | |
|
|
209
210
|
| `leftTop` | `ReactNode` | — | |
|
|
210
211
|
| `loading` | `boolean` | — | Флаг загрузки данных |
|
|
211
212
|
| `logo` | `ReactNode` | — | |
|
|
@@ -221,7 +222,7 @@ export function WithFavorites() {
|
|
|
221
222
|
| `segmentPrefs` | `MainMenuSegmentPrefs` | — | Пользовательские prefs сегментов (порядок / раскрытие групп). <br/> Нет записи для сегмента или omit `order` / `expanded` → uncontrolled для этого поля. |
|
|
222
223
|
| `segments` | `MainMenuSegment` | — | Сегменты правой панели (сетка карточек) — только каталог. <br/> При поиске: совпадения из сегментов без `pinBottomOnSearch` → `platformGroups` → сегменты с `pinBottomOnSearch`. <br/> Если один и тот же {@link InnerLink.id} совпал сразу в нескольких сегментах — остаётся только <br/> первое по этому приоритету вхождение, остальные (и опустевшие после этого группы) не показываются. <br/> При `segments.length > 1` показывается SegmentControl (скрывается во время поиска). <br/> Порядок и раскрытие групп — через `segmentPrefs` и колбэки ниже. |
|
|
223
224
|
| `setOpen` | `((open: boolean) => void)` | — | |
|
|
224
|
-
| `settingItems` | `
|
|
225
|
+
| `settingItems` | `InnerLink` \| `MainMenuSettingsItem` | — | Пункты левой колонки (desktop) / нижней части списка (mobile). <br/> Плоский список (`dividerBefore` для разделителей). <br/> Не связан с сегментами правой панели и не меняется при сортировке групп в сегментах. |
|
|
225
226
|
|
|
226
227
|
##### Related types
|
|
227
228
|
|
|
@@ -240,6 +241,24 @@ export function WithFavorites() {
|
|
|
240
241
|
| `segment` | `"favorites"` \| `"recent"` | — | Активный сегмент («Избранное» / «Недавнее») в панели избранного. <br/> Не передано — неуправляемое состояние (дефолт `'favorites'`). |
|
|
241
242
|
| `value` | `string[]` | — | Список id избранных сервисов |
|
|
242
243
|
|
|
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
|
+
|
|
243
262
|
**LinksGroup**
|
|
244
263
|
|
|
245
264
|
| Prop | Type | Default | Description |
|
|
@@ -249,11 +268,16 @@ export function WithFavorites() {
|
|
|
249
268
|
| `favoritesEnabled` | `boolean \| undefined` | — | Разрешено ли добавление карточек группы в избранное. |
|
|
250
269
|
| `hidden` | `boolean \| undefined` | — | |
|
|
251
270
|
| `highlight` | `boolean \| undefined` | — | Визуальное выделение группы |
|
|
271
|
+
| `icon` | `JSXElementConstructor<{ size?: number; className?: string; }> \| undefined` | — | |
|
|
252
272
|
| `id` | `string` | — | Уникальный идентификатор группы (якорь скролла, поиск по id). |
|
|
253
273
|
| `items` | `InnerLink` | — | Карточки сервисов или ссылок внутри группы. |
|
|
254
274
|
| `label` | `LinksGroupTitle` \| `TitleClickable` \| `TitleStatic` | — | Заголовок группы в сетке карточек и в боковой навигации. |
|
|
255
275
|
| `onClick` | `((e?: MouseEvent<HTMLElement>) => void) \| undefined` | — | |
|
|
256
276
|
|
|
277
|
+
- `LinksGroupBlockColor` = `"blue"` \| `"green"` \| `"neutral"` \| `"orange"` \| `"pink"` \| `"primary"` \| `"red"` \| `"violet"` \| `"yellow"`
|
|
278
|
+
|
|
279
|
+
- `LinksGroupTitle` = `TitleStatic | TitleClickable`
|
|
280
|
+
|
|
257
281
|
**MainMenuPreferencesProps**
|
|
258
282
|
|
|
259
283
|
| Prop | Type | Default | Description |
|
|
@@ -281,6 +305,25 @@ export function WithFavorites() {
|
|
|
281
305
|
| `id` | `string` | — | Id сегмента из <br/> {@link <br/> MainMenuSegment.id <br/> } <br/> . |
|
|
282
306
|
| `order` | `string[] \| undefined` | — | Порядок id групп. Если не передан — uncontrolled для этого сегмента <br/> (дефолт = порядок `items`; новые группы добавляются в конец). |
|
|
283
307
|
|
|
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
|
+
|
|
284
327
|
**SearchProps**
|
|
285
328
|
|
|
286
329
|
| Prop | Type | Default | Description |
|
|
@@ -291,6 +334,22 @@ export function WithFavorites() {
|
|
|
291
334
|
| `onSearchNoResult` | `((value: string) => void) \| undefined` | — | |
|
|
292
335
|
| `value` | `string` | — | |
|
|
293
336
|
|
|
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
|
+
|
|
294
353
|
## UserMenu
|
|
295
354
|
|
|
296
355
|
Меню пользователя — профиль, переключатель темы, пункты настроек и выход.
|
|
@@ -356,7 +415,7 @@ export function ControlledTheme() {
|
|
|
356
415
|
|
|
357
416
|
| Prop | Type | Default | Description |
|
|
358
417
|
|------|------|---------|-------------|
|
|
359
|
-
| `items` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `
|
|
418
|
+
| `items` | `BaseItemWithoutNonGroup` \| `CommonGroupItem` \| `DroplistProps` \| `ScrollProps` | — | |
|
|
360
419
|
| `onClick` | `(() => void)` | — | |
|
|
361
420
|
| `onLogout` | `(() => void)` | — | |
|
|
362
421
|
| `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");
|
|
9
8
|
const divider_1 = require("@cloud-ru/ds-divider");
|
|
10
9
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
11
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
12
11
|
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, useMobileLayout_1.useMobileLayout)();
|
|
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-available-borderColor, var(--sn-brand-color-state-neutralBorder-forLightMode-default-borderColor, rgba(159, 166, 198, 0.3019607843)));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.left{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MainMenuProps } from './types';
|
|
2
|
-
export declare function MainMenu({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, logo, leftTop, rightTop, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, disabled, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function MainMenu({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, logo, leftTop, leftBottom, rightTop, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, disabled, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,25 +2,25 @@
|
|
|
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");
|
|
6
5
|
const product_1 = require("@cloud-ru/ds-icons/interface/product");
|
|
7
6
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
8
7
|
const react_1 = require("react");
|
|
9
8
|
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");
|
|
13
13
|
const MenuMobile_1 = require("./helperComponents/MenuMobile");
|
|
14
|
-
function MainMenu({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, logo, leftTop, rightTop, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, disabled, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }) {
|
|
14
|
+
function MainMenu({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, logo, leftTop, leftBottom, rightTop, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, disabled, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }) {
|
|
15
15
|
const { t } = locale_1.headerLocale.useTranslations();
|
|
16
16
|
const [open = false, setOpen] = (0, utils_1.useValueControl)({ value: openProp, onChange: setOpenProp });
|
|
17
17
|
(0, react_1.useEffect)(() => {
|
|
18
18
|
if (!open && search?.value)
|
|
19
19
|
search?.onChange('');
|
|
20
20
|
}, [open, search]);
|
|
21
|
-
const isMobile = (0,
|
|
21
|
+
const isMobile = (0, useMobileLayout_1.useMobileLayout)();
|
|
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
|
-
}, "data-test-id": constants_1.TEST_IDS.mainMenu.drawerButton }), (0, jsx_runtime_1.jsx)(MenuComponent, { settingItems: settingItems, segments: segments, segmentPrefs: segmentPrefs, activeSegmentId: activeSegmentId, onActiveSegmentChange: onActiveSegmentChange, onSegmentOrderChange: onSegmentOrderChange, onSegmentExpandedChange: onSegmentExpandedChange, platformGroups: platformGroups, search: search, logo: logo, leftTop: leftTop, rightTop: rightTop, favorite: favorite, open: open, setOpen: setOpen, preferences: preferences, defaultWidth: defaultWidth, onWidthChangeEnd: onWidthChangeEnd, draggerTooltip: draggerTooltip, loading: loading })] }));
|
|
25
|
+
}, "data-test-id": constants_1.TEST_IDS.mainMenu.drawerButton }), (0, jsx_runtime_1.jsx)(MenuComponent, { settingItems: settingItems, segments: segments, segmentPrefs: segmentPrefs, activeSegmentId: activeSegmentId, onActiveSegmentChange: onActiveSegmentChange, onSegmentOrderChange: onSegmentOrderChange, onSegmentExpandedChange: onSegmentExpandedChange, platformGroups: platformGroups, search: search, logo: logo, leftTop: leftTop, leftBottom: leftBottom, rightTop: rightTop, favorite: favorite, open: open, setOpen: setOpen, preferences: preferences, defaultWidth: defaultWidth, onWidthChangeEnd: onWidthChangeEnd, draggerTooltip: draggerTooltip, loading: loading })] }));
|
|
26
26
|
}
|
|
@@ -25,8 +25,7 @@ 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
|
|
29
|
-
const defaultSegmentId = visibleSegments[0]?.id ?? segments[0]?.id ?? '';
|
|
28
|
+
const defaultSegmentId = activeSegmentId ?? segments[0]?.id ?? '';
|
|
30
29
|
const [segmentId = defaultSegmentId, setSegmentId] = (0, utils_1.useValueControl)({
|
|
31
30
|
value: activeSegmentId,
|
|
32
31
|
defaultValue: defaultSegmentId,
|
|
@@ -35,10 +34,10 @@ function Content({ searchValue, search, rightTop, segments, searchGroups = [], s
|
|
|
35
34
|
const isSearching = Boolean(searchValue);
|
|
36
35
|
const enableServiceDrag = Boolean(favorite) && !isMobile && !isSearching;
|
|
37
36
|
(0, react_1.useEffect)(() => {
|
|
38
|
-
if (!
|
|
37
|
+
if (!segments.some(segment => segment.id === segmentId) && defaultSegmentId) {
|
|
39
38
|
setSegmentId(defaultSegmentId);
|
|
40
39
|
}
|
|
41
|
-
}, [defaultSegmentId, segmentId, setSegmentId,
|
|
40
|
+
}, [defaultSegmentId, segmentId, setSegmentId, segments]);
|
|
42
41
|
const handleLinkClick = (0, react_1.useCallback)(({ disabled, onClick }, e) => {
|
|
43
42
|
if (disabled) {
|
|
44
43
|
e?.preventDefault();
|
|
@@ -79,23 +78,23 @@ function Content({ searchValue, search, rightTop, segments, searchGroups = [], s
|
|
|
79
78
|
}
|
|
80
79
|
onExpandedChange([...new Set([...expandedIds, ...visibleIds])]);
|
|
81
80
|
}, [allGroupsExpanded, expandedIds, onExpandedChange, visibleGroups]);
|
|
82
|
-
const segmentItems = (0, react_1.useMemo)(() =>
|
|
81
|
+
const segmentItems = (0, react_1.useMemo)(() => segments.map(segment => ({
|
|
83
82
|
value: segment.id,
|
|
84
83
|
label: segment.label,
|
|
85
84
|
icon: segment.icon,
|
|
86
|
-
})), [
|
|
85
|
+
})), [segments]);
|
|
87
86
|
const hasCards = visibleGroups.length > 0;
|
|
88
87
|
const cards = (() => {
|
|
89
88
|
if (loading) {
|
|
90
89
|
return Array.from({ length: 5 }).map((_, index) => (0, jsx_runtime_1.jsx)(SortableGroup_1.SortableGroupSkeleton, { isMobile: isMobile }, index));
|
|
91
90
|
}
|
|
92
91
|
if (hasCards) {
|
|
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))) }) }));
|
|
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, icon, items, favoritesEnabled = true, blockColor, highlight }) => ((0, jsx_runtime_1.jsx)(SortableGroup_1.SortableGroup, { id: id, icon: icon, 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))) }) }));
|
|
94
93
|
}
|
|
95
94
|
return ((0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, { size: 'm', icon: {
|
|
96
|
-
icon: system_1.SearchSVG,
|
|
95
|
+
icon: isSearching ? system_1.SearchSVG : system_1.CrossSVG,
|
|
97
96
|
appearance: 'neutral',
|
|
98
|
-
}, content: isSearching ? t('noDataFound') : t('noData'), "data-test-id": isSearching ? constants_1.TEST_IDS.noDataFound : constants_1.TEST_IDS.noData }));
|
|
97
|
+
}, 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 }));
|
|
99
98
|
})();
|
|
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-
|
|
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-empty": (!loading && !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] })] }));
|
|
101
100
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { LinksGroupBlockColor, LinksGroupTitle } from '../../../../types';
|
|
1
|
+
import { LinksGroup, LinksGroupBlockColor, LinksGroupTitle } from '../../../../types';
|
|
2
2
|
import { SortableGroupCardsProps } from './components';
|
|
3
|
-
export type SortableGroupProps = Omit<SortableGroupCardsProps, 'groupId'> & {
|
|
3
|
+
export type SortableGroupProps = Omit<SortableGroupCardsProps, 'groupId'> & Pick<LinksGroup, 'icon'> & {
|
|
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, label, items, isExpanded, showDescription, isMobile, enableServiceDrag, favorite, onServiceClick, blockColor, highlight, }: SortableGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function SortableGroup({ id, icon, 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, label, items, isExpanded, showDescription, isMobile, enableServiceDrag, favorite, onServiceClick, blockColor, highlight, }) {
|
|
17
|
+
function SortableGroup({ id, icon, 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, label, items, isExpanded, showDescription, isMobile
|
|
|
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, 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 }) })] }));
|
|
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, icon: icon, 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 { LinksGroupTitle } from '../../../../../types';
|
|
1
|
+
import { LinksGroup, LinksGroupTitle } from '../../../../../types';
|
|
2
2
|
import { SortableGroupDragHandleProps } from './SortableGroupDragHandle';
|
|
3
|
-
export type SortableGroupHeaderProps = {
|
|
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
|
} & SortableGroupDragHandleProps;
|
|
9
|
-
export declare function SortableGroupHeader({ label, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }: SortableGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SortableGroupHeader({ label, icon, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }: SortableGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,8 +8,14 @@ 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");
|
|
11
13
|
const styles_module_scss_1 = __importDefault(require('../styles.module.css'));
|
|
12
14
|
const SortableGroupDragHandle_1 = require("./SortableGroupDragHandle");
|
|
13
|
-
function SortableGroupHeader({ label, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }) {
|
|
14
|
-
|
|
15
|
+
function SortableGroupHeader({ label, icon, isExpanded, enableServiceDrag, attributes, listeners, isMobile, }) {
|
|
16
|
+
const handleLabelClick = e => {
|
|
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' }))] }))] }));
|
|
15
21
|
}
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
overflow-x:clip;
|
|
51
51
|
display:flex;
|
|
52
52
|
flex-direction:column;
|
|
53
|
+
width:100%;
|
|
53
54
|
min-width:0;
|
|
54
55
|
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);
|
|
55
56
|
border-radius:var(--sn-density-radius-2xs, var(--sn-primitive-dimension-4, 4px));
|
|
@@ -115,6 +116,9 @@
|
|
|
115
116
|
.groupBody[data-mobile]{
|
|
116
117
|
grid-template-columns:repeat(1, minmax(200px, 1fr));
|
|
117
118
|
}
|
|
119
|
+
.groupBody[data-subcategory-body]{
|
|
120
|
+
padding-bottom:var(--sn-primitive-dimension-4, 4px);
|
|
121
|
+
}
|
|
118
122
|
|
|
119
123
|
.decoration{
|
|
120
124
|
--highlight-border-width:1px;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MainMenuSettingsItem } from '../../types';
|
|
3
|
+
type MenuBottomProps = {
|
|
4
|
+
settingItems?: MainMenuSettingsItem[];
|
|
5
|
+
leftBottom: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function MenuBottom({ settingItems, leftBottom }: MenuBottomProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MenuBottom = MenuBottom;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const divider_1 = require("@cloud-ru/ds-divider");
|
|
9
|
+
const uikit_product_card_predefined_1 = require("@cloud-ru/ds-uikit-product-card-predefined");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const constants_1 = require("../../../../constants");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
|
+
function MenuBottom({ settingItems, leftBottom }) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.bottom, "data-test-id": constants_1.TEST_IDS.mainMenu.leftBottom, children: [Boolean(settingItems?.length) && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bottomItems, "data-test-id": constants_1.TEST_IDS.mainMenu.leftBottomItems, children: settingItems?.map(item => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [item.divider === 'before' && (0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'horizontal', className: styles_module_scss_1.default.bottomDivider }), (0, jsx_runtime_1.jsx)(uikit_product_card_predefined_1.CardServiceLight, { ...(item.href ? { href: item.href, as: 'a' } : { as: 'button', type: 'button' }), title: item.label, icon: (0, utils_1.getLinkEmblem)(item), onClick: item.onClick, "data-test-id": `header__drawer-menu__setting-${item.id}` }), item.divider === 'after' && (0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'horizontal', className: styles_module_scss_1.default.bottomDivider })] }, item.id))) })), leftBottom] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MenuBottom';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MenuBottom"), exports);
|
|
@@ -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, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, logo, rightTop, leftTop, leftBottom, defaultWidth, onWidthChangeEnd, draggerTooltip, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,6 @@ 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");
|
|
11
10
|
const scroll_1 = require("@cloud-ru/ds-scroll");
|
|
12
11
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
13
12
|
const react_1 = require("react");
|
|
@@ -16,12 +15,13 @@ const useMainMenuDnd_1 = require("../../hooks/useMainMenuDnd");
|
|
|
16
15
|
const useMenuItems_1 = require("../../hooks/useMenuItems");
|
|
17
16
|
const Content_1 = require("../Content");
|
|
18
17
|
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, defaultWidth = constants_2.MENU_WIDTH_MAX, onWidthChangeEnd, draggerTooltip, loading, }) {
|
|
24
|
+
function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, preferences, logo, rightTop, leftTop, leftBottom, 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,6 +41,7 @@ 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);
|
|
44
45
|
const allServiceGroups = (0, react_1.useMemo)(() => segments?.flatMap(segment => segment.items) ?? [], [segments]);
|
|
45
46
|
const mainMenuDnd = (0, useMainMenuDnd_1.useMainMenuDnd)({
|
|
46
47
|
favorite,
|
|
@@ -50,7 +51,7 @@ function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platf
|
|
|
50
51
|
const handleCloseDrawer = (0, react_1.useCallback)(() => {
|
|
51
52
|
setOpen(false);
|
|
52
53
|
}, [setOpen]);
|
|
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 }),
|
|
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 }), hasBottomItems && (0, jsx_runtime_1.jsx)(MenuBottom_1.MenuBottom, { settingItems: settingItems, leftBottom: leftBottom })] }), 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 }) }) })] }))] })] }));
|
|
54
55
|
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
|
|
55
56
|
? {
|
|
56
57
|
min: constants_2.MENU_WIDTH_MIN,
|
|
@@ -43,11 +43,6 @@
|
|
|
43
43
|
min-height:0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.settingItems{
|
|
47
|
-
flex-shrink:0;
|
|
48
|
-
height:auto;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
46
|
.right{
|
|
52
47
|
position:relative;
|
|
53
48
|
display:flex;
|
|
@@ -63,6 +58,7 @@
|
|
|
63
58
|
display:flex;
|
|
64
59
|
flex-direction:column;
|
|
65
60
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
61
|
+
width:100%;
|
|
66
62
|
min-width:0;
|
|
67
63
|
padding:var(--sn-primitive-dimension-16, 16px);
|
|
68
64
|
}
|
|
@@ -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, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, logo, rightTop, leftTop, leftBottom, loading, }: MainMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +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
|
|
8
|
+
const divider_1 = require("@cloud-ru/ds-divider");
|
|
9
9
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
10
10
|
const react_1 = require("react");
|
|
11
11
|
const constants_1 = require("../../../../constants");
|
|
@@ -14,15 +14,16 @@ const useMainMenuDnd_1 = require("../../hooks/useMainMenuDnd");
|
|
|
14
14
|
const useMenuItems_1 = require("../../hooks/useMenuItems");
|
|
15
15
|
const Content_1 = require("../Content");
|
|
16
16
|
const Favorites_1 = require("../Favorites");
|
|
17
|
+
const MenuBottom_1 = require("../MenuBottom");
|
|
17
18
|
const MenuHeaderBrand_1 = require("../MenuHeaderBrand");
|
|
18
19
|
const MountAnimation_1 = require("../MountAnimation");
|
|
19
20
|
const ScrollWithAnimatedStickyPanel_1 = require("../ScrollWithAnimatedStickyPanel");
|
|
20
21
|
const Search_1 = require("../Search");
|
|
21
22
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
22
|
-
|
|
23
|
-
function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, logo, rightTop, leftTop, loading, }) {
|
|
23
|
+
function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platformGroups, segments, segmentPrefs, activeSegmentId, onActiveSegmentChange, onSegmentOrderChange, onSegmentExpandedChange, favorite, search, logo, rightTop, leftTop, leftBottom, loading, }) {
|
|
24
24
|
const [open = false, setOpen] = (0, utils_1.useValueControl)({ value: openProp, onChange: setOpenProp });
|
|
25
25
|
const hasSegments = segments && segments.some(segment => segment.items.length > 0);
|
|
26
|
+
const hasBottomItems = Boolean(settingItems?.length) || Boolean(leftBottom);
|
|
26
27
|
const isSearching = Boolean(search?.value);
|
|
27
28
|
const { searchRef, resultItems } = (0, useMenuItems_1.useMenuItems)({
|
|
28
29
|
segments,
|
|
@@ -33,5 +34,5 @@ function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platfo
|
|
|
33
34
|
const handleClose = (0, react_1.useCallback)(() => {
|
|
34
35
|
setOpen(false);
|
|
35
36
|
}, [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:
|
|
37
|
+
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: constants_1.BOTTOM_SHEET_FULLSCREEN_SNAP_POINTS, disableMotions: true, children: (0, jsx_runtime_1.jsx)(ScrollWithAnimatedStickyPanel_1.ScrollWithAnimatedStickyPanel, { panel: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(MenuHeaderBrand_1.MenuHeaderBrand, { logo: logo, onClose: handleClose, className: styles_module_scss_1.default.menuHeader }), (0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'horizontal' })] }), children: (0, jsx_runtime_1.jsxs)(MountAnimation_1.MountAnimation, { className: styles_module_scss_1.default.scrollMobile, type: 'fade-slide-up', children: [leftTop && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.rightContent, children: leftTop }), search && (0, jsx_runtime_1.jsx)(Search_1.Search, { ...search, ref: searchRef, isMobile: true }), !isSearching && favorite && (0, jsx_runtime_1.jsx)(Favorites_1.Favorites, { favorite: favorite, allServiceGroups: allServiceGroups, isMobile: true }), 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 && hasBottomItems && (0, jsx_runtime_1.jsx)(MenuBottom_1.MenuBottom, { settingItems: settingItems, leftBottom: leftBottom })] }) }) }));
|
|
37
38
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
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-neutral-decor, var(--sn-brand-color-neutral-80, var(--sn-primitive-color-gray-80, #e3e5ed)));
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
.rightContent{
|
|
@@ -20,6 +19,6 @@
|
|
|
20
19
|
flex-direction:column;
|
|
21
20
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
22
21
|
min-height:100%;
|
|
23
|
-
margin-top:var(--sn-primitive-dimension-40, 40px);
|
|
22
|
+
margin-top:calc(var(--sn-primitive-dimension-40, 40px) + var(--sn-divider-anatomy-container-height, var(--sn-primitive-dimension-1, 1px)));
|
|
24
23
|
padding:var(--sn-primitive-dimension-16, 16px);
|
|
25
24
|
}
|
|
@@ -43,10 +43,14 @@ 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);
|
|
46
47
|
const { attributes, listeners, setNodeRef, isDragging } = (0, core_1.useDraggable)({
|
|
47
48
|
id: (0, utils_1.getServiceSourceDragId)(groupId, service.id),
|
|
48
|
-
disabled
|
|
49
|
+
disabled,
|
|
49
50
|
});
|
|
50
51
|
const { tabIndex, ...restAttributes } = attributes ?? {};
|
|
52
|
+
if (disabled) {
|
|
53
|
+
return (0, jsx_runtime_1.jsx)(ServiceCard, { service: service, favorite: favorite, ...props, tabIndex: tabIndex });
|
|
54
|
+
}
|
|
51
55
|
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 }) }));
|
|
52
56
|
}
|