@redocly/theme 0.17.1 → 0.18.1
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/I18n/LanguagePicker.js +53 -85
- package/lib/components/Catalog/Catalog.d.ts +1 -1
- package/lib/components/Catalog/useCatalog.d.ts +2 -1
- package/lib/components/Dropdown/Dropdown.d.ts +16 -0
- package/lib/components/Dropdown/Dropdown.js +113 -0
- package/lib/components/Dropdown/index.d.ts +1 -0
- package/lib/components/Dropdown/index.js +18 -0
- package/lib/components/Menu/MenuGroup.js +2 -0
- package/lib/components/Menu/MenuItem.js +2 -0
- package/lib/components/Menu/MobileMenu.d.ts +2 -9
- package/lib/components/Menu/MobileMenu.js +35 -65
- package/lib/components/Menu/MobileMenuGroup.js +2 -0
- package/lib/components/Menu/constants.d.ts +5 -0
- package/lib/components/Menu/constants.js +10 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.d.ts +2 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.js +83 -0
- package/lib/components/Menu/hooks/use-mobile-menu-levels.d.ts +5 -0
- package/lib/components/Menu/hooks/use-mobile-menu-levels.js +50 -0
- package/lib/components/Menu/types.d.ts +3 -0
- package/lib/components/Menu/types.js +3 -0
- package/lib/components/Menu/utils.d.ts +7 -0
- package/lib/components/Menu/utils.js +76 -0
- package/lib/components/Navbar/MobileUserProfile.d.ts +1 -1
- package/lib/components/Navbar/MobileUserProfile.js +4 -7
- package/lib/components/Navbar/Navbar.d.ts +0 -3
- package/lib/components/Navbar/Navbar.js +9 -12
- package/lib/components/Navbar/NavbarItem.d.ts +5 -1
- package/lib/components/Navbar/NavbarItem.js +15 -16
- package/lib/components/Navbar/NavbarMenu.js +1 -1
- package/lib/components/OpenApiDocs/Dropdown.js +5 -5
- package/lib/components/Product/Product.d.ts +7 -0
- package/lib/components/Product/Product.js +23 -0
- package/lib/components/Product/ProductPicker.d.ts +2 -0
- package/lib/components/Product/ProductPicker.js +83 -0
- package/lib/components/Product/index.d.ts +2 -0
- package/lib/components/Product/index.js +19 -0
- package/lib/components/Profile/UserProfile.js +54 -6
- package/lib/components/Search/InputWrapper.js +1 -7
- package/lib/components/Search/ProductTag.d.ts +6 -0
- package/lib/components/Search/ProductTag.js +61 -0
- package/lib/components/Search/SearchDialog.js +19 -4
- package/lib/components/Search/SearchItem.d.ts +2 -1
- package/lib/components/Search/SearchItem.js +13 -2
- package/lib/components/Search/index.d.ts +1 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Select/Select.d.ts +18 -0
- package/lib/components/Select/Select.js +118 -0
- package/lib/components/Select/index.d.ts +1 -0
- package/lib/components/Select/index.js +18 -0
- package/lib/components/Sidebar/DrilldownMenuItem.js +2 -9
- package/lib/components/Sidebar/SidebarItemIcon.d.ts +1 -0
- package/lib/components/Sidebar/SidebarItemIcon.js +16 -0
- package/lib/components/Sidebar/VersionPicker.d.ts +7 -0
- package/lib/components/Sidebar/VersionPicker.js +51 -0
- package/lib/components/Sidebar/index.d.ts +2 -0
- package/lib/components/Sidebar/index.js +2 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/config.d.ts +952 -25
- package/lib/config.js +115 -2
- package/lib/globalStyle.js +177 -16
- package/lib/hooks/useThemeConfig.d.ts +1 -1
- package/lib/hooks/useThemeConfig.js +7 -2
- package/lib/mocks/hooks/index.d.ts +4 -3
- package/lib/mocks/hooks/index.js +6 -2
- package/lib/mocks/search.d.ts +1 -1
- package/lib/mocks/search.js +1 -1
- package/lib/types/portal/src/shared/types/catalog.d.ts +2 -24
- package/lib/types/portal/src/shared/types/nav.d.ts +4 -0
- package/lib/types/portal/src/shared/types/searchDocument.d.ts +2 -0
- package/lib/ui/darkColors.js +2 -0
- package/lib/ui/index.d.ts +0 -1
- package/lib/ui/index.js +0 -1
- package/package.json +1 -1
- package/src/I18n/LanguagePicker.tsx +62 -89
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/useCatalog.ts +2 -3
- package/src/components/Dropdown/Dropdown.tsx +138 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Menu/MenuGroup.tsx +2 -0
- package/src/components/Menu/MenuItem.tsx +2 -0
- package/src/components/Menu/MobileMenu.tsx +43 -96
- package/src/components/Menu/MobileMenuGroup.tsx +2 -0
- package/src/components/Menu/constants.ts +5 -0
- package/src/components/Menu/hooks/use-mobile-menu-items.ts +100 -0
- package/src/components/Menu/hooks/use-mobile-menu-levels.ts +55 -0
- package/src/components/Menu/types.ts +3 -0
- package/src/components/Menu/utils.ts +109 -0
- package/src/components/Navbar/MobileUserProfile.tsx +19 -20
- package/src/components/Navbar/Navbar.tsx +12 -22
- package/src/components/Navbar/NavbarItem.tsx +20 -15
- package/src/components/Navbar/NavbarMenu.tsx +1 -1
- package/src/components/OpenApiDocs/Dropdown.tsx +5 -5
- package/src/components/Product/Product.tsx +28 -0
- package/src/components/Product/ProductPicker.tsx +97 -0
- package/src/components/Product/index.ts +2 -0
- package/src/components/Profile/UserProfile.tsx +80 -21
- package/src/components/Search/InputWrapper.tsx +1 -7
- package/src/components/Search/ProductTag.tsx +46 -0
- package/src/components/Search/SearchDialog.tsx +21 -5
- package/src/components/Search/SearchItem.tsx +17 -3
- package/src/components/Search/index.ts +1 -0
- package/src/components/Select/Select.tsx +140 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Sidebar/DrilldownMenuItem.tsx +2 -10
- package/src/components/Sidebar/SidebarItemIcon.tsx +10 -0
- package/src/components/Sidebar/VersionPicker.tsx +48 -0
- package/src/components/Sidebar/index.ts +2 -0
- package/src/components/index.ts +3 -0
- package/src/config.ts +140 -6
- package/src/globalStyle.ts +181 -16
- package/src/hooks/useThemeConfig.ts +18 -3
- package/src/mocks/hooks/index.ts +9 -3
- package/src/mocks/search.ts +1 -1
- package/src/types/portal/src/shared/types/catalog.ts +2 -26
- package/src/types/portal/src/shared/types/i18n.d.ts +3 -1
- package/src/types/portal/src/shared/types/nav.ts +41 -37
- package/src/types/portal/src/shared/types/searchDocument.ts +7 -4
- package/src/ui/darkColors.tsx +2 -0
- package/src/ui/index.tsx +0 -1
- package/lib/components/Navbar/NavbarDropdown.d.ts +0 -9
- package/lib/components/Navbar/NavbarDropdown.js +0 -40
- package/lib/components/Profile/UserProfileMenu.d.ts +0 -8
- package/lib/components/Profile/UserProfileMenu.js +0 -93
- package/src/components/Navbar/NavbarDropdown.tsx +0 -48
- package/src/components/Profile/UserProfileMenu.tsx +0 -97
|
@@ -30,17 +30,65 @@ exports.UserProfile = void 0;
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Profile_1 = require("../../components/Profile/Profile");
|
|
33
|
-
const
|
|
34
|
-
const
|
|
33
|
+
const Link_1 = require("../../mocks/Link");
|
|
34
|
+
const useThemeConfig_1 = require("../../hooks/useThemeConfig");
|
|
35
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
36
|
+
const Dropdown_1 = require("../../components/Dropdown");
|
|
35
37
|
function UserProfile({ userData, handleLogout, hasDeveloperOnboarding = false, }) {
|
|
38
|
+
const { userProfile } = (0, useThemeConfig_1.useThemeConfig)();
|
|
39
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
40
|
+
const translationKeys = {
|
|
41
|
+
myApps: 'theme.profile.myApps',
|
|
42
|
+
logout: 'theme.profile.logout',
|
|
43
|
+
};
|
|
36
44
|
const [isOpened, setIsOpened] = (0, react_1.useState)(false);
|
|
37
|
-
|
|
45
|
+
const menuItems = [];
|
|
46
|
+
if (hasDeveloperOnboarding) {
|
|
47
|
+
menuItems.push(react_1.default.createElement(Link_1.Link, { to: "/apps", "data-translation-key": translationKeys.myApps }, translate(translationKeys.myApps, 'My Apps')));
|
|
48
|
+
}
|
|
49
|
+
if (userProfile && userProfile.menu) {
|
|
50
|
+
for (const item of userProfile.menu) {
|
|
51
|
+
menuItems.push(react_1.default.createElement(Link_1.Link, { external: item.external, key: item.label, to: item.link || '', separator: item === null || item === void 0 ? void 0 : item.separatorLine }, item.label));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
menuItems.push(react_1.default.createElement(Logout, { onClick: () => handleLogout(), "data-translation-key": translationKeys.logout, role: "link" }, translate(translationKeys.logout, (userProfile === null || userProfile === void 0 ? void 0 : userProfile.logoutLabel) || 'Log out')));
|
|
55
|
+
return (react_1.default.createElement(ProfileDropdown, { items: menuItems },
|
|
38
56
|
react_1.default.createElement(Profile_1.Profile, { name: userData.name, imageUrl: userData.picture, onClick: userData.logoutDisabled ? undefined : () => setIsOpened(!isOpened) })));
|
|
39
57
|
}
|
|
40
58
|
exports.UserProfile = UserProfile;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
const ProfileDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown).attrs(() => ({
|
|
60
|
+
dataAttributes: {
|
|
61
|
+
'data-component-name': 'Profile/ProfileDropdown',
|
|
62
|
+
},
|
|
63
|
+
})) `
|
|
64
|
+
font-size: var(--profile-dropdown-font-size);
|
|
65
|
+
font-weight: var(--profile-dropdown-font-weight);
|
|
66
|
+
line-height: var(--profile-dropdown-line-height);
|
|
67
|
+
border-radius: var(--profile-dropdown-border-radius);
|
|
68
|
+
color: var(--profile-dropdown-text-color);
|
|
69
|
+
|
|
70
|
+
${Dropdown_1.DropdownList} {
|
|
71
|
+
right: 0;
|
|
72
|
+
min-width: var(--profile-dropdown-list-min-width);
|
|
73
|
+
max-width: var(--profile-dropdown-list-max-width);
|
|
74
|
+
padding: var(--profile-dropdown-list-padding);
|
|
75
|
+
background-color: var(--profile-dropdown-list-background-color);
|
|
76
|
+
border-radius: var(--profile-dropdown-list-border-radius);
|
|
77
|
+
box-shadow: var(--profile-dropdown-list-box-shadow);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
${Dropdown_1.DropdownListItem} {
|
|
81
|
+
border-radius: var(--profile-dropdown-list-item-border-radius);
|
|
82
|
+
|
|
83
|
+
& > * {
|
|
84
|
+
padding: var(--profile-dropdown-list-item-vertical-padding)
|
|
85
|
+
var(--profile-dropdown-list-item-horizontal-padding);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:hover {
|
|
89
|
+
background-color: var(--profile-dropdown-list-item-active-background-color);
|
|
90
|
+
}
|
|
44
91
|
}
|
|
45
92
|
`;
|
|
93
|
+
const Logout = styled_components_1.default.div ``;
|
|
46
94
|
//# sourceMappingURL=UserProfile.js.map
|
|
@@ -57,16 +57,10 @@ function InputWrapper({ placeholder, value, change, isLoading, className, }) {
|
|
|
57
57
|
exports.InputWrapper = InputWrapper;
|
|
58
58
|
const Wrapper = styled_components_1.default.div `
|
|
59
59
|
display: flex;
|
|
60
|
+
flex-grow: 1;
|
|
60
61
|
align-items: center;
|
|
61
62
|
padding: 12px 16px;
|
|
62
63
|
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
64
|
`;
|
|
71
65
|
const SearchIcon = (0, styled_components_1.default)(SearchIcon_1.SearchIcon) `
|
|
72
66
|
width: 20px;
|
|
@@ -0,0 +1,61 @@
|
|
|
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.ProductTag = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const ClearIcon_1 = require("../../components/Search/ClearIcon");
|
|
33
|
+
function ProductTag({ label, className, onRemove, }) {
|
|
34
|
+
return (React.createElement(Wrapper, { "data-component-name": "Search/ProductTag", className: className },
|
|
35
|
+
React.createElement(Label, null, label),
|
|
36
|
+
onRemove && React.createElement(ClearIcon, { onClick: onRemove })));
|
|
37
|
+
}
|
|
38
|
+
exports.ProductTag = ProductTag;
|
|
39
|
+
const Wrapper = styled_components_1.default.div `
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
align-items: center;
|
|
43
|
+
padding: 1px 8px;
|
|
44
|
+
gap: 4px;
|
|
45
|
+
background: #f2f2f2;
|
|
46
|
+
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
47
|
+
border-radius: 12px;
|
|
48
|
+
margin-right: 16px;
|
|
49
|
+
`;
|
|
50
|
+
const Label = styled_components_1.default.span `
|
|
51
|
+
color: #1f2933;
|
|
52
|
+
font-weight: 400;
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
line-height: 20px;
|
|
55
|
+
`;
|
|
56
|
+
const ClearIcon = (0, styled_components_1.default)(ClearIcon_1.ClearIcon) `
|
|
57
|
+
width: 8px;
|
|
58
|
+
height: 8px;
|
|
59
|
+
fill: var(--search-input-placeholder-color);
|
|
60
|
+
`;
|
|
61
|
+
//# sourceMappingURL=ProductTag.js.map
|
|
@@ -39,8 +39,11 @@ const RecentSearches_1 = require("../../components/Search/RecentSearches");
|
|
|
39
39
|
const SuggestedPages_1 = require("../../components/Search/SuggestedPages");
|
|
40
40
|
const CancelSearch_1 = require("../../components/Search/CancelSearch");
|
|
41
41
|
const useDialogHotKeys_1 = require("../../hooks/useDialogHotKeys");
|
|
42
|
+
const ProductTag_1 = require("../../components/Search/ProductTag");
|
|
42
43
|
const SearchDialog = ({ onClose, className, }) => {
|
|
43
|
-
const
|
|
44
|
+
const currentProduct = (0, hooks_1.useCurrentProduct)();
|
|
45
|
+
const [product, setProduct] = (0, react_1.useState)(currentProduct);
|
|
46
|
+
const { query, setQuery, items, isLoading } = (0, search_1.useFuseSearch)(product === null || product === void 0 ? void 0 : product.name);
|
|
44
47
|
const modalRef = (0, react_1.useRef)(null);
|
|
45
48
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
46
49
|
(0, useDialogHotKeys_1.useDialogHotKeys)(modalRef, onClose);
|
|
@@ -60,12 +63,14 @@ const SearchDialog = ({ onClose, className, }) => {
|
|
|
60
63
|
exit: 'theme.search.keys.exit',
|
|
61
64
|
};
|
|
62
65
|
const mapItem = (item) => {
|
|
63
|
-
|
|
66
|
+
var _a;
|
|
67
|
+
return (react_1.default.createElement(SearchItem_1.SearchItem, { key: item.id, item: item, product: !product ? (_a = item.product) === null || _a === void 0 ? void 0 : _a.name : undefined }));
|
|
64
68
|
};
|
|
65
69
|
return (react_1.default.createElement(Overlay, { "data-component-name": "Search/SearchDialog", ref: modalRef, onClick: handleOverlayClick, className: (0, utils_1.concatClassNames)('overlay', className) },
|
|
66
70
|
react_1.default.createElement(Container, null,
|
|
67
71
|
react_1.default.createElement(TopContainer, null,
|
|
68
|
-
react_1.default.createElement(InputWrapper_1.InputWrapper, { value: query, change: setQuery, placeholder: translate('theme.search.label', 'Search docs...'), isLoading: isLoading })
|
|
72
|
+
react_1.default.createElement(InputWrapper_1.InputWrapper, { value: query, change: setQuery, placeholder: translate('theme.search.label', 'Search docs...'), isLoading: isLoading }),
|
|
73
|
+
product && react_1.default.createElement(ProductTag_1.ProductTag, { label: product.name, onRemove: () => setProduct(undefined) })),
|
|
69
74
|
react_1.default.createElement(Results, null, items !== null ? (items.length ? (items.map(mapItem)) : (react_1.default.createElement(Message, { "data-translation-key": translationKeys.noResults }, translate(translationKeys.noResults, 'No results')))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
70
75
|
react_1.default.createElement(RecentSearches_1.RecentSearches, { onSelect: setQuery }),
|
|
71
76
|
react_1.default.createElement(SuggestedPages_1.SuggestedPages, null)))),
|
|
@@ -133,5 +138,15 @@ const Message = styled_components_1.default.div `
|
|
|
133
138
|
padding: 24px;
|
|
134
139
|
color: var(--search-item-title-text-color);
|
|
135
140
|
`;
|
|
136
|
-
const TopContainer = styled_components_1.default.header
|
|
141
|
+
const TopContainer = styled_components_1.default.header `
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
|
145
|
+
background-color: var(--search-input-background-color);
|
|
146
|
+
border-radius: 0;
|
|
147
|
+
|
|
148
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
149
|
+
border-radius: 8px 8px 0 0;
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
137
152
|
//# sourceMappingURL=SearchDialog.js.map
|
|
@@ -3,7 +3,8 @@ import type { ActiveItem } from '../../types/portal/src/shared/types/activeItem'
|
|
|
3
3
|
import type { SearchDocument } from '../../types/portal/src/shared/types/searchDocument';
|
|
4
4
|
interface SearchItemProps {
|
|
5
5
|
item: ActiveItem<SearchDocument>;
|
|
6
|
+
product?: string;
|
|
6
7
|
className?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function SearchItem({ item, className }: SearchItemProps): JSX.Element;
|
|
9
|
+
export declare function SearchItem({ item, className, product }: SearchItemProps): JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -32,7 +32,8 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
32
32
|
const OperationBadge_1 = require("../../components/OperationBadge");
|
|
33
33
|
const Link_1 = require("../../mocks/Link");
|
|
34
34
|
const utils_1 = require("../../components/Search/utils");
|
|
35
|
-
|
|
35
|
+
const ProductTag_1 = require("../../components/Search/ProductTag");
|
|
36
|
+
function SearchItem({ item, className, product }) {
|
|
36
37
|
var _a, _b;
|
|
37
38
|
const ref = (0, react_1.useRef)();
|
|
38
39
|
(0, react_1.useEffect)(() => {
|
|
@@ -41,7 +42,8 @@ function SearchItem({ item, className }) {
|
|
|
41
42
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
42
43
|
}
|
|
43
44
|
}, [item.active]);
|
|
44
|
-
const header = (react_1.default.createElement(
|
|
45
|
+
const header = (react_1.default.createElement(Wrapper, null,
|
|
46
|
+
product && react_1.default.createElement(ProductTag, { label: product }),
|
|
45
47
|
item.httpVerb ? (react_1.default.createElement(Operation, null,
|
|
46
48
|
react_1.default.createElement(OperationBadge_1.OperationBadge, { type: item.httpVerb }, item.httpVerb),
|
|
47
49
|
item.pathName ? (0, utils_1.highlight)(item.pathName) : null)) : null,
|
|
@@ -62,6 +64,9 @@ function SearchItem({ item, className }) {
|
|
|
62
64
|
react_1.default.createElement(Path, null, (_b = item.path) === null || _b === void 0 ? void 0 : _b.join(' → '))))));
|
|
63
65
|
}
|
|
64
66
|
exports.SearchItem = SearchItem;
|
|
67
|
+
const Wrapper = styled_components_1.default.div `
|
|
68
|
+
position: relative;
|
|
69
|
+
`;
|
|
65
70
|
const Title = styled_components_1.default.div `
|
|
66
71
|
font-weight: var(--font-weight-regular);
|
|
67
72
|
color: var(--search-item-title-text-color);
|
|
@@ -119,4 +124,10 @@ const Place = styled_components_1.default.div `
|
|
|
119
124
|
padding-top: 0;
|
|
120
125
|
}
|
|
121
126
|
`;
|
|
127
|
+
const ProductTag = (0, styled_components_1.default)(ProductTag_1.ProductTag) `
|
|
128
|
+
position: absolute;
|
|
129
|
+
right: 0;
|
|
130
|
+
top: 6px;
|
|
131
|
+
margin-right: 0;
|
|
132
|
+
`;
|
|
122
133
|
//# sourceMappingURL=SearchItem.js.map
|
|
@@ -12,4 +12,5 @@ export * from '../../components/Search/ClockBackwardsIcon';
|
|
|
12
12
|
export * from '../../components/Search/SuggestedPages';
|
|
13
13
|
export * from '../../components/Search/MobileSearchTrigger';
|
|
14
14
|
export * from '../../components/Search/CancelSearch';
|
|
15
|
+
export * from '../../components/Search/ProductTag';
|
|
15
16
|
export * from '../../components/Search/utils';
|
|
@@ -28,5 +28,6 @@ __exportStar(require("../../components/Search/ClockBackwardsIcon"), exports);
|
|
|
28
28
|
__exportStar(require("../../components/Search/SuggestedPages"), exports);
|
|
29
29
|
__exportStar(require("../../components/Search/MobileSearchTrigger"), exports);
|
|
30
30
|
__exportStar(require("../../components/Search/CancelSearch"), exports);
|
|
31
|
+
__exportStar(require("../../components/Search/ProductTag"), exports);
|
|
31
32
|
__exportStar(require("../../components/Search/utils"), exports);
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SelectProps {
|
|
3
|
+
selected: React.ReactNode | string;
|
|
4
|
+
options: React.ReactNode[] | string[];
|
|
5
|
+
dataAttributes?: Record<string, string>;
|
|
6
|
+
className?: string;
|
|
7
|
+
withArrow?: boolean;
|
|
8
|
+
triggerEvent?: 'click' | 'hover';
|
|
9
|
+
onChange?: (value: React.ReactNode | string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Select: ({ className, selected, options, dataAttributes, withArrow, triggerEvent, onChange, }: SelectProps) => JSX.Element;
|
|
12
|
+
export declare const SelectContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const SelectInput: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const SelectInputValue: import("styled-components").StyledComponent<"div", any, {
|
|
15
|
+
withArrow?: boolean | undefined;
|
|
16
|
+
}, never>;
|
|
17
|
+
export declare const SelectList: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
18
|
+
export declare const SelectListItem: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
@@ -0,0 +1,118 @@
|
|
|
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.SelectListItem = exports.SelectList = exports.SelectInputValue = exports.SelectInput = exports.SelectContainer = exports.Select = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const icons_1 = require("../../icons");
|
|
33
|
+
const hooks_1 = require("../../hooks");
|
|
34
|
+
const Select = ({ className, selected, options, dataAttributes, withArrow, triggerEvent = 'click', onChange, }) => {
|
|
35
|
+
const selectRef = (0, react_1.useRef)(null);
|
|
36
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
37
|
+
const [_selected, setSelected] = (0, react_1.useState)(selected);
|
|
38
|
+
const handleOpen = () => {
|
|
39
|
+
setIsOpen(true);
|
|
40
|
+
};
|
|
41
|
+
const handleClose = () => {
|
|
42
|
+
setIsOpen(false);
|
|
43
|
+
};
|
|
44
|
+
const handleToggle = () => {
|
|
45
|
+
setIsOpen(!isOpen);
|
|
46
|
+
};
|
|
47
|
+
const handleSelect = (value) => {
|
|
48
|
+
setSelected(value);
|
|
49
|
+
setIsOpen(false);
|
|
50
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
51
|
+
};
|
|
52
|
+
(0, hooks_1.useOutsideClick)(selectRef, handleClose);
|
|
53
|
+
(0, react_1.useEffect)(() => {
|
|
54
|
+
handleSelect(selected);
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
}, [selected]);
|
|
57
|
+
return (react_1.default.createElement(exports.SelectContainer, Object.assign({}, dataAttributes, { "data-testid": "select", className: className, ref: selectRef, onPointerEnter: triggerEvent === 'hover' ? handleOpen : undefined, onPointerLeave: triggerEvent === 'hover' ? handleClose : undefined, onClick: triggerEvent === 'click' ? handleToggle : undefined }),
|
|
58
|
+
react_1.default.createElement(exports.SelectInput, null,
|
|
59
|
+
react_1.default.createElement(exports.SelectInputValue, { withArrow: withArrow }, _selected),
|
|
60
|
+
withArrow ? isOpen ? react_1.default.createElement(icons_1.ArrowIcon, { direction: "up" }) : react_1.default.createElement(icons_1.ArrowIcon, { direction: "down" }) : null),
|
|
61
|
+
isOpen && (react_1.default.createElement(exports.SelectList, null, options.map((option, index) => (react_1.default.createElement(exports.SelectListItem, { key: index, onClick: () => handleSelect(option) }, option)))))));
|
|
62
|
+
};
|
|
63
|
+
exports.Select = Select;
|
|
64
|
+
exports.SelectContainer = styled_components_1.default.div `
|
|
65
|
+
position: relative;
|
|
66
|
+
font-size: var(--select-font-size);
|
|
67
|
+
font-weight: var(--select-font-weight);
|
|
68
|
+
line-height: var(--select-line-height);
|
|
69
|
+
border-radius: var(--select-border-radius);
|
|
70
|
+
color: var(--select-text-color);
|
|
71
|
+
|
|
72
|
+
a {
|
|
73
|
+
display: block;
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
color: var(--select-text-color);
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
exports.SelectInput = styled_components_1.default.div `
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
border-radius: var(--select-input-border-radius);
|
|
83
|
+
padding: var(--select-input-padding-vertical) var(--select-input-padding-horizontal);
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
`;
|
|
86
|
+
exports.SelectInputValue = styled_components_1.default.div `
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
${({ withArrow }) => (withArrow ? 'margin-right: 8px;' : '')}
|
|
89
|
+
`;
|
|
90
|
+
exports.SelectList = styled_components_1.default.ul `
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: 100%;
|
|
93
|
+
left: 0;
|
|
94
|
+
margin: 0;
|
|
95
|
+
min-width: var(--select-list-min-width);
|
|
96
|
+
max-width: var(--select-list-max-width);
|
|
97
|
+
padding: var(--select-list-padding);
|
|
98
|
+
background-color: var(--select-list-background-color);
|
|
99
|
+
border-radius: var(--select-list-border-radius);
|
|
100
|
+
box-shadow: var(--select-list-box-shadow);
|
|
101
|
+
list-style-type: none;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
z-index: 1;
|
|
106
|
+
`;
|
|
107
|
+
exports.SelectListItem = styled_components_1.default.li `
|
|
108
|
+
border-radius: var(--select-list-item-border-radius);
|
|
109
|
+
|
|
110
|
+
& > * {
|
|
111
|
+
padding: var(--select-list-item-vertical-padding) var(--select-list-item-horizontal-padding);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:hover {
|
|
115
|
+
background-color: var(--select-list-item-active-background-color);
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../components/Select/Select';
|
|
@@ -0,0 +1,18 @@
|
|
|
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("../../components/Select/Select"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.DrilldownMenuItem = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const SidebarItemIcon_1 = require("../../components/Sidebar/SidebarItemIcon");
|
|
9
10
|
const hooks_1 = require("../../mocks/hooks");
|
|
10
11
|
function DrilldownMenuItem({ item, className }) {
|
|
11
12
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
12
13
|
return (react_1.default.createElement(Container, { "data-component-name": "Sidebar/DrilldownMenuItem", className: className },
|
|
13
|
-
item.icon ? react_1.default.createElement(
|
|
14
|
+
item.icon ? react_1.default.createElement(SidebarItemIcon_1.SidebarItemIcon, { src: item.icon }) : null,
|
|
14
15
|
react_1.default.createElement("div", null,
|
|
15
16
|
translate(item.labelTranslationKey, item.label),
|
|
16
17
|
item.sublabel ? (react_1.default.createElement(SubLabel, null, translate(item.subLabelTranslationKey, item.sublabel))) : null)));
|
|
@@ -26,14 +27,6 @@ const Container = styled_components_1.default.div `
|
|
|
26
27
|
text-transform: var(--sidebar-text-drilldown-transform);
|
|
27
28
|
background: var(--sidebar-item-drilldown-background-color);
|
|
28
29
|
`;
|
|
29
|
-
const Icon = styled_components_1.default.img `
|
|
30
|
-
width: var(--sidebar-item-icon-size);
|
|
31
|
-
height: var(--sidebar-item-icon-size);
|
|
32
|
-
margin-right: var(--sidebar-spacing-unit);
|
|
33
|
-
border-radius: var(--sidebar-item-icon-border-radius);
|
|
34
|
-
flex-shrink: 0;
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
`;
|
|
37
30
|
const SubLabel = styled_components_1.default.div `
|
|
38
31
|
margin-top: 2px;
|
|
39
32
|
color: var(--sidebar-item-sublabel-text-color);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SidebarItemIcon: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SidebarItemIcon = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.SidebarItemIcon = styled_components_1.default.img `
|
|
9
|
+
width: var(--sidebar-item-icon-size);
|
|
10
|
+
height: var(--sidebar-item-icon-size);
|
|
11
|
+
margin-right: var(--sidebar-spacing-unit);
|
|
12
|
+
border-radius: var(--sidebar-item-icon-border-radius);
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
`;
|
|
16
|
+
//# sourceMappingURL=SidebarItemIcon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { SelectProps } from '../Select';
|
|
3
|
+
export declare const VersionPicker: import("styled-components").StyledComponent<({ className, selected, options, dataAttributes, withArrow, triggerEvent, onChange, }: SelectProps) => JSX.Element, any, {
|
|
4
|
+
dataAttributes: {
|
|
5
|
+
'data-component-name': string;
|
|
6
|
+
};
|
|
7
|
+
} & SelectProps, "dataAttributes">;
|
|
@@ -0,0 +1,51 @@
|
|
|
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.VersionPicker = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const Select_1 = require("../Select");
|
|
9
|
+
exports.VersionPicker = (0, styled_components_1.default)(Select_1.Select).attrs(() => ({
|
|
10
|
+
dataAttributes: {
|
|
11
|
+
'data-component-name': 'Sidebar/VersionPicker',
|
|
12
|
+
},
|
|
13
|
+
})) `
|
|
14
|
+
font-size: var(--version-picker-font-size);
|
|
15
|
+
font-weight: var(--version-picker-font-weight);
|
|
16
|
+
border-radius: var(--version-picker-border-radius);
|
|
17
|
+
line-height: var(--version-picker-line-height);
|
|
18
|
+
color: var(--version-picker-text-color);
|
|
19
|
+
margin: var(--version-picker-margin-vertical) var(--version-picker-margin-horizontal);
|
|
20
|
+
|
|
21
|
+
${Select_1.SelectInput} {
|
|
22
|
+
border: var(--version-picker-input-border);
|
|
23
|
+
border-radius: var(--version-picker-input-border-radius);
|
|
24
|
+
padding: var(--version-picker-input-padding-vertical)
|
|
25
|
+
var(--version-picker-input-padding-horizontal);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
${Select_1.SelectList} {
|
|
29
|
+
right: 0;
|
|
30
|
+
min-width: var(--version-picker-list-min-width);
|
|
31
|
+
max-width: var(--version-picker-list-max-width);
|
|
32
|
+
padding: var(--version-picker-list-padding);
|
|
33
|
+
background-color: var(--version-picker-list-background-color);
|
|
34
|
+
border-radius: var(--version-picker-list-border-radius);
|
|
35
|
+
box-shadow: var(--version-picker-list-box-shadow);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${Select_1.SelectListItem} {
|
|
39
|
+
border-radius: var(--version-picker-list-item-border-radius);
|
|
40
|
+
|
|
41
|
+
& > * {
|
|
42
|
+
padding: var(--version-picker-list-item-vertical-padding)
|
|
43
|
+
var(--version-picker-list-item-horizontal-padding);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:hover {
|
|
47
|
+
background-color: var(--version-picker-list-item-active-background-color);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
//# sourceMappingURL=VersionPicker.js.map
|
|
@@ -9,3 +9,5 @@ export * from '../../components/Sidebar/Sidebar';
|
|
|
9
9
|
export * from '../../components/Sidebar/SidebarLayout';
|
|
10
10
|
export * from '../../components/Sidebar/FooterWrapper';
|
|
11
11
|
export * from '../../components/Sidebar/HeaderWrapper';
|
|
12
|
+
export * from '../../components/Sidebar/SidebarItemIcon';
|
|
13
|
+
export * from '../../components/Sidebar/VersionPicker';
|
|
@@ -25,4 +25,6 @@ __exportStar(require("../../components/Sidebar/Sidebar"), exports);
|
|
|
25
25
|
__exportStar(require("../../components/Sidebar/SidebarLayout"), exports);
|
|
26
26
|
__exportStar(require("../../components/Sidebar/FooterWrapper"), exports);
|
|
27
27
|
__exportStar(require("../../components/Sidebar/HeaderWrapper"), exports);
|
|
28
|
+
__exportStar(require("../../components/Sidebar/SidebarItemIcon"), exports);
|
|
29
|
+
__exportStar(require("../../components/Sidebar/VersionPicker"), exports);
|
|
28
30
|
//# sourceMappingURL=index.js.map
|
package/lib/components/index.js
CHANGED
|
@@ -49,4 +49,7 @@ __exportStar(require("./Cards"), exports);
|
|
|
49
49
|
__exportStar(require("./Tiles"), exports);
|
|
50
50
|
__exportStar(require("./Breadcrumbs"), exports);
|
|
51
51
|
__exportStar(require("./Catalog"), exports);
|
|
52
|
+
__exportStar(require("./Product"), exports);
|
|
53
|
+
__exportStar(require("./Select"), exports);
|
|
54
|
+
__exportStar(require("./Dropdown"), exports);
|
|
52
55
|
//# sourceMappingURL=index.js.map
|