@cloud-ru/uikit-product-header 5.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3498 -0
- package/LICENSE +201 -0
- package/README.md +322 -0
- package/dist/cjs/components/HeaderLayout/HeaderLayout.d.ts +12 -0
- package/dist/cjs/components/HeaderLayout/HeaderLayout.js +25 -0
- package/dist/cjs/components/HeaderLayout/index.d.ts +1 -0
- package/dist/cjs/components/HeaderLayout/index.js +17 -0
- package/dist/cjs/components/HeaderLayout/styles.module.css +35 -0
- package/dist/cjs/components/Logo/Logo.d.ts +20 -0
- package/dist/cjs/components/Logo/Logo.js +61 -0
- package/dist/cjs/components/Logo/index.d.ts +1 -0
- package/dist/cjs/components/Logo/index.js +17 -0
- package/dist/cjs/components/Logo/styles.module.css +28 -0
- package/dist/cjs/components/MainMenu/Content/Content.d.ts +20 -0
- package/dist/cjs/components/MainMenu/Content/Content.js +36 -0
- package/dist/cjs/components/MainMenu/Content/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/Content/index.js +17 -0
- package/dist/cjs/components/MainMenu/Content/styles.module.css +40 -0
- package/dist/cjs/components/MainMenu/MainMenu.d.ts +4 -0
- package/dist/cjs/components/MainMenu/MainMenu.js +16 -0
- package/dist/cjs/components/MainMenu/MenuDesktop/MenuDesktop.d.ts +2 -0
- package/dist/cjs/components/MainMenu/MenuDesktop/MenuDesktop.js +34 -0
- package/dist/cjs/components/MainMenu/MenuDesktop/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/MenuDesktop/index.js +17 -0
- package/dist/cjs/components/MainMenu/MenuDesktop/styles.module.css +94 -0
- package/dist/cjs/components/MainMenu/MenuMobile/MenuMobile.d.ts +2 -0
- package/dist/cjs/components/MainMenu/MenuMobile/MenuMobile.js +31 -0
- package/dist/cjs/components/MainMenu/MenuMobile/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/MenuMobile/index.js +17 -0
- package/dist/cjs/components/MainMenu/MenuMobile/styles.module.css +23 -0
- package/dist/cjs/components/MainMenu/Search/SearchDesktop/SearchDesktop.d.ts +2 -0
- package/dist/cjs/components/MainMenu/Search/SearchDesktop/SearchDesktop.js +18 -0
- package/dist/cjs/components/MainMenu/Search/SearchDesktop/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/Search/SearchDesktop/index.js +17 -0
- package/dist/cjs/components/MainMenu/Search/SearchDesktop/styles.module.css +17 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/SearchMobile.d.ts +2 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/SearchMobile.js +42 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/constants.d.ts +4 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/constants.js +7 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/hooks.d.ts +12 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/hooks.js +40 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/index.js +17 -0
- package/dist/cjs/components/MainMenu/Search/SearchMobile/styles.module.css +57 -0
- package/dist/cjs/components/MainMenu/Search/SearchSettingsButton/SearchSettingsButton.d.ts +4 -0
- package/dist/cjs/components/MainMenu/Search/SearchSettingsButton/SearchSettingsButton.js +13 -0
- package/dist/cjs/components/MainMenu/Search/SearchSettingsButton/index.d.ts +1 -0
- package/dist/cjs/components/MainMenu/Search/SearchSettingsButton/index.js +17 -0
- package/dist/cjs/components/MainMenu/Search/SearchSettingsButton/styles.module.css +11 -0
- package/dist/cjs/components/MainMenu/Search/index.d.ts +3 -0
- package/dist/cjs/components/MainMenu/Search/index.js +19 -0
- package/dist/cjs/components/MainMenu/Search/types.d.ts +14 -0
- package/dist/cjs/components/MainMenu/Search/types.js +2 -0
- package/dist/cjs/components/MainMenu/Search/useSearch.d.ts +8 -0
- package/dist/cjs/components/MainMenu/Search/useSearch.js +169 -0
- package/dist/cjs/components/MainMenu/hooks.d.ts +10 -0
- package/dist/cjs/components/MainMenu/hooks.js +108 -0
- package/dist/cjs/components/MainMenu/index.d.ts +4 -0
- package/dist/cjs/components/MainMenu/index.js +20 -0
- package/dist/cjs/components/MainMenu/styles.module.css +28 -0
- package/dist/cjs/components/MainMenu/types.d.ts +49 -0
- package/dist/cjs/components/MainMenu/types.js +2 -0
- package/dist/cjs/components/PathBreadcrumbs/PathBreadcrumbs.d.ts +7 -0
- package/dist/cjs/components/PathBreadcrumbs/PathBreadcrumbs.js +12 -0
- package/dist/cjs/components/PathBreadcrumbs/index.d.ts +1 -0
- package/dist/cjs/components/PathBreadcrumbs/index.js +17 -0
- package/dist/cjs/components/PathBreadcrumbs/styles.module.css +5 -0
- package/dist/cjs/components/PlatformLogo/Container.d.ts +12 -0
- package/dist/cjs/components/PlatformLogo/Container.js +28 -0
- package/dist/cjs/components/PlatformLogo/index.d.ts +4 -0
- package/dist/cjs/components/PlatformLogo/index.js +9 -0
- package/dist/cjs/components/PlatformLogo/styles.module.css +11 -0
- package/dist/cjs/components/UserMenu/UserMenu.d.ts +14 -0
- package/dist/cjs/components/UserMenu/UserMenu.js +54 -0
- package/dist/cjs/components/UserMenu/hooks/useLogoutItem.d.ts +6 -0
- package/dist/cjs/components/UserMenu/hooks/useLogoutItem.js +21 -0
- package/dist/cjs/components/UserMenu/hooks/useProfileItem.d.ts +3 -0
- package/dist/cjs/components/UserMenu/hooks/useProfileItem.js +29 -0
- package/dist/cjs/components/UserMenu/hooks/useThemeItem.d.ts +6 -0
- package/dist/cjs/components/UserMenu/hooks/useThemeItem.js +75 -0
- package/dist/cjs/components/UserMenu/hooks/useUserMenuItems.d.ts +13 -0
- package/dist/cjs/components/UserMenu/hooks/useUserMenuItems.js +42 -0
- package/dist/cjs/components/UserMenu/index.d.ts +2 -0
- package/dist/cjs/components/UserMenu/index.js +18 -0
- package/dist/cjs/components/UserMenu/styles.module.css +21 -0
- package/dist/cjs/components/UserMenu/types.d.ts +20 -0
- package/dist/cjs/components/UserMenu/types.js +8 -0
- package/dist/cjs/components/index.d.ts +6 -0
- package/dist/cjs/components/index.js +22 -0
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.js +17 -0
- package/dist/cjs/hooks/useLocalStorage.d.ts +1 -0
- package/dist/cjs/hooks/useLocalStorage.js +13 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +18 -0
- package/dist/esm/components/HeaderLayout/HeaderLayout.d.ts +12 -0
- package/dist/esm/components/HeaderLayout/HeaderLayout.js +19 -0
- package/dist/esm/components/HeaderLayout/index.d.ts +1 -0
- package/dist/esm/components/HeaderLayout/index.js +1 -0
- package/dist/esm/components/HeaderLayout/styles.module.css +35 -0
- package/dist/esm/components/Logo/Logo.d.ts +20 -0
- package/dist/esm/components/Logo/Logo.js +54 -0
- package/dist/esm/components/Logo/index.d.ts +1 -0
- package/dist/esm/components/Logo/index.js +1 -0
- package/dist/esm/components/Logo/styles.module.css +28 -0
- package/dist/esm/components/MainMenu/Content/Content.d.ts +20 -0
- package/dist/esm/components/MainMenu/Content/Content.js +30 -0
- package/dist/esm/components/MainMenu/Content/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/Content/index.js +1 -0
- package/dist/esm/components/MainMenu/Content/styles.module.css +40 -0
- package/dist/esm/components/MainMenu/MainMenu.d.ts +4 -0
- package/dist/esm/components/MainMenu/MainMenu.js +13 -0
- package/dist/esm/components/MainMenu/MenuDesktop/MenuDesktop.d.ts +2 -0
- package/dist/esm/components/MainMenu/MenuDesktop/MenuDesktop.js +28 -0
- package/dist/esm/components/MainMenu/MenuDesktop/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/MenuDesktop/index.js +1 -0
- package/dist/esm/components/MainMenu/MenuDesktop/styles.module.css +94 -0
- package/dist/esm/components/MainMenu/MenuMobile/MenuMobile.d.ts +2 -0
- package/dist/esm/components/MainMenu/MenuMobile/MenuMobile.js +25 -0
- package/dist/esm/components/MainMenu/MenuMobile/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/MenuMobile/index.js +1 -0
- package/dist/esm/components/MainMenu/MenuMobile/styles.module.css +23 -0
- package/dist/esm/components/MainMenu/Search/SearchDesktop/SearchDesktop.d.ts +2 -0
- package/dist/esm/components/MainMenu/Search/SearchDesktop/SearchDesktop.js +12 -0
- package/dist/esm/components/MainMenu/Search/SearchDesktop/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/Search/SearchDesktop/index.js +1 -0
- package/dist/esm/components/MainMenu/Search/SearchDesktop/styles.module.css +17 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/SearchMobile.d.ts +2 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/SearchMobile.js +36 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/constants.d.ts +4 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/constants.js +4 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/hooks.d.ts +12 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/hooks.js +34 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/index.js +1 -0
- package/dist/esm/components/MainMenu/Search/SearchMobile/styles.module.css +57 -0
- package/dist/esm/components/MainMenu/Search/SearchSettingsButton/SearchSettingsButton.d.ts +4 -0
- package/dist/esm/components/MainMenu/Search/SearchSettingsButton/SearchSettingsButton.js +7 -0
- package/dist/esm/components/MainMenu/Search/SearchSettingsButton/index.d.ts +1 -0
- package/dist/esm/components/MainMenu/Search/SearchSettingsButton/index.js +1 -0
- package/dist/esm/components/MainMenu/Search/SearchSettingsButton/styles.module.css +11 -0
- package/dist/esm/components/MainMenu/Search/index.d.ts +3 -0
- package/dist/esm/components/MainMenu/Search/index.js +3 -0
- package/dist/esm/components/MainMenu/Search/types.d.ts +14 -0
- package/dist/esm/components/MainMenu/Search/types.js +1 -0
- package/dist/esm/components/MainMenu/Search/useSearch.d.ts +8 -0
- package/dist/esm/components/MainMenu/Search/useSearch.js +161 -0
- package/dist/esm/components/MainMenu/hooks.d.ts +10 -0
- package/dist/esm/components/MainMenu/hooks.js +101 -0
- package/dist/esm/components/MainMenu/index.d.ts +4 -0
- package/dist/esm/components/MainMenu/index.js +4 -0
- package/dist/esm/components/MainMenu/styles.module.css +28 -0
- package/dist/esm/components/MainMenu/types.d.ts +49 -0
- package/dist/esm/components/MainMenu/types.js +1 -0
- package/dist/esm/components/PathBreadcrumbs/PathBreadcrumbs.d.ts +7 -0
- package/dist/esm/components/PathBreadcrumbs/PathBreadcrumbs.js +6 -0
- package/dist/esm/components/PathBreadcrumbs/index.d.ts +1 -0
- package/dist/esm/components/PathBreadcrumbs/index.js +1 -0
- package/dist/esm/components/PathBreadcrumbs/styles.module.css +5 -0
- package/dist/esm/components/PlatformLogo/Container.d.ts +12 -0
- package/dist/esm/components/PlatformLogo/Container.js +20 -0
- package/dist/esm/components/PlatformLogo/index.d.ts +4 -0
- package/dist/esm/components/PlatformLogo/index.js +6 -0
- package/dist/esm/components/PlatformLogo/styles.module.css +11 -0
- package/dist/esm/components/UserMenu/UserMenu.d.ts +14 -0
- package/dist/esm/components/UserMenu/UserMenu.js +48 -0
- package/dist/esm/components/UserMenu/hooks/useLogoutItem.d.ts +6 -0
- package/dist/esm/components/UserMenu/hooks/useLogoutItem.js +18 -0
- package/dist/esm/components/UserMenu/hooks/useProfileItem.d.ts +3 -0
- package/dist/esm/components/UserMenu/hooks/useProfileItem.js +23 -0
- package/dist/esm/components/UserMenu/hooks/useThemeItem.d.ts +6 -0
- package/dist/esm/components/UserMenu/hooks/useThemeItem.js +72 -0
- package/dist/esm/components/UserMenu/hooks/useUserMenuItems.d.ts +13 -0
- package/dist/esm/components/UserMenu/hooks/useUserMenuItems.js +39 -0
- package/dist/esm/components/UserMenu/index.d.ts +2 -0
- package/dist/esm/components/UserMenu/index.js +2 -0
- package/dist/esm/components/UserMenu/styles.module.css +21 -0
- package/dist/esm/components/UserMenu/types.d.ts +20 -0
- package/dist/esm/components/UserMenu/types.js +5 -0
- package/dist/esm/components/index.d.ts +6 -0
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useLocalStorage.d.ts +1 -0
- package/dist/esm/hooks/useLocalStorage.js +10 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/package.json +68 -0
- package/src/components/HeaderLayout/HeaderLayout.tsx +46 -0
- package/src/components/HeaderLayout/index.ts +1 -0
- package/src/components/HeaderLayout/styles.module.scss +38 -0
- package/src/components/Logo/Logo.tsx +93 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Logo/styles.module.scss +30 -0
- package/src/components/MainMenu/Content/Content.tsx +137 -0
- package/src/components/MainMenu/Content/index.ts +1 -0
- package/src/components/MainMenu/Content/styles.module.scss +35 -0
- package/src/components/MainMenu/MainMenu.tsx +51 -0
- package/src/components/MainMenu/MenuDesktop/MenuDesktop.tsx +120 -0
- package/src/components/MainMenu/MenuDesktop/index.ts +1 -0
- package/src/components/MainMenu/MenuDesktop/styles.module.scss +108 -0
- package/src/components/MainMenu/MenuMobile/MenuMobile.tsx +83 -0
- package/src/components/MainMenu/MenuMobile/index.ts +1 -0
- package/src/components/MainMenu/MenuMobile/styles.module.scss +26 -0
- package/src/components/MainMenu/Search/SearchDesktop/SearchDesktop.tsx +46 -0
- package/src/components/MainMenu/Search/SearchDesktop/index.ts +1 -0
- package/src/components/MainMenu/Search/SearchDesktop/styles.module.scss +21 -0
- package/src/components/MainMenu/Search/SearchMobile/SearchMobile.tsx +102 -0
- package/src/components/MainMenu/Search/SearchMobile/constants.ts +4 -0
- package/src/components/MainMenu/Search/SearchMobile/hooks.ts +43 -0
- package/src/components/MainMenu/Search/SearchMobile/index.ts +1 -0
- package/src/components/MainMenu/Search/SearchMobile/styles.module.scss +72 -0
- package/src/components/MainMenu/Search/SearchSettingsButton/SearchSettingsButton.tsx +22 -0
- package/src/components/MainMenu/Search/SearchSettingsButton/index.ts +1 -0
- package/src/components/MainMenu/Search/SearchSettingsButton/styles.module.scss +13 -0
- package/src/components/MainMenu/Search/index.ts +3 -0
- package/src/components/MainMenu/Search/types.ts +20 -0
- package/src/components/MainMenu/Search/useSearch.tsx +212 -0
- package/src/components/MainMenu/hooks.tsx +135 -0
- package/src/components/MainMenu/index.ts +4 -0
- package/src/components/MainMenu/styles.module.scss +28 -0
- package/src/components/MainMenu/types.ts +62 -0
- package/src/components/PathBreadcrumbs/PathBreadcrumbs.tsx +21 -0
- package/src/components/PathBreadcrumbs/index.ts +1 -0
- package/src/components/PathBreadcrumbs/styles.module.scss +10 -0
- package/src/components/PlatformLogo/Container.tsx +32 -0
- package/src/components/PlatformLogo/index.ts +8 -0
- package/src/components/PlatformLogo/styles.module.scss +13 -0
- package/src/components/UserMenu/UserMenu.tsx +138 -0
- package/src/components/UserMenu/hooks/useLogoutItem.tsx +28 -0
- package/src/components/UserMenu/hooks/useProfileItem.tsx +41 -0
- package/src/components/UserMenu/hooks/useThemeItem.tsx +116 -0
- package/src/components/UserMenu/hooks/useUserMenuItems.ts +77 -0
- package/src/components/UserMenu/index.ts +2 -0
- package/src/components/UserMenu/styles.module.scss +21 -0
- package/src/components/UserMenu/types.ts +24 -0
- package/src/components/index.ts +6 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useLocalStorage.ts +15 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function useSearchAnimation(): {
|
|
2
|
+
searchRef: import("react").RefObject<HTMLInputElement>;
|
|
3
|
+
toggleSearchActive: () => void;
|
|
4
|
+
isSearchActive: boolean;
|
|
5
|
+
animationState: Readonly<{
|
|
6
|
+
status: import("react-transition-state").TransitionStatus;
|
|
7
|
+
isMounted: boolean;
|
|
8
|
+
isEnter: boolean;
|
|
9
|
+
isResolved: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
searchInputTabIndex: number | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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.useSearchAnimation = useSearchAnimation;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_transition_state_1 = __importDefault(require("react-transition-state"));
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
function useSearchAnimation() {
|
|
11
|
+
const searchRef = (0, react_1.useRef)(null);
|
|
12
|
+
const [isSearchActive, setIsSearchActive] = (0, react_1.useState)(false);
|
|
13
|
+
const searchInputTabIndex = isSearchActive ? undefined : -1;
|
|
14
|
+
const [animationState, toggle] = (0, react_transition_state_1.default)({
|
|
15
|
+
mountOnEnter: true,
|
|
16
|
+
unmountOnExit: true,
|
|
17
|
+
initialEntered: isSearchActive,
|
|
18
|
+
timeout: constants_1.SEARCH_TRANSITION_TIMEOUT,
|
|
19
|
+
});
|
|
20
|
+
(0, react_1.useEffect)(() => toggle(isSearchActive), [isSearchActive]);
|
|
21
|
+
const toggleSearchActive = () => setIsSearchActive(prevState => !prevState);
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
var _a;
|
|
24
|
+
if (isSearchActive) {
|
|
25
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
26
|
+
}
|
|
27
|
+
return () => {
|
|
28
|
+
if (isSearchActive) {
|
|
29
|
+
setIsSearchActive(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, [isSearchActive]);
|
|
33
|
+
return {
|
|
34
|
+
searchRef,
|
|
35
|
+
toggleSearchActive,
|
|
36
|
+
isSearchActive,
|
|
37
|
+
animationState,
|
|
38
|
+
searchInputTabIndex,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SearchMobile';
|
|
@@ -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("./SearchMobile"), exports);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.searchItem{
|
|
2
|
+
position:sticky;
|
|
3
|
+
z-index:1;
|
|
4
|
+
top:-0.5px;
|
|
5
|
+
background-color:var(--sys-neutral-background, #eeeff3);
|
|
6
|
+
display:flex;
|
|
7
|
+
flex-direction:column;
|
|
8
|
+
gap:var(--dimension-1m, 8px);
|
|
9
|
+
padding:0;
|
|
10
|
+
padding-bottom:var(--dimension-1m, 8px);
|
|
11
|
+
padding-top:1px;
|
|
12
|
+
margin-top:7px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.searchWrap{
|
|
16
|
+
position:relative;
|
|
17
|
+
display:flex;
|
|
18
|
+
justify-content:space-between;
|
|
19
|
+
align-items:center;
|
|
20
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.searchMobile{
|
|
24
|
+
position:absolute;
|
|
25
|
+
top:0;
|
|
26
|
+
bottom:0;
|
|
27
|
+
height:100%;
|
|
28
|
+
right:0;
|
|
29
|
+
overflow:hidden;
|
|
30
|
+
display:flex;
|
|
31
|
+
align-items:center;
|
|
32
|
+
transition-timing-function:ease-in-out;
|
|
33
|
+
transition-property:all;
|
|
34
|
+
transition-duration:calc(var(--sc-header-animation-enter) * 1ms);
|
|
35
|
+
width:100%;
|
|
36
|
+
max-width:var(--size-button-m, 40px);
|
|
37
|
+
box-sizing:border-box;
|
|
38
|
+
opacity:0;
|
|
39
|
+
}
|
|
40
|
+
.searchMobile[data-transition-status=entering], .searchMobile[data-transition-status=entered]{
|
|
41
|
+
max-width:100%;
|
|
42
|
+
right:0;
|
|
43
|
+
width:100%;
|
|
44
|
+
opacity:1;
|
|
45
|
+
transition-duration:calc(var(--sc-header-animation-exit) * 1ms);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.searchButton[data-appearance=primary]{
|
|
49
|
+
background-color:var(--sys-neutral-background2-level, #ffffff);
|
|
50
|
+
}
|
|
51
|
+
.searchButton[data-search-active]{
|
|
52
|
+
visibility:hidden;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.searchModalBody{
|
|
56
|
+
padding:var(--dimension-2m, 16px) 0;
|
|
57
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.SearchSettingsButton = SearchSettingsButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const uikit_product_icons_1 = require("@sbercloud/uikit-product-icons");
|
|
9
|
+
const button_1 = require("@snack-uikit/button");
|
|
10
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
11
|
+
function SearchSettingsButton({ onClick }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchSettings, children: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.ConfigurationSVG, {}), size: 'xs', className: styles_module_scss_1.default.searchSettingsButton, onClick: onClick, "data-test-id": 'header__drawer-menu__search-config-button' }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SearchSettingsButton';
|
|
@@ -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("./SearchSettingsButton"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./SearchDesktop"), exports);
|
|
18
|
+
__exportStar(require("./SearchMobile"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LinksGroup } from '../types';
|
|
2
|
+
export type SearchHandler = (searchValue: string, items: LinksGroup[]) => LinksGroup[] | undefined;
|
|
3
|
+
export type SearchFunction = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
handler: SearchHandler;
|
|
7
|
+
};
|
|
8
|
+
export type SearchProps = {
|
|
9
|
+
searchValue: string;
|
|
10
|
+
onSearchValueChange(value: string): void;
|
|
11
|
+
searchFunctions: SearchFunction[];
|
|
12
|
+
onChangeSearchFn(id: string): void;
|
|
13
|
+
searchFn?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SearchProps } from './types';
|
|
2
|
+
export declare enum SearchGroupsAccessor {
|
|
3
|
+
GroupLabelText = "label.text",
|
|
4
|
+
ItemLabelText = "items.label",
|
|
5
|
+
ItemAliases = "items.aliases"
|
|
6
|
+
}
|
|
7
|
+
export declare function toggleLayout(text: string): string;
|
|
8
|
+
export declare function useSearch(): SearchProps;
|
|
@@ -0,0 +1,169 @@
|
|
|
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.SearchGroupsAccessor = void 0;
|
|
7
|
+
exports.toggleLayout = toggleLayout;
|
|
8
|
+
exports.useSearch = useSearch;
|
|
9
|
+
const fuse_js_1 = __importDefault(require("fuse.js"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const uikit_product_locale_1 = require("@sbercloud/uikit-product-locale");
|
|
12
|
+
var SearchGroupsAccessor;
|
|
13
|
+
(function (SearchGroupsAccessor) {
|
|
14
|
+
SearchGroupsAccessor["GroupLabelText"] = "label.text";
|
|
15
|
+
SearchGroupsAccessor["ItemLabelText"] = "items.label";
|
|
16
|
+
SearchGroupsAccessor["ItemAliases"] = "items.aliases";
|
|
17
|
+
})(SearchGroupsAccessor || (exports.SearchGroupsAccessor = SearchGroupsAccessor = {}));
|
|
18
|
+
function matchSearchString(value, search) {
|
|
19
|
+
return value.trim().toLowerCase().includes(search.trim().toLowerCase());
|
|
20
|
+
}
|
|
21
|
+
const prepareItemAccessorKey = (groupId, alias) => `${groupId}-${alias}`;
|
|
22
|
+
function createItemsMap(links) {
|
|
23
|
+
const itemsMap = {};
|
|
24
|
+
links.forEach(group => {
|
|
25
|
+
group.items.forEach(item => {
|
|
26
|
+
item.aliases.forEach(alias => {
|
|
27
|
+
const key = prepareItemAccessorKey(group.id, alias);
|
|
28
|
+
itemsMap[key] = item;
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return itemsMap;
|
|
33
|
+
}
|
|
34
|
+
const enCharacters = "qwertyuiop[]asdfghjkl;'zxcvbnm,./`";
|
|
35
|
+
const ruCharacters = 'йцукенгшщзхъфывапролджэячсмитьбю.ё';
|
|
36
|
+
const enToRuMap = {};
|
|
37
|
+
const ruToEnMap = {};
|
|
38
|
+
for (let i = 0; i < enCharacters.length; i++) {
|
|
39
|
+
enToRuMap[enCharacters[i]] = ruCharacters[i];
|
|
40
|
+
ruToEnMap[ruCharacters[i]] = enCharacters[i];
|
|
41
|
+
}
|
|
42
|
+
function convertLayout(text, direction = 'en-ru') {
|
|
43
|
+
const map = direction === 'en-ru' ? enToRuMap : ruToEnMap;
|
|
44
|
+
return text
|
|
45
|
+
.split('')
|
|
46
|
+
.map(ch => { var _a; return (_a = map[ch]) !== null && _a !== void 0 ? _a : ch; })
|
|
47
|
+
.join('');
|
|
48
|
+
}
|
|
49
|
+
function isCyrillic(text) {
|
|
50
|
+
return /[а-яё]/i.test(text);
|
|
51
|
+
}
|
|
52
|
+
function isLatin(text) {
|
|
53
|
+
return /[a-z]/i.test(text);
|
|
54
|
+
}
|
|
55
|
+
function toggleLayout(text) {
|
|
56
|
+
const lowercaseValue = text.toLowerCase();
|
|
57
|
+
if (isCyrillic(lowercaseValue)) {
|
|
58
|
+
return convertLayout(lowercaseValue, 'ru-en');
|
|
59
|
+
}
|
|
60
|
+
if (isLatin(lowercaseValue)) {
|
|
61
|
+
return convertLayout(lowercaseValue, 'en-ru');
|
|
62
|
+
}
|
|
63
|
+
return text;
|
|
64
|
+
}
|
|
65
|
+
function useSearch() {
|
|
66
|
+
const [searchValue, onSearchValueChange] = (0, react_1.useState)('');
|
|
67
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Header');
|
|
68
|
+
const [searchFn, onChangeSearchFn] = (0, react_1.useState)('fuzzy');
|
|
69
|
+
const searchFunctions = (0, react_1.useMemo)(() => [
|
|
70
|
+
{
|
|
71
|
+
id: 'fuzzy',
|
|
72
|
+
label: t('searchSettingsFuzzyChipLabel'),
|
|
73
|
+
handler: (searchValue, links) => {
|
|
74
|
+
if (!searchValue) {
|
|
75
|
+
return links;
|
|
76
|
+
}
|
|
77
|
+
const itemsMap = createItemsMap(links);
|
|
78
|
+
const linksFuse = new fuse_js_1.default(links, {
|
|
79
|
+
keys: Object.values(SearchGroupsAccessor),
|
|
80
|
+
includeMatches: true,
|
|
81
|
+
threshold: 0.3,
|
|
82
|
+
});
|
|
83
|
+
let fuseSearchResults = linksFuse.search(searchValue);
|
|
84
|
+
if (fuseSearchResults.length < 1) {
|
|
85
|
+
const fixedLayoutValue = toggleLayout(searchValue);
|
|
86
|
+
fuseSearchResults = linksFuse.search(fixedLayoutValue);
|
|
87
|
+
}
|
|
88
|
+
return fuseSearchResults.reduce((accResult, fuseResult) => {
|
|
89
|
+
if (!fuseResult.matches) {
|
|
90
|
+
return accResult;
|
|
91
|
+
}
|
|
92
|
+
const isMatchByGroup = fuseResult.matches.find(match => match.key === SearchGroupsAccessor.GroupLabelText);
|
|
93
|
+
if (isMatchByGroup) {
|
|
94
|
+
accResult.push(fuseResult.item);
|
|
95
|
+
return accResult;
|
|
96
|
+
}
|
|
97
|
+
const group = fuseResult.item;
|
|
98
|
+
const originalGroupIndex = fuseResult.refIndex;
|
|
99
|
+
const itemsInnerMap = {};
|
|
100
|
+
const items = [];
|
|
101
|
+
fuseResult.matches.forEach(match => {
|
|
102
|
+
if (match.refIndex === undefined) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
switch (match.key) {
|
|
106
|
+
case SearchGroupsAccessor.ItemLabelText: {
|
|
107
|
+
const item = links[originalGroupIndex].items[match.refIndex];
|
|
108
|
+
if (item && !itemsInnerMap[item.id]) {
|
|
109
|
+
itemsInnerMap[item.id] = item;
|
|
110
|
+
items.push(item);
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case SearchGroupsAccessor.ItemAliases: {
|
|
115
|
+
if (!match.value) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
const groupId = fuseResult.item.id;
|
|
119
|
+
const alias = match.value;
|
|
120
|
+
const key = prepareItemAccessorKey(groupId, alias);
|
|
121
|
+
const item = itemsMap[key];
|
|
122
|
+
if (item && !itemsInnerMap[item.id]) {
|
|
123
|
+
itemsInnerMap[item.id] = item;
|
|
124
|
+
items.push(item);
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case SearchGroupsAccessor.GroupLabelText:
|
|
129
|
+
default:
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
if (items.length > 0) {
|
|
134
|
+
accResult.push(Object.assign(Object.assign({}, group), { items }));
|
|
135
|
+
}
|
|
136
|
+
return accResult;
|
|
137
|
+
}, []);
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'precise',
|
|
142
|
+
label: t('searchSettingsPreciseChipLabel'),
|
|
143
|
+
handler: (searchValue, links) => {
|
|
144
|
+
if (!searchValue || links.length < 1) {
|
|
145
|
+
return links;
|
|
146
|
+
}
|
|
147
|
+
return links.reduce((result, group) => {
|
|
148
|
+
if (group.label && matchSearchString(group.label.text, searchValue)) {
|
|
149
|
+
result.push(group);
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
const items = group.items.filter(item => matchSearchString(item.label, searchValue));
|
|
153
|
+
if (items.length > 0) {
|
|
154
|
+
result.push(Object.assign(Object.assign({}, group), { items }));
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}, []);
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
], [t]);
|
|
162
|
+
return {
|
|
163
|
+
searchValue,
|
|
164
|
+
onSearchValueChange,
|
|
165
|
+
searchFunctions,
|
|
166
|
+
onChangeSearchFn,
|
|
167
|
+
searchFn,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LinksGroup, MainMenuProps } from './types';
|
|
2
|
+
export declare function useHighlight(className: string): (elementToHighlight?: HTMLElement | null) => void;
|
|
3
|
+
type UseMenuItemsProps = Pick<MainMenuProps, 'favorite' | 'serviceGroups' | 'search'>;
|
|
4
|
+
export declare function useMenuItems({ search, serviceGroups, favorite }: UseMenuItemsProps): {
|
|
5
|
+
resultItems: LinksGroup[];
|
|
6
|
+
groupItems: import("@snack-uikit/list/dist/esm/components/Items").BaseItem[];
|
|
7
|
+
searchRef: import("react").RefObject<HTMLInputElement>;
|
|
8
|
+
scrollRef: import("react").RefObject<HTMLDivElement>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
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.useHighlight = useHighlight;
|
|
7
|
+
exports.useMenuItems = useMenuItems;
|
|
8
|
+
const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const uikit_product_locale_1 = require("@sbercloud/uikit-product-locale");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
function useHighlight(className) {
|
|
13
|
+
const element = (0, react_1.useRef)();
|
|
14
|
+
const highlight = (0, react_1.useMemo)(() => {
|
|
15
|
+
const scheduleHighlight = (0, lodash_debounce_1.default)(() => {
|
|
16
|
+
var _a;
|
|
17
|
+
(_a = element.current) === null || _a === void 0 ? void 0 : _a.classList.add(className);
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = element.current) === null || _a === void 0 ? void 0 : _a.classList.remove(className);
|
|
21
|
+
element.current = undefined;
|
|
22
|
+
}, 300, { trailing: false });
|
|
23
|
+
}, 80);
|
|
24
|
+
return (elementToHighlight) => {
|
|
25
|
+
if (elementToHighlight) {
|
|
26
|
+
element.current = elementToHighlight;
|
|
27
|
+
}
|
|
28
|
+
scheduleHighlight();
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
[]);
|
|
33
|
+
return highlight;
|
|
34
|
+
}
|
|
35
|
+
function useMenuItems({ search, serviceGroups, favorite }) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Header');
|
|
38
|
+
const { searchValue = '', searchFn, searchFunctions, onSearchValueChange } = search || {};
|
|
39
|
+
const searchRef = (0, react_1.useRef)(null);
|
|
40
|
+
const scrollRef = (0, react_1.useRef)(null);
|
|
41
|
+
const highlight = useHighlight(styles_module_scss_1.default.highlight);
|
|
42
|
+
const groupWithFavorites = (0, react_1.useMemo)(() => {
|
|
43
|
+
if (!favorite || !favorite.value) {
|
|
44
|
+
return serviceGroups;
|
|
45
|
+
}
|
|
46
|
+
const flatMapItems = serviceGroups.flatMap(serviceGroup => serviceGroup.items);
|
|
47
|
+
const favoriteServices = favorite.value.reduce((acc, cur) => {
|
|
48
|
+
const item = flatMapItems.find(item => item.id === cur);
|
|
49
|
+
if (item) {
|
|
50
|
+
acc.push(item);
|
|
51
|
+
}
|
|
52
|
+
return acc;
|
|
53
|
+
}, []);
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
id: 'favorite',
|
|
57
|
+
label: {
|
|
58
|
+
text: t('favorite'),
|
|
59
|
+
},
|
|
60
|
+
items: favoriteServices,
|
|
61
|
+
},
|
|
62
|
+
].concat(serviceGroups);
|
|
63
|
+
}, [favorite, serviceGroups, t]);
|
|
64
|
+
const groupItems = groupWithFavorites
|
|
65
|
+
.filter(group => group.items.length > 0)
|
|
66
|
+
.map(({ id, label: { text } }) => ({
|
|
67
|
+
id,
|
|
68
|
+
content: {
|
|
69
|
+
option: text,
|
|
70
|
+
truncate: {
|
|
71
|
+
option: 2,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
onClick() {
|
|
75
|
+
onSearchValueChange === null || onSearchValueChange === void 0 ? void 0 : onSearchValueChange('');
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
// TODO: remove or move
|
|
79
|
+
// eslint-disable-next-line @cloud-ru/ssr-safe-react/domApi
|
|
80
|
+
const element = document.getElementById(id);
|
|
81
|
+
if (!element)
|
|
82
|
+
return;
|
|
83
|
+
(_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
84
|
+
left: 0,
|
|
85
|
+
top: element.offsetTop - (((_b = searchRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0),
|
|
86
|
+
behavior: 'smooth',
|
|
87
|
+
});
|
|
88
|
+
// Задержка approximately равна времени скроллинга
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
highlight(element);
|
|
91
|
+
}, 500);
|
|
92
|
+
}, 0);
|
|
93
|
+
},
|
|
94
|
+
}));
|
|
95
|
+
const searchFnMap = searchFunctions === null || searchFunctions === void 0 ? void 0 : searchFunctions.reduce((acc, cur) => {
|
|
96
|
+
acc[cur.id] = cur.handler;
|
|
97
|
+
return acc;
|
|
98
|
+
}, {});
|
|
99
|
+
const itemsWithoutEmptyGroups = groupWithFavorites.filter(group => group.items.length > 0);
|
|
100
|
+
const resultItems = ((_b = (searchFn ? searchFnMap === null || searchFnMap === void 0 ? void 0 : searchFnMap[searchFn] : (_a = searchFunctions === null || searchFunctions === void 0 ? void 0 : searchFunctions[0]) === null || _a === void 0 ? void 0 : _a.handler)) === null || _b === void 0 ? void 0 : _b(searchValue, itemsWithoutEmptyGroups)) ||
|
|
101
|
+
itemsWithoutEmptyGroups;
|
|
102
|
+
return {
|
|
103
|
+
resultItems,
|
|
104
|
+
groupItems,
|
|
105
|
+
searchRef,
|
|
106
|
+
scrollRef,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./MainMenu"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./Search/useSearch"), exports);
|
|
20
|
+
__exportStar(require("./Search/types"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.highlight{
|
|
2
|
+
animation:shake-animation 300ms ease 1;
|
|
3
|
+
transform-origin:100% 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
@keyframes shake-animation{
|
|
7
|
+
0%{
|
|
8
|
+
transform:translate(0, 0);
|
|
9
|
+
}
|
|
10
|
+
18%{
|
|
11
|
+
transform:translate(5px, 0);
|
|
12
|
+
}
|
|
13
|
+
35%{
|
|
14
|
+
transform:translate(0, 0);
|
|
15
|
+
}
|
|
16
|
+
53%{
|
|
17
|
+
transform:translate(5px, 0);
|
|
18
|
+
}
|
|
19
|
+
71%{
|
|
20
|
+
transform:translate(0, 0);
|
|
21
|
+
}
|
|
22
|
+
89%{
|
|
23
|
+
transform:translate(3px, 0);
|
|
24
|
+
}
|
|
25
|
+
100%{
|
|
26
|
+
transform:translate(0, 0);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JSXElementConstructor, MouseEvent, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { CardServiceSmallProps } from '@sbercloud/uikit-product-card-predefined';
|
|
3
|
+
import { ListProps } from '@snack-uikit/list';
|
|
4
|
+
import { SearchProps } from './Search/types';
|
|
5
|
+
export type InnerLink = {
|
|
6
|
+
id: string;
|
|
7
|
+
icon: JSXElementConstructor<{
|
|
8
|
+
size?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
}>;
|
|
11
|
+
label: string;
|
|
12
|
+
onClick(e?: MouseEvent<HTMLElement>): void;
|
|
13
|
+
href?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
hidden?: boolean;
|
|
16
|
+
badge?: CardServiceSmallProps['promoBadge'];
|
|
17
|
+
aliases: string[];
|
|
18
|
+
};
|
|
19
|
+
type TitleStatic = {
|
|
20
|
+
text: string;
|
|
21
|
+
onClick?: never;
|
|
22
|
+
};
|
|
23
|
+
type TitleClickable = {
|
|
24
|
+
text: string;
|
|
25
|
+
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
26
|
+
};
|
|
27
|
+
export type LinksGroupTitle = TitleStatic | TitleClickable;
|
|
28
|
+
export type LinksGroup = {
|
|
29
|
+
id: string;
|
|
30
|
+
label: LinksGroupTitle;
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
items: InnerLink[];
|
|
33
|
+
};
|
|
34
|
+
export type MainMenuProps = {
|
|
35
|
+
open?: boolean;
|
|
36
|
+
setOpen?(open: boolean): void;
|
|
37
|
+
leftTop?: ReactNode;
|
|
38
|
+
rightTop?: ReactNode;
|
|
39
|
+
settingItems: ListProps['items'];
|
|
40
|
+
serviceGroups: LinksGroup[];
|
|
41
|
+
onLinkChange?(value: string): void;
|
|
42
|
+
favorite?: {
|
|
43
|
+
value: string[];
|
|
44
|
+
onChange: (productId: string) => (addingValue: boolean) => void;
|
|
45
|
+
};
|
|
46
|
+
search?: SearchProps;
|
|
47
|
+
isMobile?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BreadcrumbsProps } from '@snack-uikit/breadcrumbs';
|
|
2
|
+
type PathBreadcrumbsProps = {
|
|
3
|
+
items: BreadcrumbsProps['items'];
|
|
4
|
+
isMobile?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function PathBreadcrumbs({ isMobile, items }: PathBreadcrumbsProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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.PathBreadcrumbs = PathBreadcrumbs;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const breadcrumbs_1 = require("@snack-uikit/breadcrumbs");
|
|
9
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
10
|
+
function PathBreadcrumbs({ isMobile, items }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(breadcrumbs_1.Breadcrumbs, { items: items, className: styles_module_scss_1.default.breadcrumbs, inactiveLastItem: items.length > 1, separator: '/', size: isMobile ? 'xs' : 's', "data-test-id": 'header__breadcrumbs' }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PathBreadcrumbs';
|