@cloud-ru/ds-uikit-product-header-legacy 1.0.2-preview-2df639a4.0 → 1.0.3
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 +4 -4
- package/dist/cjs/components/HeaderLayout/HeaderLayout.js +1 -2
- package/dist/cjs/components/Logo/Logo.js +1 -1
- package/dist/cjs/components/MainMenu/constants.d.ts +0 -14
- package/dist/cjs/components/MainMenu/constants.js +0 -14
- package/dist/cjs/components/MainMenu/helperComponents/Content/Content.js +2 -2
- package/dist/cjs/components/MainMenu/helperComponents/Content/constants.d.ts +0 -1
- package/dist/cjs/components/MainMenu/helperComponents/Content/constants.js +0 -2
- package/dist/cjs/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +1 -1
- package/dist/cjs/components/MainMenu/helperComponents/NavigationSearch/NavigationSearch.js +2 -6
- package/dist/cjs/components/MainMenu/helperComponents/ServicesCategory/ServicesCategory.js +3 -3
- package/dist/cjs/components/MainMenu/types.d.ts +2 -3
- package/dist/cjs/components/MainMenu/utils/getLinkEmblem.js +5 -8
- package/dist/cjs/components/PlatformLogo/PlatformLogo.js +3 -3
- package/dist/cjs/components/PlatformLogo/constants.d.ts +0 -1
- package/dist/cjs/components/PlatformLogo/constants.js +0 -1
- package/dist/esm/components/HeaderLayout/HeaderLayout.js +1 -2
- package/dist/esm/components/Logo/Logo.js +1 -1
- package/dist/esm/components/MainMenu/constants.d.ts +0 -14
- package/dist/esm/components/MainMenu/constants.js +0 -14
- package/dist/esm/components/MainMenu/helperComponents/Content/Content.js +2 -2
- package/dist/esm/components/MainMenu/helperComponents/Content/constants.d.ts +0 -1
- package/dist/esm/components/MainMenu/helperComponents/Content/constants.js +0 -2
- package/dist/esm/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.js +1 -1
- package/dist/esm/components/MainMenu/helperComponents/MenuMobile/MenuMobile.js +1 -1
- package/dist/esm/components/MainMenu/helperComponents/NavigationSearch/NavigationSearch.js +2 -6
- package/dist/esm/components/MainMenu/helperComponents/ServicesCategory/ServicesCategory.js +3 -3
- package/dist/esm/components/MainMenu/types.d.ts +2 -3
- package/dist/esm/components/MainMenu/utils/getLinkEmblem.js +5 -8
- package/dist/esm/components/PlatformLogo/PlatformLogo.js +3 -3
- package/dist/esm/components/PlatformLogo/constants.d.ts +0 -1
- package/dist/esm/components/PlatformLogo/constants.js +0 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/HeaderLayout/HeaderLayout.tsx +4 -5
- package/src/components/Logo/Logo.tsx +1 -1
- package/src/components/MainMenu/constants.ts +0 -14
- package/src/components/MainMenu/helperComponents/Content/Content.tsx +3 -16
- package/src/components/MainMenu/helperComponents/Content/constants.ts +0 -3
- package/src/components/MainMenu/helperComponents/MenuDesktop/MenuDesktop.tsx +2 -9
- package/src/components/MainMenu/helperComponents/MenuMobile/MenuMobile.tsx +3 -3
- package/src/components/MainMenu/helperComponents/NavigationSearch/NavigationSearch.tsx +3 -12
- package/src/components/MainMenu/helperComponents/ServicesCategory/ServicesCategory.tsx +3 -3
- package/src/components/MainMenu/types.ts +4 -7
- package/src/components/MainMenu/utils/getLinkEmblem.tsx +9 -30
- package/src/components/PlatformLogo/PlatformLogo.tsx +3 -5
- package/src/components/PlatformLogo/constants.ts +0 -1
- package/dist/cjs/constants.d.ts +0 -3
- package/dist/cjs/constants.js +0 -6
- package/dist/esm/constants.d.ts +0 -3
- package/dist/esm/constants.js +0 -3
- package/src/constants.ts +0 -3
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ export function Minimal() {
|
|
|
148
148
|
|------|------|---------|-------------|
|
|
149
149
|
| `breadcrumbs` | `ReactNode` | — | Хлебные крошки. |
|
|
150
150
|
| `className` | `string` | — | CSS-класс корневого элемента. |
|
|
151
|
-
| `data-test-id` | `string` | — |
|
|
151
|
+
| `data-test-id` | `string` | — | |
|
|
152
152
|
| `isMobile` | `boolean` | `false` | Переносит хлебные крошки под основную строку и скрывает селектор. |
|
|
153
153
|
| `logo` | `ReactNode` | — | Логотип платформы. |
|
|
154
154
|
| `menu` | `ReactNode` | — | Главное меню. |
|
|
@@ -232,7 +232,7 @@ export function CustomHref() {
|
|
|
232
232
|
| Prop | Type | Default | Description |
|
|
233
233
|
|------|------|---------|-------------|
|
|
234
234
|
| `className` | `string` | — | CSS-класс корневой кнопки. |
|
|
235
|
-
| `data-test-id` | `string` | — |
|
|
235
|
+
| `data-test-id` | `string` | — | |
|
|
236
236
|
| `href` | `string` | — | Ссылка логотипа. |
|
|
237
237
|
| `loading` | `boolean` | `false` | Состояние загрузки (spinner Button). |
|
|
238
238
|
| `mode` | `"develop"` \| `"hybrid"` \| `"prod"` \| `"stage"` | — | Окружение: влияет на вариант брендового логотипа (legacy-extension). |
|
|
@@ -543,7 +543,7 @@ function HeaderMainMenu() {
|
|
|
543
543
|
| Prop | Type | Default | Description |
|
|
544
544
|
|------|------|---------|-------------|
|
|
545
545
|
| `customMobileMenu` | `ReactNode` | — | Только mobile: заменяет legacy `MenuMobile` (левый drawer). <br/> Например, `MenuMobile` из `@cloud-ru/ds-uikit-product-header` (bottom sheet). <br/> Передавайте те же `open` / `setOpen`, что и в `MainMenu` (controlled), иначе триггер и кастомное меню разойдутся. |
|
|
546
|
-
| `data-test-id` | `string` | — |
|
|
546
|
+
| `data-test-id` | `string` | — | |
|
|
547
547
|
| `disabled` | `boolean` | — | |
|
|
548
548
|
| `favorite` | `{ value: string[]; onChange: (productId: string) => (addingValue: boolean) => void; }` | — | |
|
|
549
549
|
| `leftTop` | `ReactNode` | — | |
|
|
@@ -699,7 +699,7 @@ export function AvatarName() {
|
|
|
699
699
|
| `avatarName` | `string` | — | Имя для Avatar в trigger (Figma mobile project selector). <br/> При наличии рендерится Avatar вместо SVG-иконки платформы. |
|
|
700
700
|
| `className` | `string` | — | CSS-класс корневого элемента. |
|
|
701
701
|
| `compact` | `boolean` | `false` | Компактный размер для пунктов Droplist (Figma listItem icon без padding, 24×24). |
|
|
702
|
-
| `data-test-id` | `string` | — |
|
|
702
|
+
| `data-test-id` | `string` | — | |
|
|
703
703
|
| `variant` | `"advanced"` \| `"evolution"` \| `"marketplace"` \| `"partner"` \| `"vmware"` | `evolution` | Вариант платформы (Figma `platformSelectorIcons` / variant). |
|
|
704
704
|
|
|
705
705
|
##### Related types
|
|
@@ -8,8 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const divider_1 = require("@cloud-ru/ds-divider");
|
|
9
9
|
const utils_1 = require("@cloud-ru/ds-utils");
|
|
10
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
|
-
const constants_1 = require("../../constants");
|
|
12
11
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
13
12
|
function HeaderLayout({ menu, logo, select, breadcrumbs, toolbar, className, isMobile = false, ...rest }) {
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)("header", { className: (0, classnames_1.default)(styles_module_scss_1.default.header, className), "data-mobile": isMobile || undefined, ...(0, utils_1.extractSupportProps)(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: [menu, logo, !isMobile && select && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, {
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("header", { className: (0, classnames_1.default)(styles_module_scss_1.default.header, className), "data-mobile": isMobile || undefined, ...(0, utils_1.extractSupportProps)(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: [menu, logo, !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.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bottom, children: breadcrumbs }), (0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'horizontal' })] }))] }));
|
|
15
14
|
}
|
|
@@ -42,5 +42,5 @@ function Logo({ path, loading = false, mode, href, onClick, className, ...rest }
|
|
|
42
42
|
}
|
|
43
43
|
return ((0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.icon, "data-test-id": constants_1.TEST_IDS.icon, children: resolveModeIcon(mode) }));
|
|
44
44
|
}, [error, mode, path]);
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(button_1.Button, { as: 'a', appearance: 'neutral', view: 'simple', size: 'm', href: href, onClick: onClick, loading: loading, icon: icon, className: className, "data-mode": mode,
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(button_1.Button, { as: 'a', appearance: 'neutral', view: 'simple', size: 'm', href: href, onClick: onClick, loading: loading, icon: icon, className: className, "data-mode": mode, "data-test-id": constants_1.TEST_IDS.root, ...(0, utils_1.extractSupportProps)(rest) }));
|
|
46
46
|
}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
export declare const TEST_IDS: {
|
|
2
|
-
readonly linkEmblem: "main-menu__link-emblem";
|
|
3
|
-
readonly contentInfoBlock: "content__info-block";
|
|
4
|
-
readonly navigationSearchDroplist: "navigation-search__droplist";
|
|
5
|
-
readonly contentNoDataIconPredefined: "content__no-data-icon-predefined";
|
|
6
|
-
readonly navigationSearchItems: "navigation-search__items";
|
|
7
|
-
readonly contentServicesCategory: "content__services-category";
|
|
8
|
-
readonly menuDesktopNavigationSearch: "menu-desktop__navigation-search";
|
|
9
|
-
readonly menuDesktopScroll: "menu-desktop__scroll";
|
|
10
|
-
readonly menuMobileHeader: "menu-mobile__header";
|
|
11
|
-
readonly menuMobileScrollBody: "menu-mobile__scroll-body";
|
|
12
|
-
readonly menuMobileNavigationSearch: "menu-mobile__navigation-search";
|
|
13
|
-
readonly navigationSearchSettingsSectionDivider: "navigation-search__settings-section-divider";
|
|
14
|
-
readonly servicesCategorySimpleTitle: "services-category__simple-title";
|
|
15
|
-
readonly getLinkEmblemAvatar: "get-link-emblem__avatar";
|
|
16
2
|
readonly trigger: "header__drawer-menu-button";
|
|
17
3
|
readonly drawer: "header__drawer-menu";
|
|
18
4
|
readonly drawerMobile: "header__drawer-menu-mobile";
|
|
@@ -2,20 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LEFT_COLUMN_WIDTH = exports.DEFAULT_DRAWER_WIDTH = exports.TEST_IDS = void 0;
|
|
4
4
|
exports.TEST_IDS = {
|
|
5
|
-
linkEmblem: 'main-menu__link-emblem',
|
|
6
|
-
contentInfoBlock: 'content__info-block',
|
|
7
|
-
navigationSearchDroplist: 'navigation-search__droplist',
|
|
8
|
-
contentNoDataIconPredefined: 'content__no-data-icon-predefined',
|
|
9
|
-
navigationSearchItems: 'navigation-search__items',
|
|
10
|
-
contentServicesCategory: 'content__services-category',
|
|
11
|
-
menuDesktopNavigationSearch: 'menu-desktop__navigation-search',
|
|
12
|
-
menuDesktopScroll: 'menu-desktop__scroll',
|
|
13
|
-
menuMobileHeader: 'menu-mobile__header',
|
|
14
|
-
menuMobileScrollBody: 'menu-mobile__scroll-body',
|
|
15
|
-
menuMobileNavigationSearch: 'menu-mobile__navigation-search',
|
|
16
|
-
navigationSearchSettingsSectionDivider: 'navigation-search__settings-section-divider',
|
|
17
|
-
servicesCategorySimpleTitle: 'services-category__simple-title',
|
|
18
|
-
getLinkEmblemAvatar: 'get-link-emblem__avatar',
|
|
19
5
|
trigger: 'header__drawer-menu-button',
|
|
20
6
|
drawer: 'header__drawer-menu',
|
|
21
7
|
drawerMobile: 'header__drawer-menu-mobile',
|
|
@@ -31,7 +31,7 @@ function Content({ searchValue, banners, serviceGroups, className, favorite, isM
|
|
|
31
31
|
onClick?.(e);
|
|
32
32
|
cb?.();
|
|
33
33
|
}, [onClose]);
|
|
34
|
-
const cards = (0, react_2.useMemo)(() => serviceGroups?.map(({ id, label, items, favoritesEnabled = true, highlight }) => ((0, jsx_runtime_1.jsx)("div", { id: id, "data-test-id": constants_1.TEST_IDS.groupCard(String(id)), children: (0, jsx_runtime_1.jsx)(ServicesCategory_1.ServicesCategory, {
|
|
34
|
+
const cards = (0, react_2.useMemo)(() => serviceGroups?.map(({ id, label, items, favoritesEnabled = true, highlight }) => ((0, jsx_runtime_1.jsx)("div", { id: id, "data-test-id": constants_1.TEST_IDS.groupCard(String(id)), children: (0, jsx_runtime_1.jsx)(ServicesCategory_1.ServicesCategory, { title: label.text, onTitleClick: label.onClick, highlight: highlight, children: items.map(service => ((0, react_1.createElement)(uikit_product_card_predefined_1.CardServiceLight, { ...(service.href ? { href: service.href, as: 'a' } : { as: 'button', type: 'button' }), key: String(id) + service.id, title: service.label, disabled: service.disabled, icon: (0, utils_1.getLinkEmblem)(service), "data-test-id": constants_1.TEST_IDS.link(service.id), onClick: wrappedClick(service, () => onLinkChange?.(service.id)), favorite: favorite && favoritesEnabled
|
|
35
35
|
? {
|
|
36
36
|
enabled: !service.disabled,
|
|
37
37
|
checked: favorite.value.includes(service.id),
|
|
@@ -39,5 +39,5 @@ function Content({ searchValue, banners, serviceGroups, className, favorite, isM
|
|
|
39
39
|
}
|
|
40
40
|
: undefined, actionsVisibility: isMobile ? uikit_product_card_predefined_1.VISIBILITY_STRATEGY.always : uikit_product_card_predefined_1.VISIBILITY_STRATEGY.hover, promoTag: service.badge, className: styles_module_scss_1.default.card }))) }) }, String(id)))), [favorite, isMobile, onLinkChange, serviceGroups, wrappedClick]);
|
|
41
41
|
const hasGroups = Boolean(serviceGroups?.length);
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), children: [!searchValue && banners ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.banners, "data-mobile": isMobile || undefined, "data-test-id": constants_1.TEST_IDS.banners, children: banners })) : null, (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.services, "data-test-id": constants_1.TEST_IDS.services, children: cards }), !hasGroups && !searchValue && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noData, "data-test-id": constants_1.TEST_IDS.noData, children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, {
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), children: [!searchValue && banners ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.banners, "data-mobile": isMobile || undefined, "data-test-id": constants_1.TEST_IDS.banners, children: banners })) : null, (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.services, "data-test-id": constants_1.TEST_IDS.services, children: cards }), !hasGroups && !searchValue && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noData, "data-test-id": constants_1.TEST_IDS.noData, children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, { content: t('mainMenu.noData'), icon: constants_2.NO_DATA_ICON_PREDEFINED_PROPS }) })), !hasGroups && searchValue && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noData, "data-test-id": constants_1.TEST_IDS.noDataFound, children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, { content: t('mainMenu.noDataFound'), icon: constants_2.NO_DATA_ICON_PREDEFINED_PROPS }) }))] }));
|
|
43
43
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const NO_DATA_ICON_PREDEFINED_PROPS: {
|
|
2
|
-
'data-test-id': "content__no-data-icon-predefined";
|
|
3
2
|
icon: import("react").ForwardRefExoticComponent<Omit<import("@cloud-ru/ds-icons").ISvgIconProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
4
3
|
appearance: "neutral";
|
|
5
4
|
};
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NO_DATA_ICON_PREDEFINED_PROPS = void 0;
|
|
4
4
|
const icon_predefined_1 = require("@cloud-ru/ds-icon-predefined");
|
|
5
5
|
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
6
|
-
const constants_1 = require("../../constants");
|
|
7
6
|
exports.NO_DATA_ICON_PREDEFINED_PROPS = {
|
|
8
|
-
'data-test-id': constants_1.TEST_IDS.contentNoDataIconPredefined,
|
|
9
7
|
icon: system_1.SearchSVG,
|
|
10
8
|
appearance: icon_predefined_1.APPEARANCE.Neutral,
|
|
11
9
|
};
|
|
@@ -59,5 +59,5 @@ function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems, platf
|
|
|
59
59
|
const hasBottomItems = Boolean(settingItems?.items.length) || Boolean(sidebarBottomSlot);
|
|
60
60
|
const searchValue = search?.searchValue;
|
|
61
61
|
const showSearch = Boolean(search) && !isInitialEmptyCards && (resultItems.length > 0 || Boolean(searchValue));
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)(drawer_1.DrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: isNeedRightBlock ? constants_1.DEFAULT_DRAWER_WIDTH : constants_1.LEFT_COLUMN_WIDTH, showButtonClosed: false, className: styles_module_scss_1.default.drawer, "data-test-id": constants_1.TEST_IDS.drawer, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menu, "data-test-id": constants_1.TEST_IDS.content, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.left, "data-test-id": constants_1.TEST_IDS.left, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftTop, "data-test-id": constants_1.TEST_IDS.leftTop, children: leftTop }), !isInitialEmptyCards ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftMain, children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { className: styles_module_scss_1.default.leftMainScroll, overflow: { x: 'hidden' }, barHideStrategy: 'never', "data-test-id": constants_1.TEST_IDS.leftNavList, size: 's', children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.items, children: navGroupItems.map(item => ((0, jsx_runtime_1.jsx)(uikit_product_card_predefined_1.CardServiceLight, { as: 'button', type: 'button', title: item.label, onClick: item.onClick, truncate: { title: 2 }, className: styles_module_scss_1.default.item, "data-test-id": constants_1.TEST_IDS.navGroup(item.id) }, item.id))) }) }) })) : null, !leftTop && isInitialEmptyCards ? (0, jsx_runtime_1.jsx)("div", {}) : null, hasBottomItems ? ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.leftBottom, "data-test-id": constants_1.TEST_IDS.leftBottom, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftBottomDivider, children: (0, jsx_runtime_1.jsx)(divider_1.Divider, {
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(drawer_1.DrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: isNeedRightBlock ? constants_1.DEFAULT_DRAWER_WIDTH : constants_1.LEFT_COLUMN_WIDTH, showButtonClosed: false, className: styles_module_scss_1.default.drawer, "data-test-id": constants_1.TEST_IDS.drawer, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.menu, "data-test-id": constants_1.TEST_IDS.content, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.left, "data-test-id": constants_1.TEST_IDS.left, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftTop, "data-test-id": constants_1.TEST_IDS.leftTop, children: leftTop }), !isInitialEmptyCards ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftMain, children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { className: styles_module_scss_1.default.leftMainScroll, overflow: { x: 'hidden' }, barHideStrategy: 'never', "data-test-id": constants_1.TEST_IDS.leftNavList, size: 's', children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.items, children: navGroupItems.map(item => ((0, jsx_runtime_1.jsx)(uikit_product_card_predefined_1.CardServiceLight, { as: 'button', type: 'button', title: item.label, onClick: item.onClick, truncate: { title: 2 }, className: styles_module_scss_1.default.item, "data-test-id": constants_1.TEST_IDS.navGroup(item.id) }, item.id))) }) }) })) : null, !leftTop && isInitialEmptyCards ? (0, jsx_runtime_1.jsx)("div", {}) : null, hasBottomItems ? ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.leftBottom, "data-test-id": constants_1.TEST_IDS.leftBottom, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftBottomDivider, children: (0, jsx_runtime_1.jsx)(divider_1.Divider, {}) }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.leftBottomItems, "data-test-id": constants_1.TEST_IDS.leftBottomItems, children: [settingItems?.items.length ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftBottomCards, children: settingItems.items.map(item => ((0, react_1.createElement)(uikit_product_card_predefined_1.CardServiceLight, { ...(item.href ? { href: item.href, as: 'a' } : { as: 'button', type: 'button' }), key: item.id, title: item.label, icon: (0, utils_2.getLinkEmblem)(item), onClick: wrappedSettingClick(item), disabled: item.disabled, className: styles_module_scss_1.default.leftBottomCard, "data-test-id": constants_1.TEST_IDS.setting(item.id) }))) })) : null, sidebarBottomSlot] })] })) : null] }), isNeedRightBlock ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { orientation: 'vertical', className: styles_module_scss_1.default.divider, "data-test-id": constants_1.TEST_IDS.divider }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.right, "data-test-id": constants_1.TEST_IDS.right, children: [showSearch && search ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchWrap, "data-test-id": constants_1.TEST_IDS.search, children: (0, jsx_runtime_1.jsx)(NavigationSearch_1.NavigationSearch, { ref: searchRef, value: search.searchValue, onChange: search.onSearchValueChange, options: search.searchFunctions.map(fn => ({ id: fn.id, label: fn.label })), selectedOption: search.searchFn ?? search.searchFunctions[0]?.id ?? 'fuzzy', onSelectedOptionChange: search.onChangeSearchFn }) })) : null, (0, jsx_runtime_1.jsxs)(scroll_1.Scroll, { paddingAbsolute: true, className: styles_module_scss_1.default.scroll, ref: scrollRef, barHideStrategy: 'never', children: [isInitialEmptyCards && rightTop ? (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bannersWrap, children: rightTop }) : null, !isInitialEmptyCards ? ((0, jsx_runtime_1.jsx)(Content_1.Content, { onClose: handleCloseDrawer, className: styles_module_scss_1.default.rightContent, searchValue: searchValue, banners: rightTop, favorite: favorite, serviceGroups: resultItems, onLinkChange: onLinkChange })) : null] })] })] })) : null] }) }));
|
|
63
63
|
}
|
|
@@ -50,5 +50,5 @@ function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems, platfo
|
|
|
50
50
|
const searchValue = search?.searchValue;
|
|
51
51
|
const showSearch = Boolean(search) && !isInitialEmptyCards && (resultItems.length > 0 || Boolean(searchValue));
|
|
52
52
|
const hasBottomItems = Boolean(settingItems?.items.length);
|
|
53
|
-
return ((0, jsx_runtime_1.jsx)(desktopDrawer_1.DesktopDrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: 's', className: styles_module_scss_1.default.drawerMobile, closeOnPopstate: true, "data-test-id": constants_1.TEST_IDS.drawerMobile, children: (0, jsx_runtime_1.jsxs)(adaptive_1.AdaptiveProvider, { layoutType: layoutType, children: [(0, jsx_runtime_1.jsx)(desktopDrawer_1.DesktopDrawerCustom.Header, {
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)(desktopDrawer_1.DesktopDrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: 's', className: styles_module_scss_1.default.drawerMobile, closeOnPopstate: true, "data-test-id": constants_1.TEST_IDS.drawerMobile, children: (0, jsx_runtime_1.jsxs)(adaptive_1.AdaptiveProvider, { layoutType: layoutType, children: [(0, jsx_runtime_1.jsx)(desktopDrawer_1.DesktopDrawerCustom.Header, { title: t('mainMenu.navigation') }), (0, jsx_runtime_1.jsx)(desktopDrawer_1.DesktopDrawerCustom.Body, { className: styles_module_scss_1.default.scrollBody, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.scrollMobile, children: [leftTop ? (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.leftTop, children: leftTop }) : null, !isInitialEmptyCards ? ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.main, children: [showSearch && search ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchItem, "data-test-id": constants_1.TEST_IDS.search, children: (0, jsx_runtime_1.jsx)(NavigationSearch_1.NavigationSearch, { ref: searchRef, value: search.searchValue, onChange: search.onSearchValueChange, onBlur: search.onBlur, onFocus: search.onFocus, options: search.searchFunctions.map(fn => ({ id: fn.id, label: fn.label })), selectedOption: search.searchFn ?? search.searchFunctions[0]?.id ?? 'fuzzy', onSelectedOptionChange: search.onChangeSearchFn }) })) : null, (0, jsx_runtime_1.jsx)(Content_1.Content, { isMobile: true, onClose: handleCloseDrawer, onLinkChange: onLinkChange, className: styles_module_scss_1.default.content, searchValue: searchValue, banners: rightTop, favorite: favorite, serviceGroups: resultItems })] })) : null, isInitialEmptyCards && rightTop ? (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bannersWrap, children: rightTop }) : null, hasBottomItems ? ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.bottom, "data-test-id": constants_1.TEST_IDS.leftBottom, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bottomDivider, children: (0, jsx_runtime_1.jsx)(divider_1.Divider, {}) }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.bottomItems, "data-test-id": constants_1.TEST_IDS.leftBottomItems, children: settingItems?.items.map(item => ((0, react_1.createElement)(uikit_product_card_predefined_1.CardServiceLight, { ...(item.href ? { href: item.href, as: 'a' } : { as: 'button', type: 'button' }), key: item.id, title: item.label, icon: (0, utils_2.getLinkEmblem)(item), onClick: wrappedSettingClick(item), disabled: item.disabled, className: styles_module_scss_1.default.bottomCard, "data-test-id": constants_1.TEST_IDS.setting(item.id) }))) })] })) : null] }) })] }) }));
|
|
54
54
|
}
|
|
@@ -79,10 +79,6 @@ exports.NavigationSearch = (0, react_1.forwardRef)(function NavigationSearch({ v
|
|
|
79
79
|
};
|
|
80
80
|
const settingsButton = ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(product_1.ConfigurationSVG, { size: 24 }), onClick: isMobile ? undefined : handleSettingsClick, "aria-expanded": showSettings, "aria-label": settingsTitle, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.settingsButton }));
|
|
81
81
|
// SearchPrivate = Figma `contentWrapper` (не слой `search` / `fieldContainer`). См. JSDoc.
|
|
82
|
-
const search = ((0, jsx_runtime_1.jsx)(search_private_1.SearchPrivate, { ref: searchRef, className: styles_module_scss_1.default.search, size: search_private_1.SIZE.M, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.search, afterContent: isMobile ? ((0, jsx_runtime_1.jsx)(list_1.Droplist, {
|
|
83
|
-
|
|
84
|
-
id: option.id,
|
|
85
|
-
content: option.label,
|
|
86
|
-
})), selection: { mode: 'single', value: selectedOption, onChange: handleMobileOptionChange }, closeDroplistOnItemClick: true, closeOnPopstate: true, label: settingsTitle, children: settingsButton })) : (settingsButton) }));
|
|
87
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-mobile": isMobile || undefined, "data-open-search": isMobile && openSearch ? true : undefined, ...(0, utils_1.extractSupportProps)(rest), "data-test-id": rest['data-test-id'] ?? NAVIGATION_SEARCH_TEST_IDS.root, children: [isMobile && !openSearch ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { className: styles_module_scss_1.default.title, variant: 'title', size: 'm', weight: 'regular', "data-test-id": NAVIGATION_SEARCH_TEST_IDS.title, children: title }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.mobileSearchButton, view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.SearchSVG, { size: 24 }), onClick: handleOpenSearch, "aria-label": placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.openSearchButton })] })) : ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.fieldContainer, children: search }) })), !isMobile && showSettings && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { "data-test-id": constants_1.TEST_IDS.navigationSearchSettingsSectionDivider, variant: 'regular', className: styles_module_scss_1.default.settingsSectionDivider }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.settings, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.settings, children: options.map(option => ((0, jsx_runtime_1.jsx)(chips_1.ChipToggle, { size: 's', label: option.label, checked: selectedOption === option.id, onChange: () => onSelectedOptionChange(option.id), "data-test-id": NAVIGATION_SEARCH_TEST_IDS.option(option.id) }, option.id))) })] }))] }));
|
|
82
|
+
const search = ((0, jsx_runtime_1.jsx)(search_private_1.SearchPrivate, { ref: searchRef, className: styles_module_scss_1.default.search, size: search_private_1.SIZE.M, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.search, afterContent: isMobile ? ((0, jsx_runtime_1.jsx)(list_1.Droplist, { open: showSettings, onOpenChange: setShowSettings, items: options.map(option => ({ id: option.id, content: option.label })), selection: { mode: 'single', value: selectedOption, onChange: handleMobileOptionChange }, closeDroplistOnItemClick: true, closeOnPopstate: true, label: settingsTitle, children: settingsButton })) : (settingsButton) }));
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-mobile": isMobile || undefined, "data-open-search": isMobile && openSearch ? true : undefined, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.root, ...(0, utils_1.extractSupportProps)(rest), children: [isMobile && !openSearch ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { className: styles_module_scss_1.default.title, variant: 'title', size: 'm', weight: 'regular', "data-test-id": NAVIGATION_SEARCH_TEST_IDS.title, children: title }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.mobileSearchButton, view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.SearchSVG, { size: 24 }), onClick: handleOpenSearch, "aria-label": placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.openSearchButton })] })) : ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.fieldContainer, children: search }) })), !isMobile && showSettings && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { variant: 'regular', className: styles_module_scss_1.default.settingsSectionDivider }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.settings, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.settings, children: options.map(option => ((0, jsx_runtime_1.jsx)(chips_1.ChipToggle, { size: 's', label: option.label, checked: selectedOption === option.id, onChange: () => onSelectedOptionChange(option.id), "data-test-id": NAVIGATION_SEARCH_TEST_IDS.option(option.id) }, option.id))) })] }))] }));
|
|
88
84
|
});
|
|
@@ -14,10 +14,10 @@ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
|
14
14
|
const SERVICES_CATEGORY_TEST_IDS = constants_1.TEST_IDS.servicesCategory;
|
|
15
15
|
function CategoryTitle({ title, href, onTitleClick, showArrow, fullWidth, }) {
|
|
16
16
|
if (href) {
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { content: (0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { content: (0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, { title: title }), href: href, showArrow: showArrow, fullWidth: fullWidth, onClick: onTitleClick, "data-test-id": SERVICES_CATEGORY_TEST_IDS.title }));
|
|
18
18
|
}
|
|
19
19
|
if (onTitleClick) {
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { as: 'button', type: 'button', content: (0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, {
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { as: 'button', type: 'button', content: (0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, { title: title }), showArrow: showArrow, fullWidth: fullWidth, onClick: onTitleClick, "data-test-id": SERVICES_CATEGORY_TEST_IDS.title }));
|
|
21
21
|
}
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)("p", { className: styles_module_scss_1.default.title, "data-test-id": SERVICES_CATEGORY_TEST_IDS.title, children: title }));
|
|
23
23
|
}
|
|
@@ -29,5 +29,5 @@ function CategoryTitle({ title, href, onTitleClick, showArrow, fullWidth, }) {
|
|
|
29
29
|
*/
|
|
30
30
|
function ServicesCategory({ title, href, onTitleClick, highlight = false, children, className, showArrow, fullWidth, ...rest }) {
|
|
31
31
|
const isMobile = (0, useMobileLayout_1.useMobileLayout)();
|
|
32
|
-
return ((0, jsx_runtime_1.jsxs)("section", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-highlight": highlight || undefined, ...(0, utils_1.extractSupportProps)(rest),
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)("section", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-test-id": SERVICES_CATEGORY_TEST_IDS.root, "data-highlight": highlight || undefined, ...(0, utils_1.extractSupportProps)(rest), children: [(0, jsx_runtime_1.jsx)(CategoryTitle, { title: title, href: href, onTitleClick: onTitleClick, showArrow: showArrow, fullWidth: fullWidth }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.services, "data-mobile": isMobile || undefined, "data-test-id": SERVICES_CATEGORY_TEST_IDS.services, children: children })] }));
|
|
33
33
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CardServiceLightProps } from '@cloud-ru/ds-uikit-product-card-predefined';
|
|
2
|
-
import type { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
2
|
import { JSXElementConstructor, MouseEvent, ReactNode } from 'react';
|
|
4
3
|
/**
|
|
5
4
|
* Карточка сервиса или ссылки внутри {@link LinksGroup}.
|
|
@@ -15,10 +14,10 @@ export type InnerLink = {
|
|
|
15
14
|
* Если не задана, вместо иконки рендерится `Avatar` с двухбуквенным текстом по `label`
|
|
16
15
|
* (см. `getAvatarNameFromLabel`).
|
|
17
16
|
*/
|
|
18
|
-
icon?: JSXElementConstructor<
|
|
17
|
+
icon?: JSXElementConstructor<{
|
|
19
18
|
size?: number;
|
|
20
19
|
className?: string;
|
|
21
|
-
}
|
|
20
|
+
}>;
|
|
22
21
|
/** Заголовок карточки. */
|
|
23
22
|
label: string;
|
|
24
23
|
onClick(e?: MouseEvent<HTMLElement>): void;
|
|
@@ -5,24 +5,21 @@ exports.renderLinkBeforeContent = renderLinkBeforeContent;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const avatar_1 = require("@cloud-ru/ds-avatar");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
8
|
const getAvatarNameFromLabel_1 = require("./getAvatarNameFromLabel");
|
|
10
9
|
function createAvatarIcon(displayName) {
|
|
11
10
|
return function LinkAvatarIcon({ className }) {
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(avatar_1.Avatar, {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(avatar_1.Avatar, { name: displayName, showTwoSymbols: true, shape: 'squared', appearance: 'neutral', size: 'xs', className: className }));
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
14
|
function getLinkEmblem(link) {
|
|
16
15
|
if (!link.icon) {
|
|
17
|
-
return (0, react_1.createElement)(createAvatarIcon((0, getAvatarNameFromLabel_1.getAvatarNameFromLabel)(link.label))
|
|
18
|
-
'data-test-id': constants_1.TEST_IDS.getLinkEmblemAvatar,
|
|
19
|
-
});
|
|
16
|
+
return (0, react_1.createElement)(createAvatarIcon((0, getAvatarNameFromLabel_1.getAvatarNameFromLabel)(link.label)));
|
|
20
17
|
}
|
|
21
|
-
return (0, react_1.createElement)(link.icon
|
|
18
|
+
return (0, react_1.createElement)(link.icon);
|
|
22
19
|
}
|
|
23
20
|
function renderLinkBeforeContent(link) {
|
|
24
21
|
if (!link.icon) {
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)(avatar_1.Avatar, {
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(avatar_1.Avatar, { name: (0, getAvatarNameFromLabel_1.getAvatarNameFromLabel)(link.label), showTwoSymbols: true, shape: 'squared', appearance: 'neutral', size: 'xs' }));
|
|
26
23
|
}
|
|
27
|
-
return (0, react_1.createElement)(link.icon
|
|
24
|
+
return (0, react_1.createElement)(link.icon);
|
|
28
25
|
}
|
|
@@ -30,13 +30,13 @@ function PlatformLogo({ variant = constants_1.VARIANT.Evolution, avatarName, com
|
|
|
30
30
|
const { t } = locale_1.headerLegacyLocale.useTranslations();
|
|
31
31
|
const supportProps = (0, utils_1.extractSupportProps)(rest);
|
|
32
32
|
if (avatarName) {
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-variant": variant, "data-compact": compact || undefined,
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-variant": variant, "data-compact": compact || undefined, "data-test-id": constants_1.TEST_IDS.root, ...supportProps, children: (0, jsx_runtime_1.jsx)(avatar_1.Avatar, { name: avatarName, size: compact ? avatar_1.SIZE.S : avatar_1.SIZE.M, shape: avatar_1.SHAPE.Squared, appearance: avatar_1.APPEARANCE.Neutral, showTwoSymbols: true }) }));
|
|
34
34
|
}
|
|
35
35
|
if (isAvatarVariant(variant)) {
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-variant": variant, "data-compact": compact || undefined,
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-variant": variant, "data-compact": compact || undefined, "data-test-id": constants_1.TEST_IDS.root, ...supportProps, children: (0, jsx_runtime_1.jsx)(avatar_1.Avatar, { name: variant === constants_1.VARIANT.Partner
|
|
37
37
|
? t('platformLogo.avatarName.partner')
|
|
38
38
|
: t('platformLogo.avatarName.marketplace'), size: compact ? avatar_1.SIZE.S : avatar_1.SIZE.M, shape: avatar_1.SHAPE.Squared, appearance: avatar_1.APPEARANCE.Neutral, showTwoSymbols: true }) }));
|
|
39
39
|
}
|
|
40
40
|
const Icon = SVG_BY_VARIANT[variant];
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-variant": variant, "data-compact": compact || undefined,
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-variant": variant, "data-compact": compact || undefined, "data-test-id": constants_1.TEST_IDS.root, ...supportProps, children: Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: constants_1.ICON_SIZE }) : null }));
|
|
42
42
|
}
|
|
@@ -2,8 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Divider } from '@cloud-ru/ds-divider';
|
|
3
3
|
import { extractSupportProps } from '@cloud-ru/ds-utils';
|
|
4
4
|
import cn from 'classnames';
|
|
5
|
-
import { TEST_IDS } from '../../constants.js';
|
|
6
5
|
import styles from './styles.module.css';
|
|
7
6
|
export function HeaderLayout({ menu, logo, select, breadcrumbs, toolbar, className, isMobile = false, ...rest }) {
|
|
8
|
-
return (_jsxs("header", { className: cn(styles.header, className), "data-mobile": isMobile || undefined, ...extractSupportProps(rest), children: [_jsxs("div", { className: styles.top, children: [_jsxs("div", { className: styles.left, children: [menu, logo, !isMobile && select && (_jsxs(_Fragment, { children: [_jsx(Divider, {
|
|
7
|
+
return (_jsxs("header", { className: cn(styles.header, className), "data-mobile": isMobile || undefined, ...extractSupportProps(rest), children: [_jsxs("div", { className: styles.top, children: [_jsxs("div", { className: styles.left, children: [menu, logo, !isMobile && select && (_jsxs(_Fragment, { children: [_jsx(Divider, { orientation: 'vertical' }), select] })), !isMobile && breadcrumbs && (_jsxs(_Fragment, { children: [_jsx(Divider, { orientation: 'vertical' }), breadcrumbs] }))] }), _jsx("div", { className: styles.right, children: toolbar })] }), _jsx(Divider, { orientation: 'horizontal' }), isMobile && Boolean(breadcrumbs) && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.bottom, children: breadcrumbs }), _jsx(Divider, { orientation: 'horizontal' })] }))] }));
|
|
9
8
|
}
|
|
@@ -36,5 +36,5 @@ export function Logo({ path, loading = false, mode, href, onClick, className, ..
|
|
|
36
36
|
}
|
|
37
37
|
return (_jsx("span", { className: styles.icon, "data-test-id": TEST_IDS.icon, children: resolveModeIcon(mode) }));
|
|
38
38
|
}, [error, mode, path]);
|
|
39
|
-
return (_jsx(Button, { as: 'a', appearance: 'neutral', view: 'simple', size: 'm', href: href, onClick: onClick, loading: loading, icon: icon, className: className, "data-mode": mode,
|
|
39
|
+
return (_jsx(Button, { as: 'a', appearance: 'neutral', view: 'simple', size: 'm', href: href, onClick: onClick, loading: loading, icon: icon, className: className, "data-mode": mode, "data-test-id": TEST_IDS.root, ...extractSupportProps(rest) }));
|
|
40
40
|
}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
export declare const TEST_IDS: {
|
|
2
|
-
readonly linkEmblem: "main-menu__link-emblem";
|
|
3
|
-
readonly contentInfoBlock: "content__info-block";
|
|
4
|
-
readonly navigationSearchDroplist: "navigation-search__droplist";
|
|
5
|
-
readonly contentNoDataIconPredefined: "content__no-data-icon-predefined";
|
|
6
|
-
readonly navigationSearchItems: "navigation-search__items";
|
|
7
|
-
readonly contentServicesCategory: "content__services-category";
|
|
8
|
-
readonly menuDesktopNavigationSearch: "menu-desktop__navigation-search";
|
|
9
|
-
readonly menuDesktopScroll: "menu-desktop__scroll";
|
|
10
|
-
readonly menuMobileHeader: "menu-mobile__header";
|
|
11
|
-
readonly menuMobileScrollBody: "menu-mobile__scroll-body";
|
|
12
|
-
readonly menuMobileNavigationSearch: "menu-mobile__navigation-search";
|
|
13
|
-
readonly navigationSearchSettingsSectionDivider: "navigation-search__settings-section-divider";
|
|
14
|
-
readonly servicesCategorySimpleTitle: "services-category__simple-title";
|
|
15
|
-
readonly getLinkEmblemAvatar: "get-link-emblem__avatar";
|
|
16
2
|
readonly trigger: "header__drawer-menu-button";
|
|
17
3
|
readonly drawer: "header__drawer-menu";
|
|
18
4
|
readonly drawerMobile: "header__drawer-menu-mobile";
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
export const TEST_IDS = {
|
|
2
|
-
linkEmblem: 'main-menu__link-emblem',
|
|
3
|
-
contentInfoBlock: 'content__info-block',
|
|
4
|
-
navigationSearchDroplist: 'navigation-search__droplist',
|
|
5
|
-
contentNoDataIconPredefined: 'content__no-data-icon-predefined',
|
|
6
|
-
navigationSearchItems: 'navigation-search__items',
|
|
7
|
-
contentServicesCategory: 'content__services-category',
|
|
8
|
-
menuDesktopNavigationSearch: 'menu-desktop__navigation-search',
|
|
9
|
-
menuDesktopScroll: 'menu-desktop__scroll',
|
|
10
|
-
menuMobileHeader: 'menu-mobile__header',
|
|
11
|
-
menuMobileScrollBody: 'menu-mobile__scroll-body',
|
|
12
|
-
menuMobileNavigationSearch: 'menu-mobile__navigation-search',
|
|
13
|
-
navigationSearchSettingsSectionDivider: 'navigation-search__settings-section-divider',
|
|
14
|
-
servicesCategorySimpleTitle: 'services-category__simple-title',
|
|
15
|
-
getLinkEmblemAvatar: 'get-link-emblem__avatar',
|
|
16
2
|
trigger: 'header__drawer-menu-button',
|
|
17
3
|
drawer: 'header__drawer-menu',
|
|
18
4
|
drawerMobile: 'header__drawer-menu-mobile',
|
|
@@ -25,7 +25,7 @@ export function Content({ searchValue, banners, serviceGroups, className, favori
|
|
|
25
25
|
onClick?.(e);
|
|
26
26
|
cb?.();
|
|
27
27
|
}, [onClose]);
|
|
28
|
-
const cards = useMemo(() => serviceGroups?.map(({ id, label, items, favoritesEnabled = true, highlight }) => (_jsx("div", { id: id, "data-test-id": TEST_IDS.groupCard(String(id)), children: _jsx(ServicesCategory, {
|
|
28
|
+
const cards = useMemo(() => serviceGroups?.map(({ id, label, items, favoritesEnabled = true, highlight }) => (_jsx("div", { id: id, "data-test-id": TEST_IDS.groupCard(String(id)), children: _jsx(ServicesCategory, { title: label.text, onTitleClick: label.onClick, highlight: highlight, children: items.map(service => (_createElement(CardServiceLight, { ...(service.href ? { href: service.href, as: 'a' } : { as: 'button', type: 'button' }), key: String(id) + service.id, title: service.label, disabled: service.disabled, icon: getLinkEmblem(service), "data-test-id": TEST_IDS.link(service.id), onClick: wrappedClick(service, () => onLinkChange?.(service.id)), favorite: favorite && favoritesEnabled
|
|
29
29
|
? {
|
|
30
30
|
enabled: !service.disabled,
|
|
31
31
|
checked: favorite.value.includes(service.id),
|
|
@@ -33,5 +33,5 @@ export function Content({ searchValue, banners, serviceGroups, className, favori
|
|
|
33
33
|
}
|
|
34
34
|
: undefined, actionsVisibility: isMobile ? VISIBILITY_STRATEGY.always : VISIBILITY_STRATEGY.hover, promoTag: service.badge, className: styles.card }))) }) }, String(id)))), [favorite, isMobile, onLinkChange, serviceGroups, wrappedClick]);
|
|
35
35
|
const hasGroups = Boolean(serviceGroups?.length);
|
|
36
|
-
return (_jsxs("div", { className: cn(styles.root, className), children: [!searchValue && banners ? (_jsx("div", { className: styles.banners, "data-mobile": isMobile || undefined, "data-test-id": TEST_IDS.banners, children: banners })) : null, _jsx("div", { className: styles.services, "data-test-id": TEST_IDS.services, children: cards }), !hasGroups && !searchValue && (_jsx("div", { className: styles.noData, "data-test-id": TEST_IDS.noData, children: _jsx(InfoBlock, {
|
|
36
|
+
return (_jsxs("div", { className: cn(styles.root, className), children: [!searchValue && banners ? (_jsx("div", { className: styles.banners, "data-mobile": isMobile || undefined, "data-test-id": TEST_IDS.banners, children: banners })) : null, _jsx("div", { className: styles.services, "data-test-id": TEST_IDS.services, children: cards }), !hasGroups && !searchValue && (_jsx("div", { className: styles.noData, "data-test-id": TEST_IDS.noData, children: _jsx(InfoBlock, { content: t('mainMenu.noData'), icon: NO_DATA_ICON_PREDEFINED_PROPS }) })), !hasGroups && searchValue && (_jsx("div", { className: styles.noData, "data-test-id": TEST_IDS.noDataFound, children: _jsx(InfoBlock, { content: t('mainMenu.noDataFound'), icon: NO_DATA_ICON_PREDEFINED_PROPS }) }))] }));
|
|
37
37
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const NO_DATA_ICON_PREDEFINED_PROPS: {
|
|
2
|
-
'data-test-id': "content__no-data-icon-predefined";
|
|
3
2
|
icon: import("react").ForwardRefExoticComponent<Omit<import("@cloud-ru/ds-icons").ISvgIconProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
4
3
|
appearance: "neutral";
|
|
5
4
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { APPEARANCE } from '@cloud-ru/ds-icon-predefined';
|
|
2
2
|
import { SearchSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
-
import { TEST_IDS } from '../../constants.js';
|
|
4
3
|
export const NO_DATA_ICON_PREDEFINED_PROPS = {
|
|
5
|
-
'data-test-id': TEST_IDS.contentNoDataIconPredefined,
|
|
6
4
|
icon: SearchSVG,
|
|
7
5
|
appearance: APPEARANCE.Neutral,
|
|
8
6
|
};
|
|
@@ -53,5 +53,5 @@ export function MenuDesktop({ open: openProp, setOpen: setOpenProp, settingItems
|
|
|
53
53
|
const hasBottomItems = Boolean(settingItems?.items.length) || Boolean(sidebarBottomSlot);
|
|
54
54
|
const searchValue = search?.searchValue;
|
|
55
55
|
const showSearch = Boolean(search) && !isInitialEmptyCards && (resultItems.length > 0 || Boolean(searchValue));
|
|
56
|
-
return (_jsx(DrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: isNeedRightBlock ? DEFAULT_DRAWER_WIDTH : LEFT_COLUMN_WIDTH, showButtonClosed: false, className: styles.drawer, "data-test-id": TEST_IDS.drawer, children: _jsxs("div", { className: styles.menu, "data-test-id": TEST_IDS.content, children: [_jsxs("div", { className: styles.left, "data-test-id": TEST_IDS.left, children: [_jsx("div", { className: styles.leftTop, "data-test-id": TEST_IDS.leftTop, children: leftTop }), !isInitialEmptyCards ? (_jsx("div", { className: styles.leftMain, children: _jsx(Scroll, { className: styles.leftMainScroll, overflow: { x: 'hidden' }, barHideStrategy: 'never', "data-test-id": TEST_IDS.leftNavList, size: 's', children: _jsx("div", { className: styles.items, children: navGroupItems.map(item => (_jsx(CardServiceLight, { as: 'button', type: 'button', title: item.label, onClick: item.onClick, truncate: { title: 2 }, className: styles.item, "data-test-id": TEST_IDS.navGroup(item.id) }, item.id))) }) }) })) : null, !leftTop && isInitialEmptyCards ? _jsx("div", {}) : null, hasBottomItems ? (_jsxs("div", { className: styles.leftBottom, "data-test-id": TEST_IDS.leftBottom, children: [_jsx("div", { className: styles.leftBottomDivider, children: _jsx(Divider, {
|
|
56
|
+
return (_jsx(DrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: isNeedRightBlock ? DEFAULT_DRAWER_WIDTH : LEFT_COLUMN_WIDTH, showButtonClosed: false, className: styles.drawer, "data-test-id": TEST_IDS.drawer, children: _jsxs("div", { className: styles.menu, "data-test-id": TEST_IDS.content, children: [_jsxs("div", { className: styles.left, "data-test-id": TEST_IDS.left, children: [_jsx("div", { className: styles.leftTop, "data-test-id": TEST_IDS.leftTop, children: leftTop }), !isInitialEmptyCards ? (_jsx("div", { className: styles.leftMain, children: _jsx(Scroll, { className: styles.leftMainScroll, overflow: { x: 'hidden' }, barHideStrategy: 'never', "data-test-id": TEST_IDS.leftNavList, size: 's', children: _jsx("div", { className: styles.items, children: navGroupItems.map(item => (_jsx(CardServiceLight, { as: 'button', type: 'button', title: item.label, onClick: item.onClick, truncate: { title: 2 }, className: styles.item, "data-test-id": TEST_IDS.navGroup(item.id) }, item.id))) }) }) })) : null, !leftTop && isInitialEmptyCards ? _jsx("div", {}) : null, hasBottomItems ? (_jsxs("div", { className: styles.leftBottom, "data-test-id": TEST_IDS.leftBottom, children: [_jsx("div", { className: styles.leftBottomDivider, children: _jsx(Divider, {}) }), _jsxs("div", { className: styles.leftBottomItems, "data-test-id": TEST_IDS.leftBottomItems, children: [settingItems?.items.length ? (_jsx("div", { className: styles.leftBottomCards, children: settingItems.items.map(item => (_createElement(CardServiceLight, { ...(item.href ? { href: item.href, as: 'a' } : { as: 'button', type: 'button' }), key: item.id, title: item.label, icon: getLinkEmblem(item), onClick: wrappedSettingClick(item), disabled: item.disabled, className: styles.leftBottomCard, "data-test-id": TEST_IDS.setting(item.id) }))) })) : null, sidebarBottomSlot] })] })) : null] }), isNeedRightBlock ? (_jsxs(_Fragment, { children: [_jsx(Divider, { orientation: 'vertical', className: styles.divider, "data-test-id": TEST_IDS.divider }), _jsxs("div", { className: styles.right, "data-test-id": TEST_IDS.right, children: [showSearch && search ? (_jsx("div", { className: styles.searchWrap, "data-test-id": TEST_IDS.search, children: _jsx(NavigationSearch, { ref: searchRef, value: search.searchValue, onChange: search.onSearchValueChange, options: search.searchFunctions.map(fn => ({ id: fn.id, label: fn.label })), selectedOption: search.searchFn ?? search.searchFunctions[0]?.id ?? 'fuzzy', onSelectedOptionChange: search.onChangeSearchFn }) })) : null, _jsxs(Scroll, { paddingAbsolute: true, className: styles.scroll, ref: scrollRef, barHideStrategy: 'never', children: [isInitialEmptyCards && rightTop ? _jsx("div", { className: styles.bannersWrap, children: rightTop }) : null, !isInitialEmptyCards ? (_jsx(Content, { onClose: handleCloseDrawer, className: styles.rightContent, searchValue: searchValue, banners: rightTop, favorite: favorite, serviceGroups: resultItems, onLinkChange: onLinkChange })) : null] })] })] })) : null] }) }));
|
|
57
57
|
}
|
|
@@ -44,5 +44,5 @@ export function MenuMobile({ open: openProp, setOpen: setOpenProp, settingItems,
|
|
|
44
44
|
const searchValue = search?.searchValue;
|
|
45
45
|
const showSearch = Boolean(search) && !isInitialEmptyCards && (resultItems.length > 0 || Boolean(searchValue));
|
|
46
46
|
const hasBottomItems = Boolean(settingItems?.items.length);
|
|
47
|
-
return (_jsx(DesktopDrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: 's', className: styles.drawerMobile, closeOnPopstate: true, "data-test-id": TEST_IDS.drawerMobile, children: _jsxs(AdaptiveProvider, { layoutType: layoutType, children: [_jsx(DesktopDrawerCustom.Header, {
|
|
47
|
+
return (_jsx(DesktopDrawerCustom, { open: open, onClose: handleCloseDrawer, position: 'left', width: 's', className: styles.drawerMobile, closeOnPopstate: true, "data-test-id": TEST_IDS.drawerMobile, children: _jsxs(AdaptiveProvider, { layoutType: layoutType, children: [_jsx(DesktopDrawerCustom.Header, { title: t('mainMenu.navigation') }), _jsx(DesktopDrawerCustom.Body, { className: styles.scrollBody, children: _jsxs("div", { className: styles.scrollMobile, children: [leftTop ? _jsx("div", { className: styles.leftTop, children: leftTop }) : null, !isInitialEmptyCards ? (_jsxs("div", { className: styles.main, children: [showSearch && search ? (_jsx("div", { className: styles.searchItem, "data-test-id": TEST_IDS.search, children: _jsx(NavigationSearch, { ref: searchRef, value: search.searchValue, onChange: search.onSearchValueChange, onBlur: search.onBlur, onFocus: search.onFocus, options: search.searchFunctions.map(fn => ({ id: fn.id, label: fn.label })), selectedOption: search.searchFn ?? search.searchFunctions[0]?.id ?? 'fuzzy', onSelectedOptionChange: search.onChangeSearchFn }) })) : null, _jsx(Content, { isMobile: true, onClose: handleCloseDrawer, onLinkChange: onLinkChange, className: styles.content, searchValue: searchValue, banners: rightTop, favorite: favorite, serviceGroups: resultItems })] })) : null, isInitialEmptyCards && rightTop ? _jsx("div", { className: styles.bannersWrap, children: rightTop }) : null, hasBottomItems ? (_jsxs("div", { className: styles.bottom, "data-test-id": TEST_IDS.leftBottom, children: [_jsx("div", { className: styles.bottomDivider, children: _jsx(Divider, {}) }), _jsx("div", { className: styles.bottomItems, "data-test-id": TEST_IDS.leftBottomItems, children: settingItems?.items.map(item => (_createElement(CardServiceLight, { ...(item.href ? { href: item.href, as: 'a' } : { as: 'button', type: 'button' }), key: item.id, title: item.label, icon: getLinkEmblem(item), onClick: wrappedSettingClick(item), disabled: item.disabled, className: styles.bottomCard, "data-test-id": TEST_IDS.setting(item.id) }))) })] })) : null] }) })] }) }));
|
|
48
48
|
}
|
|
@@ -73,10 +73,6 @@ export const NavigationSearch = forwardRef(function NavigationSearch({ value, on
|
|
|
73
73
|
};
|
|
74
74
|
const settingsButton = (_jsx(Button, { view: 'function', appearance: 'neutral', size: 'm', icon: _jsx(ConfigurationSVG, { size: 24 }), onClick: isMobile ? undefined : handleSettingsClick, "aria-expanded": showSettings, "aria-label": settingsTitle, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.settingsButton }));
|
|
75
75
|
// SearchPrivate = Figma `contentWrapper` (не слой `search` / `fieldContainer`). См. JSDoc.
|
|
76
|
-
const search = (_jsx(SearchPrivate, { ref: searchRef, className: styles.search, size: SEARCH_SIZE.M, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.search, afterContent: isMobile ? (_jsx(Droplist, {
|
|
77
|
-
|
|
78
|
-
id: option.id,
|
|
79
|
-
content: option.label,
|
|
80
|
-
})), selection: { mode: 'single', value: selectedOption, onChange: handleMobileOptionChange }, closeDroplistOnItemClick: true, closeOnPopstate: true, label: settingsTitle, children: settingsButton })) : (settingsButton) }));
|
|
81
|
-
return (_jsxs("div", { ref: ref, className: cn(styles.root, className), "data-mobile": isMobile || undefined, "data-open-search": isMobile && openSearch ? true : undefined, ...extractSupportProps(rest), "data-test-id": rest['data-test-id'] ?? NAVIGATION_SEARCH_TEST_IDS.root, children: [isMobile && !openSearch ? (_jsxs(_Fragment, { children: [_jsx(Typography, { className: styles.title, variant: 'title', size: 'm', weight: 'regular', "data-test-id": NAVIGATION_SEARCH_TEST_IDS.title, children: title }), _jsx(Button, { className: styles.mobileSearchButton, view: 'function', appearance: 'neutral', size: 'm', icon: _jsx(SearchSVG, { size: 24 }), onClick: handleOpenSearch, "aria-label": placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.openSearchButton })] })) : (_jsx("div", { className: styles.searchWrapper, children: _jsx("div", { className: styles.fieldContainer, children: search }) })), !isMobile && showSettings && (_jsxs(_Fragment, { children: [_jsx(Divider, { "data-test-id": TEST_IDS.navigationSearchSettingsSectionDivider, variant: 'regular', className: styles.settingsSectionDivider }), _jsx("div", { className: styles.settings, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.settings, children: options.map(option => (_jsx(ChipToggle, { size: 's', label: option.label, checked: selectedOption === option.id, onChange: () => onSelectedOptionChange(option.id), "data-test-id": NAVIGATION_SEARCH_TEST_IDS.option(option.id) }, option.id))) })] }))] }));
|
|
76
|
+
const search = (_jsx(SearchPrivate, { ref: searchRef, className: styles.search, size: SEARCH_SIZE.M, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.search, afterContent: isMobile ? (_jsx(Droplist, { open: showSettings, onOpenChange: setShowSettings, items: options.map(option => ({ id: option.id, content: option.label })), selection: { mode: 'single', value: selectedOption, onChange: handleMobileOptionChange }, closeDroplistOnItemClick: true, closeOnPopstate: true, label: settingsTitle, children: settingsButton })) : (settingsButton) }));
|
|
77
|
+
return (_jsxs("div", { ref: ref, className: cn(styles.root, className), "data-mobile": isMobile || undefined, "data-open-search": isMobile && openSearch ? true : undefined, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.root, ...extractSupportProps(rest), children: [isMobile && !openSearch ? (_jsxs(_Fragment, { children: [_jsx(Typography, { className: styles.title, variant: 'title', size: 'm', weight: 'regular', "data-test-id": NAVIGATION_SEARCH_TEST_IDS.title, children: title }), _jsx(Button, { className: styles.mobileSearchButton, view: 'function', appearance: 'neutral', size: 'm', icon: _jsx(SearchSVG, { size: 24 }), onClick: handleOpenSearch, "aria-label": placeholder, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.openSearchButton })] })) : (_jsx("div", { className: styles.searchWrapper, children: _jsx("div", { className: styles.fieldContainer, children: search }) })), !isMobile && showSettings && (_jsxs(_Fragment, { children: [_jsx(Divider, { variant: 'regular', className: styles.settingsSectionDivider }), _jsx("div", { className: styles.settings, "data-test-id": NAVIGATION_SEARCH_TEST_IDS.settings, children: options.map(option => (_jsx(ChipToggle, { size: 's', label: option.label, checked: selectedOption === option.id, onChange: () => onSelectedOptionChange(option.id), "data-test-id": NAVIGATION_SEARCH_TEST_IDS.option(option.id) }, option.id))) })] }))] }));
|
|
82
78
|
});
|
|
@@ -8,10 +8,10 @@ import styles from './styles.module.css';
|
|
|
8
8
|
const SERVICES_CATEGORY_TEST_IDS = TEST_IDS.servicesCategory;
|
|
9
9
|
function CategoryTitle({ title, href, onTitleClick, showArrow, fullWidth, }) {
|
|
10
10
|
if (href) {
|
|
11
|
-
return (_jsx(TitleClickable, { content: _jsx(TitleClickable.SimpleTitle, {
|
|
11
|
+
return (_jsx(TitleClickable, { content: _jsx(TitleClickable.SimpleTitle, { title: title }), href: href, showArrow: showArrow, fullWidth: fullWidth, onClick: onTitleClick, "data-test-id": SERVICES_CATEGORY_TEST_IDS.title }));
|
|
12
12
|
}
|
|
13
13
|
if (onTitleClick) {
|
|
14
|
-
return (_jsx(TitleClickable, { as: 'button', type: 'button', content: _jsx(TitleClickable.SimpleTitle, {
|
|
14
|
+
return (_jsx(TitleClickable, { as: 'button', type: 'button', content: _jsx(TitleClickable.SimpleTitle, { title: title }), showArrow: showArrow, fullWidth: fullWidth, onClick: onTitleClick, "data-test-id": SERVICES_CATEGORY_TEST_IDS.title }));
|
|
15
15
|
}
|
|
16
16
|
return (_jsx("p", { className: styles.title, "data-test-id": SERVICES_CATEGORY_TEST_IDS.title, children: title }));
|
|
17
17
|
}
|
|
@@ -23,5 +23,5 @@ function CategoryTitle({ title, href, onTitleClick, showArrow, fullWidth, }) {
|
|
|
23
23
|
*/
|
|
24
24
|
export function ServicesCategory({ title, href, onTitleClick, highlight = false, children, className, showArrow, fullWidth, ...rest }) {
|
|
25
25
|
const isMobile = useMobileLayout();
|
|
26
|
-
return (_jsxs("section", { className: cn(styles.root, className), "data-highlight": highlight || undefined, ...extractSupportProps(rest),
|
|
26
|
+
return (_jsxs("section", { className: cn(styles.root, className), "data-test-id": SERVICES_CATEGORY_TEST_IDS.root, "data-highlight": highlight || undefined, ...extractSupportProps(rest), children: [_jsx(CategoryTitle, { title: title, href: href, onTitleClick: onTitleClick, showArrow: showArrow, fullWidth: fullWidth }), _jsx("div", { className: styles.services, "data-mobile": isMobile || undefined, "data-test-id": SERVICES_CATEGORY_TEST_IDS.services, children: children })] }));
|
|
27
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CardServiceLightProps } from '@cloud-ru/ds-uikit-product-card-predefined';
|
|
2
|
-
import type { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
2
|
import { JSXElementConstructor, MouseEvent, ReactNode } from 'react';
|
|
4
3
|
/**
|
|
5
4
|
* Карточка сервиса или ссылки внутри {@link LinksGroup}.
|
|
@@ -15,10 +14,10 @@ export type InnerLink = {
|
|
|
15
14
|
* Если не задана, вместо иконки рендерится `Avatar` с двухбуквенным текстом по `label`
|
|
16
15
|
* (см. `getAvatarNameFromLabel`).
|
|
17
16
|
*/
|
|
18
|
-
icon?: JSXElementConstructor<
|
|
17
|
+
icon?: JSXElementConstructor<{
|
|
19
18
|
size?: number;
|
|
20
19
|
className?: string;
|
|
21
|
-
}
|
|
20
|
+
}>;
|
|
22
21
|
/** Заголовок карточки. */
|
|
23
22
|
label: string;
|
|
24
23
|
onClick(e?: MouseEvent<HTMLElement>): void;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar } from '@cloud-ru/ds-avatar';
|
|
3
3
|
import { createElement } from 'react';
|
|
4
|
-
import { TEST_IDS } from '../constants.js';
|
|
5
4
|
import { getAvatarNameFromLabel } from './getAvatarNameFromLabel.js';
|
|
6
5
|
function createAvatarIcon(displayName) {
|
|
7
6
|
return function LinkAvatarIcon({ className }) {
|
|
8
|
-
return (_jsx(Avatar, {
|
|
7
|
+
return (_jsx(Avatar, { name: displayName, showTwoSymbols: true, shape: 'squared', appearance: 'neutral', size: 'xs', className: className }));
|
|
9
8
|
};
|
|
10
9
|
}
|
|
11
10
|
export function getLinkEmblem(link) {
|
|
12
11
|
if (!link.icon) {
|
|
13
|
-
return createElement(createAvatarIcon(getAvatarNameFromLabel(link.label))
|
|
14
|
-
'data-test-id': TEST_IDS.getLinkEmblemAvatar,
|
|
15
|
-
});
|
|
12
|
+
return createElement(createAvatarIcon(getAvatarNameFromLabel(link.label)));
|
|
16
13
|
}
|
|
17
|
-
return createElement(link.icon
|
|
14
|
+
return createElement(link.icon);
|
|
18
15
|
}
|
|
19
16
|
export function renderLinkBeforeContent(link) {
|
|
20
17
|
if (!link.icon) {
|
|
21
|
-
return (_jsx(Avatar, {
|
|
18
|
+
return (_jsx(Avatar, { name: getAvatarNameFromLabel(link.label), showTwoSymbols: true, shape: 'squared', appearance: 'neutral', size: 'xs' }));
|
|
22
19
|
}
|
|
23
|
-
return createElement(link.icon
|
|
20
|
+
return createElement(link.icon);
|
|
24
21
|
}
|