@redocly/theme 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Navbar/MobileNavbarMenu.d.ts +2 -3
- package/lib/components/Navbar/MobileNavbarMenu.js +4 -16
- package/lib/components/Navbar/Navbar.js +1 -1
- package/lib/components/Search/CancelSearch.d.ts +4 -0
- package/lib/components/Search/CancelSearch.js +63 -0
- package/lib/components/Search/ClearIcon.js +0 -1
- package/lib/components/Search/ClockBackwardsIcon.d.ts +5 -0
- package/lib/components/Search/ClockBackwardsIcon.js +26 -0
- package/lib/components/Search/Input.js +1 -5
- package/lib/components/Search/InputWrapper.d.ts +10 -0
- package/lib/components/Search/InputWrapper.js +86 -0
- package/lib/components/Search/MobileSearchTrigger.d.ts +4 -0
- package/lib/components/Search/MobileSearchTrigger.js +51 -0
- package/lib/components/Search/RecentSearches.d.ts +4 -0
- package/lib/components/Search/RecentSearches.js +129 -0
- package/lib/components/Search/Search.js +28 -26
- package/lib/components/Search/SearchDialog.d.ts +4 -0
- package/lib/components/Search/SearchDialog.js +136 -0
- package/lib/components/Search/SearchIcon.js +0 -2
- package/lib/components/Search/SearchItem.js +31 -7
- package/lib/components/Search/SearchTrigger.d.ts +4 -0
- package/lib/components/Search/SearchTrigger.js +80 -0
- package/lib/components/Search/Shortcut.d.ts +5 -0
- package/lib/components/Search/Shortcut.js +51 -0
- package/lib/components/Search/ShortcutKey.js +2 -7
- package/lib/components/Search/SuggestedPages.d.ts +2 -0
- package/lib/components/Search/SuggestedPages.js +107 -0
- package/lib/components/Search/index.d.ts +8 -2
- package/lib/components/Search/index.js +8 -2
- package/lib/components/Search/utils.js +2 -2
- package/lib/components/Tabs/Tab.d.ts +2 -1
- package/lib/components/Tabs/Tab.js +2 -2
- package/lib/components/Tabs/Tabs.d.ts +1 -0
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/config.d.ts +19 -0
- package/lib/config.js +12 -0
- package/lib/globalStyle.js +22 -11
- package/lib/hooks/useDialogHotKeys.d.ts +2 -0
- package/lib/hooks/useDialogHotKeys.js +45 -0
- package/lib/icons/SpinnerIcon/SpinnerIcon.js +0 -2
- package/lib/mocks/search.d.ts +10 -1
- package/lib/mocks/search.js +19 -1
- package/lib/types/portal/src/shared/types/activeItem.d.ts +1 -1
- package/lib/ui/darkColors.js +6 -1
- package/package.json +3 -3
- package/src/components/Navbar/MobileNavbarMenu.tsx +0 -14
- package/src/components/Navbar/Navbar.tsx +1 -5
- package/src/components/Search/CancelSearch.tsx +42 -0
- package/src/components/Search/ClearIcon.tsx +0 -1
- package/src/components/Search/ClockBackwardsIcon.tsx +26 -0
- package/src/components/Search/Input.tsx +1 -5
- package/src/components/Search/InputWrapper.tsx +93 -0
- package/src/components/Search/MobileSearchTrigger.tsx +27 -0
- package/src/components/Search/RecentSearches.tsx +127 -0
- package/src/components/Search/Search.tsx +35 -37
- package/src/components/Search/SearchDialog.tsx +162 -0
- package/src/components/Search/SearchIcon.tsx +0 -2
- package/src/components/Search/SearchItem.tsx +59 -10
- package/src/components/Search/SearchTrigger.tsx +62 -0
- package/src/components/Search/Shortcut.tsx +32 -0
- package/src/components/Search/ShortcutKey.tsx +2 -7
- package/src/components/Search/SuggestedPages.tsx +101 -0
- package/src/components/Search/index.ts +8 -2
- package/src/components/Search/utils.tsx +2 -2
- package/src/components/Tabs/Tab.tsx +3 -1
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/config.ts +15 -0
- package/src/globalStyle.ts +22 -11
- package/src/hooks/useDialogHotKeys.ts +48 -0
- package/src/icons/SpinnerIcon/SpinnerIcon.tsx +0 -2
- package/src/mocks/search.ts +19 -1
- package/src/types/portal/src/shared/types/activeItem.ts +1 -1
- package/src/ui/darkColors.tsx +6 -1
- package/lib/components/Search/Autocomplete.d.ts +0 -16
- package/lib/components/Search/Autocomplete.js +0 -132
- package/lib/components/Search/Parameters.d.ts +0 -7
- package/lib/components/Search/Parameters.js +0 -55
- package/src/components/Search/Autocomplete.tsx +0 -162
- package/src/components/Search/Parameters.tsx +0 -61
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { ResolvedConfigLinks } from '../../types/portal';
|
|
3
|
-
export declare function MobileNavbarMenu({ menuItems, closeMenu,
|
|
3
|
+
export declare function MobileNavbarMenu({ menuItems, closeMenu, }: {
|
|
4
4
|
menuItems: ResolvedConfigLinks;
|
|
5
|
-
search: React.ReactNode | undefined;
|
|
6
5
|
closeMenu: () => void;
|
|
7
6
|
}): JSX.Element | null;
|
|
@@ -10,16 +10,14 @@ const NavbarItem_1 = require("../../components/Navbar/NavbarItem");
|
|
|
10
10
|
const MobileNavbarItem_1 = require("../../components/Navbar/MobileNavbarItem");
|
|
11
11
|
const NavbarDropdown_1 = require("../../components/Navbar/NavbarDropdown");
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
|
-
function MobileNavbarMenu({ menuItems, closeMenu,
|
|
13
|
+
function MobileNavbarMenu({ menuItems, closeMenu, }) {
|
|
14
14
|
if ((0, utils_1.isPrimitive)(menuItems) || (0, utils_1.isEmptyArray)(menuItems)) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
return (react_1.default.createElement(NavbarItemsWrapper, { "data-component-name": "Navbar/MobileNavbarMenu" },
|
|
18
|
-
react_1.default.createElement(NavbarItemsContainer, null,
|
|
19
|
-
react_1.default.createElement(
|
|
20
|
-
|
|
21
|
-
return (react_1.default.createElement(MobileNavbarItem_1.MobileNavbarItem, { key: `${navItem.label}_${index}`, "data-cy": navItem.label, navItem: navItem }));
|
|
22
|
-
})),
|
|
18
|
+
react_1.default.createElement(NavbarItemsContainer, null, menuItems.map((navItem, index) => {
|
|
19
|
+
return (react_1.default.createElement(MobileNavbarItem_1.MobileNavbarItem, { key: `${navItem.label}_${index}`, "data-cy": navItem.label, navItem: navItem }));
|
|
20
|
+
})),
|
|
23
21
|
react_1.default.createElement(NavbarItemsClosableArea, { onClick: closeMenu })));
|
|
24
22
|
}
|
|
25
23
|
exports.MobileNavbarMenu = MobileNavbarMenu;
|
|
@@ -91,14 +89,4 @@ const NavbarItemsContainer = styled_components_1.default.ul `
|
|
|
91
89
|
position: relative;
|
|
92
90
|
}
|
|
93
91
|
`;
|
|
94
|
-
const MobileSearchWrapper = styled_components_1.default.div `
|
|
95
|
-
padding: var(--navbar-item-padding-horizontal);
|
|
96
|
-
> div {
|
|
97
|
-
display: block;
|
|
98
|
-
width: 100%;
|
|
99
|
-
}
|
|
100
|
-
input {
|
|
101
|
-
width: 100%;
|
|
102
|
-
}
|
|
103
|
-
`;
|
|
104
92
|
//# sourceMappingURL=MobileNavbarMenu.js.map
|
|
@@ -82,7 +82,7 @@ function NavbarPresentational(props) {
|
|
|
82
82
|
const { menuItemsExist, closeMobileMenu, openMobileMenu, isOpen, hideSearch, logo, menu, hideUserProfile, changeLanguage, } = props;
|
|
83
83
|
return (react_1.default.createElement(exports.NavbarContainer, { "data-component-name": "Navbar/Navbar" },
|
|
84
84
|
menuItemsExist && react_1.default.createElement(MobileNavbarMenuButton_1.MobileNavbarMenuButton, { onClick: openMobileMenu }),
|
|
85
|
-
isOpen && (react_1.default.createElement(MobileNavbarMenu_1.MobileNavbarMenu, { closeMenu: closeMobileMenu, menuItems: menu
|
|
85
|
+
isOpen && (react_1.default.createElement(MobileNavbarMenu_1.MobileNavbarMenu, { closeMenu: closeMobileMenu, menuItems: menu })),
|
|
86
86
|
react_1.default.createElement(exports.NavbarRow, null,
|
|
87
87
|
react_1.default.createElement(NavbarLogo_1.NavbarLogo, { logo: logo }),
|
|
88
88
|
react_1.default.createElement(Navbar_1.NavbarMenu, { menuItems: menu }),
|
|
@@ -0,0 +1,63 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.CancelSearch = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
33
|
+
function CancelSearch({ onClick }) {
|
|
34
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
35
|
+
const translationKeys = {
|
|
36
|
+
cancel: 'theme.search.cancel',
|
|
37
|
+
};
|
|
38
|
+
return (React.createElement(Wrapper, { "data-component-name": "Search/CancelSearch", onClick: onClick },
|
|
39
|
+
React.createElement(Button, { "data-translation-keys": translationKeys.cancel }, translate(translationKeys.cancel, 'Cancel'))));
|
|
40
|
+
}
|
|
41
|
+
exports.CancelSearch = CancelSearch;
|
|
42
|
+
const Button = styled_components_1.default.div `
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
align-items: center;
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
padding: 4px 16px;
|
|
49
|
+
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
50
|
+
border-radius: 6px;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
line-height: 22px;
|
|
53
|
+
height: 32px;
|
|
54
|
+
`;
|
|
55
|
+
const Wrapper = styled_components_1.default.div `
|
|
56
|
+
display: flex;
|
|
57
|
+
padding: 12px 16px 16px;
|
|
58
|
+
|
|
59
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
//# sourceMappingURL=CancelSearch.js.map
|
|
@@ -11,7 +11,6 @@ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xm
|
|
|
11
11
|
exports.ClearIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
12
12
|
'data-component-name': 'Search/ClearIcon',
|
|
13
13
|
})) `
|
|
14
|
-
position: absolute;
|
|
15
14
|
cursor: pointer;
|
|
16
15
|
width: 0.5em;
|
|
17
16
|
height: 0.5em;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
export declare const ClockBackwardsIcon: import("styled-components").StyledComponent<(props: SVGProps<SVGSVGElement>) => JSX.Element, any, {
|
|
3
|
+
'data-component-name': string;
|
|
4
|
+
className: string | undefined;
|
|
5
|
+
}, "className" | "data-component-name">;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.ClockBackwardsIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "16", height: "16", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
10
|
+
react_1.default.createElement("path", { d: "M10.295 11L7.5 8.205V3.5H8.5V7.79L11 10.295L10.295 11Z" }),
|
|
11
|
+
react_1.default.createElement("path", { d: "M8 1C7.06748 1.00013 6.14446 1.18739 5.28562 1.55068C4.42677 1.91397 3.64955 2.44591 3 3.115V1H2V5H6V4H3.54C4.47801 2.95765 5.75149 2.27676 7.13926 2.0756C8.52703 1.87444 9.94142 2.16571 11.1368 2.89882C12.3322 3.63193 13.233 4.76057 13.6829 6.08873C14.1327 7.41689 14.1032 8.86066 13.5993 10.1693C13.0955 11.4779 12.1492 12.5688 10.9249 13.2523C9.7005 13.9359 8.27537 14.1691 6.897 13.9113C5.51862 13.6535 4.27407 12.9211 3.3795 11.8412C2.48492 10.7614 1.99683 9.40227 2 8H1C1 9.38447 1.41054 10.7378 2.17971 11.889C2.94888 13.0401 4.04213 13.9373 5.32122 14.4672C6.6003 14.997 8.00776 15.1356 9.36563 14.8655C10.7235 14.5954 11.9708 13.9287 12.9497 12.9497C13.9287 11.9708 14.5954 10.7235 14.8655 9.36563C15.1356 8.00776 14.997 6.6003 14.4672 5.32122C13.9373 4.04213 13.0401 2.94888 11.889 2.17971C10.7378 1.41054 9.38447 1 8 1Z" })));
|
|
12
|
+
exports.ClockBackwardsIcon = (0, styled_components_1.default)(Icon).attrs(({ className }) => ({
|
|
13
|
+
'data-component-name': 'Search/RecentlyViewedIcon',
|
|
14
|
+
className,
|
|
15
|
+
})) `
|
|
16
|
+
width: 0.5em;
|
|
17
|
+
height: 0.5em;
|
|
18
|
+
right: 1em;
|
|
19
|
+
fill: var(--search-input-text-color);
|
|
20
|
+
|
|
21
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
22
|
+
width: 0.625em;
|
|
23
|
+
height: 0.625em;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
//# sourceMappingURL=ClockBackwardsIcon.js.map
|
|
@@ -17,14 +17,10 @@ exports.FormInput = styled_components_1.default.input.attrs(() => ({
|
|
|
17
17
|
font-size: var(--search-input-font-size);
|
|
18
18
|
font-family: var(--search-input-font-family);
|
|
19
19
|
line-height: var(--search-input-line-height);
|
|
20
|
+
width: 100%;
|
|
20
21
|
|
|
21
22
|
::placeholder {
|
|
22
23
|
color: var(--search-input-placeholder-color);
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
&:hover {
|
|
26
|
-
background-color: var(--search-input-hover-background-color);
|
|
27
|
-
border: var(--search-input-hover-border);
|
|
28
|
-
}
|
|
29
25
|
`;
|
|
30
26
|
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface InputWrapperProps {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
value: string;
|
|
5
|
+
change(value: string): void;
|
|
6
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function InputWrapper({ placeholder, value, change, isLoading, }: InputWrapperProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.InputWrapper = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const Input_1 = require("../../components/Search/Input");
|
|
33
|
+
const SearchIcon_1 = require("../../components/Search/SearchIcon");
|
|
34
|
+
const SpinnerIcon_1 = require("../../icons/SpinnerIcon");
|
|
35
|
+
const ClearIcon_1 = require("../../components/Search/ClearIcon");
|
|
36
|
+
function InputWrapper({ placeholder, value, change, isLoading, }) {
|
|
37
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
38
|
+
const refInput = (0, react_1.useRef)(null);
|
|
39
|
+
const onFocus = () => setIsFocused(true);
|
|
40
|
+
const close = () => {
|
|
41
|
+
setIsFocused(false);
|
|
42
|
+
};
|
|
43
|
+
const reset = () => {
|
|
44
|
+
change('');
|
|
45
|
+
close();
|
|
46
|
+
};
|
|
47
|
+
const stopPropagation = (event) => event.stopPropagation();
|
|
48
|
+
const onChange = (event) => {
|
|
49
|
+
setIsFocused(true);
|
|
50
|
+
change(event.target.value);
|
|
51
|
+
};
|
|
52
|
+
return (react_1.default.createElement(Wrapper, { "data-component-name": "Search/InputContainer" },
|
|
53
|
+
isFocused && isLoading ? react_1.default.createElement(SpinnerIcon, null) : react_1.default.createElement(SearchIcon, null),
|
|
54
|
+
react_1.default.createElement(Input_1.FormInput, { value: value, placeholder: placeholder, onChange: onChange, onFocus: onFocus, onClick: stopPropagation, ref: refInput }),
|
|
55
|
+
!!value && react_1.default.createElement(ClearIcon, { onClick: reset })));
|
|
56
|
+
}
|
|
57
|
+
exports.InputWrapper = InputWrapper;
|
|
58
|
+
const Wrapper = styled_components_1.default.div `
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
padding: 12px 16px;
|
|
62
|
+
height: 56px;
|
|
63
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
|
64
|
+
background-color: var(--search-input-background-color);
|
|
65
|
+
border-radius: 0;
|
|
66
|
+
|
|
67
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
68
|
+
border-radius: 8px 8px 0 0;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const SearchIcon = (0, styled_components_1.default)(SearchIcon_1.SearchIcon) `
|
|
72
|
+
width: 20px;
|
|
73
|
+
height: 20px;
|
|
74
|
+
fill: var(--search-input-placeholder-color);
|
|
75
|
+
`;
|
|
76
|
+
const SpinnerIcon = (0, styled_components_1.default)(SpinnerIcon_1.SpinnerIcon) `
|
|
77
|
+
width: 20px;
|
|
78
|
+
height: 20px;
|
|
79
|
+
fill: var(--search-input-placeholder-color);
|
|
80
|
+
`;
|
|
81
|
+
const ClearIcon = (0, styled_components_1.default)(ClearIcon_1.ClearIcon) `
|
|
82
|
+
width: 12px;
|
|
83
|
+
height: 12px;
|
|
84
|
+
fill: var(--search-input-placeholder-color);
|
|
85
|
+
`;
|
|
86
|
+
//# sourceMappingURL=InputWrapper.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.MobileSearchTrigger = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const SearchIcon_1 = require("../../components/Search/SearchIcon");
|
|
33
|
+
function MobileSearchTrigger({ onClick }) {
|
|
34
|
+
return (React.createElement(Wrapper, { "data-component-name": "Search/MobileSearchTrigger", onClick: onClick },
|
|
35
|
+
React.createElement(SearchIcon, null)));
|
|
36
|
+
}
|
|
37
|
+
exports.MobileSearchTrigger = MobileSearchTrigger;
|
|
38
|
+
const SearchIcon = (0, styled_components_1.default)(SearchIcon_1.SearchIcon) `
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
fill: #8d8d8d;
|
|
42
|
+
`;
|
|
43
|
+
const Wrapper = styled_components_1.default.div `
|
|
44
|
+
display: block;
|
|
45
|
+
user-select: none;
|
|
46
|
+
|
|
47
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
//# sourceMappingURL=MobileSearchTrigger.js.map
|
|
@@ -0,0 +1,129 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.RecentSearches = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const ClockBackwardsIcon_1 = require("../../components/Search/ClockBackwardsIcon");
|
|
33
|
+
const ClearIcon_1 = require("../../components/Search/ClearIcon");
|
|
34
|
+
const search_1 = require("../../mocks/search");
|
|
35
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
36
|
+
function RecentSearches({ onSelect }) {
|
|
37
|
+
const { items, removeSearchHistoryItem } = (0, search_1.useRecentSearches)();
|
|
38
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
39
|
+
const translationKeys = {
|
|
40
|
+
title: 'theme.search.recent',
|
|
41
|
+
};
|
|
42
|
+
if (!items || !items.length)
|
|
43
|
+
return null;
|
|
44
|
+
const removeItem = (e, item) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
removeSearchHistoryItem(item);
|
|
47
|
+
};
|
|
48
|
+
const handleKeyDown = (e, item) => {
|
|
49
|
+
if (e.key === 'Enter') {
|
|
50
|
+
onSelect(item);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (React.createElement(Wrapper, { "data-component-name": "Search/RecentSearches" },
|
|
54
|
+
React.createElement(Title, { "data-translation-key": translationKeys.title }, translate(translationKeys.title, 'Recent searches')),
|
|
55
|
+
React.createElement(RecentItems, null, items.map((item) => (React.createElement(Item, { key: item, onClick: () => onSelect(item), onKeyDown: (e) => handleKeyDown(e, item), tabIndex: 0, role: "link" },
|
|
56
|
+
React.createElement(Group, null,
|
|
57
|
+
React.createElement(ClockBackwardsIcon, null),
|
|
58
|
+
item),
|
|
59
|
+
React.createElement(ClearIcon, { onClick: (e) => removeItem(e, item) })))))));
|
|
60
|
+
}
|
|
61
|
+
exports.RecentSearches = RecentSearches;
|
|
62
|
+
const Wrapper = styled_components_1.default.div `
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
`;
|
|
66
|
+
const Title = styled_components_1.default.div `
|
|
67
|
+
color: var(--search-item-title-text-color);
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
font-size: var(--font-size-small);
|
|
70
|
+
line-height: 20px;
|
|
71
|
+
padding: 8px 24px;
|
|
72
|
+
`;
|
|
73
|
+
const RecentItems = styled_components_1.default.div `
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
align-items: flex-start;
|
|
77
|
+
padding: 0px 12px 12px;
|
|
78
|
+
`;
|
|
79
|
+
const ClockBackwardsIcon = (0, styled_components_1.default)(ClockBackwardsIcon_1.ClockBackwardsIcon) `
|
|
80
|
+
width: 16px;
|
|
81
|
+
height: 16px;
|
|
82
|
+
fill: #8d8d8d;
|
|
83
|
+
`;
|
|
84
|
+
const ClearIcon = (0, styled_components_1.default)(ClearIcon_1.ClearIcon) `
|
|
85
|
+
display: inline;
|
|
86
|
+
width: 10px;
|
|
87
|
+
height: 10px;
|
|
88
|
+
fill: var(--search-item-active-text-color))
|
|
89
|
+
`;
|
|
90
|
+
const Item = styled_components_1.default.div `
|
|
91
|
+
display: flex;
|
|
92
|
+
font-size: var(--font-size-base);
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
align-items: center;
|
|
95
|
+
padding: 8px 12px;
|
|
96
|
+
color: var(--search-item-text-color);
|
|
97
|
+
width: 100%;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
|
|
100
|
+
:hover {
|
|
101
|
+
background-color: var(--search-item-active-background-color);
|
|
102
|
+
color: var(--search-item-active-text-color);
|
|
103
|
+
|
|
104
|
+
${ClockBackwardsIcon} {
|
|
105
|
+
fill: var(--search-item-active-text-color);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
${ClearIcon} {
|
|
109
|
+
display: inline;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:focus-visible {
|
|
114
|
+
outline: 2px solid var(--color-primary-200);
|
|
115
|
+
border-radius: 2px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
119
|
+
${ClearIcon} {
|
|
120
|
+
display: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
const Group = styled_components_1.default.div `
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: 8px;
|
|
128
|
+
`;
|
|
129
|
+
//# sourceMappingURL=RecentSearches.js.map
|
|
@@ -27,41 +27,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.Search = void 0;
|
|
30
|
-
const
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
33
|
+
const hotkeys_js_1 = __importDefault(require("hotkeys-js"));
|
|
34
|
+
const SearchTrigger_1 = require("../../components/Search/SearchTrigger");
|
|
35
|
+
const MobileSearchTrigger_1 = require("../../components/Search/MobileSearchTrigger");
|
|
36
|
+
const SearchDialog_1 = require("../../components/Search/SearchDialog");
|
|
35
37
|
const hooks_1 = require("../../hooks");
|
|
36
|
-
const usePreloadHistory_1 = require("../../mocks/usePreloadHistory");
|
|
37
|
-
const hooks_2 = require("../../mocks/hooks");
|
|
38
38
|
function Search() {
|
|
39
|
-
|
|
40
|
-
const
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
41
41
|
const themeSettings = (0, hooks_1.useThemeConfig)();
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const location = (0, react_router_dom_1.useLocation)();
|
|
43
|
+
const keyShortcuts = (_b = (_a = themeSettings === null || themeSettings === void 0 ? void 0 : themeSettings.search) === null || _a === void 0 ? void 0 : _a.shortcuts) !== null && _b !== void 0 ? _b : ['/'];
|
|
44
|
+
const hotkeysKeys = keyShortcuts === null || keyShortcuts === void 0 ? void 0 : keyShortcuts.join(',');
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
if (hotkeysKeys) {
|
|
47
|
+
(0, hotkeys_js_1.default)(hotkeysKeys, (ev) => {
|
|
48
|
+
setIsOpen(true);
|
|
49
|
+
ev.preventDefault();
|
|
50
|
+
});
|
|
51
|
+
return () => hotkeys_js_1.default.unbind(hotkeysKeys);
|
|
52
|
+
}
|
|
53
|
+
}, [hotkeysKeys]);
|
|
54
|
+
const onClose = (0, react_1.useCallback)(() => {
|
|
55
|
+
setIsOpen(false);
|
|
56
|
+
}, []);
|
|
57
|
+
(0, react_1.useEffect)(onClose, [location, onClose]);
|
|
58
|
+
return (react_1.default.createElement(Wrapper, { "data-component-name": "Search/Search" },
|
|
59
|
+
react_1.default.createElement(SearchTrigger_1.SearchTrigger, { onClick: () => setIsOpen(true) }),
|
|
60
|
+
react_1.default.createElement(MobileSearchTrigger_1.MobileSearchTrigger, { onClick: () => setIsOpen(true) }),
|
|
61
|
+
isOpen && react_1.default.createElement(SearchDialog_1.SearchDialog, { onClose: onClose })));
|
|
50
62
|
}
|
|
51
63
|
exports.Search = Search;
|
|
52
64
|
const Wrapper = styled_components_1.default.div `
|
|
53
65
|
margin-left: auto;
|
|
54
66
|
|
|
55
67
|
padding: 0 var(--navbar-item-padding-horizontal);
|
|
56
|
-
|
|
57
|
-
display: none;
|
|
58
|
-
|
|
59
|
-
${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.small; }} {
|
|
60
|
-
display: block;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.medium; }} {
|
|
64
|
-
margin: 0 auto;
|
|
65
|
-
}
|
|
66
68
|
`;
|
|
67
69
|
//# sourceMappingURL=Search.js.map
|