@redocly/theme 0.70.0-next.3 → 0.70.0-next.5
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/Catalog/Catalog.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +30 -11
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +1 -1
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +2 -2
- package/lib/components/Dropdown/Dropdown.js +3 -1
- package/lib/components/Dropdown/DropdownMenu.d.ts +1 -0
- package/lib/components/Dropdown/DropdownMenu.js +1 -1
- package/lib/components/Feedback/Reasons.js +3 -2
- package/lib/components/Filter/FilterCheckboxes.js +30 -11
- package/lib/components/Image/Image.js +24 -4
- package/lib/components/Markdown/Markdown.js +3 -2
- package/lib/components/Menu/Menu.js +4 -0
- package/lib/components/Menu/MenuSelect.d.ts +7 -0
- package/lib/components/Menu/MenuSelect.js +129 -0
- package/lib/components/Menu/variables.js +43 -4
- package/lib/components/Navbar/Navbar.js +44 -5
- package/lib/components/Navbar/variables.js +3 -0
- package/lib/components/NavigationTabs/NavigationTab.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTab.js +93 -0
- package/lib/components/NavigationTabs/NavigationTabContent.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabContent.js +50 -0
- package/lib/components/NavigationTabs/NavigationTabMenu.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabMenu.js +18 -0
- package/lib/components/NavigationTabs/NavigationTabs.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabs.js +97 -0
- package/lib/components/NavigationTabs/variables.d.ts +1 -0
- package/lib/components/NavigationTabs/variables.js +37 -0
- package/lib/components/Search/SearchTrigger.js +8 -2
- package/lib/components/Segmented/Segmented.js +23 -3
- package/lib/components/Select/Select.js +10 -3
- package/lib/components/Select/SelectInput.d.ts +1 -0
- package/lib/components/Select/SelectInput.js +3 -3
- package/lib/components/Sidebar/Sidebar.js +2 -2
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/core/constants/common.d.ts +1 -0
- package/lib/core/constants/common.js +1 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/menu/use-mobile-menu-items.js +75 -51
- package/lib/core/hooks/menu/use-mobile-menu-levels.js +12 -7
- package/lib/core/hooks/use-scroll-item-into-view.d.ts +2 -0
- package/lib/core/hooks/use-scroll-item-into-view.js +16 -0
- package/lib/core/hooks/use-tab-list.d.ts +31 -0
- package/lib/core/hooks/use-tab-list.js +49 -0
- package/lib/core/hooks/use-theme-hooks.js +2 -0
- package/lib/core/styles/global.js +12 -2
- package/lib/core/types/hooks.d.ts +5 -0
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/navigation-tabs.d.ts +49 -0
- package/lib/core/types/navigation-tabs.js +3 -0
- package/lib/core/utils/Dynamic.d.ts +8 -1
- package/lib/core/utils/Dynamic.js +34 -3
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/menu.d.ts +4 -0
- package/lib/core/utils/menu.js +42 -3
- package/lib/core/utils/navigation-tabs.d.ts +8 -0
- package/lib/core/utils/navigation-tabs.js +71 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +7 -1
- package/lib/layouts/PageLayout.js +1 -1
- package/lib/layouts/RootLayout.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +3 -3
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +1 -1
- package/package.json +3 -3
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +37 -22
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +1 -1
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +2 -2
- package/src/components/Dropdown/Dropdown.tsx +4 -1
- package/src/components/Dropdown/DropdownMenu.tsx +7 -1
- package/src/components/Feedback/Reasons.tsx +3 -2
- package/src/components/Filter/FilterCheckboxes.tsx +33 -18
- package/src/components/Image/Image.tsx +26 -5
- package/src/components/Markdown/Markdown.tsx +3 -2
- package/src/components/Menu/Menu.tsx +5 -0
- package/src/components/Menu/MenuSelect.tsx +198 -0
- package/src/components/Menu/variables.ts +43 -4
- package/src/components/Navbar/Navbar.tsx +22 -5
- package/src/components/Navbar/variables.ts +3 -0
- package/src/components/NavigationTabs/NavigationTab.tsx +148 -0
- package/src/components/NavigationTabs/NavigationTabContent.tsx +66 -0
- package/src/components/NavigationTabs/NavigationTabMenu.tsx +40 -0
- package/src/components/NavigationTabs/NavigationTabs.tsx +83 -0
- package/src/components/NavigationTabs/variables.ts +34 -0
- package/src/components/Search/SearchTrigger.tsx +11 -2
- package/src/components/Segmented/Segmented.tsx +25 -16
- package/src/components/Select/Select.tsx +12 -6
- package/src/components/Select/SelectInput.tsx +8 -10
- package/src/components/Sidebar/Sidebar.tsx +2 -2
- package/src/components/TableOfContent/TableOfContent.tsx +2 -2
- package/src/core/constants/common.ts +1 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +3 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/menu/use-mobile-menu-items.ts +91 -56
- package/src/core/hooks/menu/use-mobile-menu-levels.ts +14 -6
- package/src/core/hooks/use-scroll-item-into-view.ts +18 -0
- package/src/core/hooks/use-tab-list.ts +63 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -0
- package/src/core/styles/global.ts +12 -2
- package/src/core/types/hooks.ts +5 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +3 -0
- package/src/core/types/navigation-tabs.ts +54 -0
- package/src/core/utils/Dynamic.tsx +67 -35
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/menu.ts +49 -3
- package/src/core/utils/navigation-tabs.ts +99 -0
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +1 -0
- package/src/icons/ChevronSortIcon/ChevronSortIcon.tsx +1 -0
- package/src/index.ts +6 -0
- package/src/layouts/PageLayout.tsx +1 -1
- package/src/layouts/RootLayout.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +3 -3
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +1 -1
|
@@ -1,15 +1,49 @@
|
|
|
1
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.Navbar = Navbar;
|
|
7
|
-
const react_1 =
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
8
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
42
|
const utils_1 = require("../../core/utils");
|
|
10
43
|
const hooks_1 = require("../../core/hooks");
|
|
11
44
|
const NavbarLogo_1 = require("../../components/Navbar/NavbarLogo");
|
|
12
45
|
const NavbarMenu_1 = require("../../components/Navbar/NavbarMenu");
|
|
46
|
+
const NavigationTabs_1 = require("../../components/NavigationTabs/NavigationTabs");
|
|
13
47
|
const MenuMobile_1 = require("../../components/Menu/MenuMobile");
|
|
14
48
|
const ColorModeSwitcher_1 = require("../../components/ColorModeSwitcher/ColorModeSwitcher");
|
|
15
49
|
const Search_1 = require("../../components/Search/Search");
|
|
@@ -24,9 +58,12 @@ function Navbar({ className }) {
|
|
|
24
58
|
var _a;
|
|
25
59
|
const { isOpen, closeMobileMenu, openMobileMenu } = (0, hooks_1.useMobileMenu)(false);
|
|
26
60
|
const themeConfig = (0, hooks_1.useThemeConfig)();
|
|
27
|
-
const { useL10n, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
61
|
+
const { useL10n, useTelemetry, useTranslate, useNavigationTabs } = (0, hooks_1.useThemeHooks)();
|
|
28
62
|
const { changeLanguage } = useL10n();
|
|
63
|
+
const { translate } = useTranslate();
|
|
29
64
|
const telemetry = useTelemetry();
|
|
65
|
+
const navigationTabs = useNavigationTabs();
|
|
66
|
+
const navigationTabsConfig = (0, react_1.useMemo)(() => (0, utils_1.toNavigationTabsConfig)({ state: navigationTabs }), [navigationTabs]);
|
|
30
67
|
const menu = (_a = themeConfig.navbar) === null || _a === void 0 ? void 0 : _a.items;
|
|
31
68
|
const { search: searchSettings, navbar, userMenu: userMenuSettings, logo } = themeConfig;
|
|
32
69
|
if (navbar === null || navbar === void 0 ? void 0 : navbar.hide) {
|
|
@@ -34,7 +71,7 @@ function Navbar({ className }) {
|
|
|
34
71
|
}
|
|
35
72
|
const hideSearch = (searchSettings === null || searchSettings === void 0 ? void 0 : searchSettings.hide) || ((searchSettings === null || searchSettings === void 0 ? void 0 : searchSettings.placement) && (searchSettings === null || searchSettings === void 0 ? void 0 : searchSettings.placement) !== 'navbar');
|
|
36
73
|
const hideUserMenu = userMenuSettings === null || userMenuSettings === void 0 ? void 0 : userMenuSettings.hide;
|
|
37
|
-
return (react_1.default.createElement(NavbarWrapper, { "data-component-name": "Navbar/Navbar", className: className },
|
|
74
|
+
return (react_1.default.createElement(NavbarWrapper, { "data-component-name": "Navbar/Navbar", className: className, "aria-label": translate('navbar.label', 'Main navigation') },
|
|
38
75
|
react_1.default.createElement(Banner_1.Banner, null),
|
|
39
76
|
isOpen && react_1.default.createElement(MenuMobile_1.MenuMobile, { hideUserProfile: !!hideUserMenu }),
|
|
40
77
|
react_1.default.createElement(NavbarRow, null,
|
|
@@ -57,11 +94,12 @@ function Navbar({ className }) {
|
|
|
57
94
|
(0, utils_1.getBaseDataAttributes)('mobileMenuOpen', 'button'),
|
|
58
95
|
]);
|
|
59
96
|
}, icon: isOpen ? react_1.default.createElement(CloseIcon_1.CloseIcon, null) : react_1.default.createElement(MenuIcon_1.MenuIcon, null), "aria-label": isOpen ? 'Close menu button' : 'Open menu button' }),
|
|
60
|
-
hideUserMenu ? null : react_1.default.createElement(UserMenu_1.UserMenu, null))
|
|
97
|
+
hideUserMenu ? null : react_1.default.createElement(UserMenu_1.UserMenu, null)),
|
|
98
|
+
navigationTabsConfig && react_1.default.createElement(NavigationTabs_1.NavigationTabs, { config: navigationTabsConfig })));
|
|
61
99
|
}
|
|
62
100
|
const NavbarWrapper = styled_components_1.default.nav `
|
|
63
101
|
--text-color: var(--navbar-text-color);
|
|
64
|
-
height: calc(var(--navbar-height) + var(--banner-height));
|
|
102
|
+
height: var(--navbar-offset, calc(var(--navbar-height) + var(--banner-height)));
|
|
65
103
|
transition: height 0.4s ease-out;
|
|
66
104
|
|
|
67
105
|
position: sticky;
|
|
@@ -101,6 +139,7 @@ const NavbarRow = styled_components_1.default.div `
|
|
|
101
139
|
box-sizing: border-box;
|
|
102
140
|
margin-top: var(--banner-height);
|
|
103
141
|
transition: margin-top 0.5s ease-out;
|
|
142
|
+
border-bottom-color: var(--navbar-row-bottom-border-color, var(--navbar-border-color));
|
|
104
143
|
|
|
105
144
|
@media screen and (min-width: ${utils_1.breakpoints.max}) {
|
|
106
145
|
max-width: var(--container-max-width);
|
|
@@ -6,9 +6,12 @@ exports.navbar = (0, styled_components_1.css) `
|
|
|
6
6
|
--navbar-bg-color: var(--bg-color); // @presenter Color
|
|
7
7
|
--navbar-border-color: var(--border-color-secondary);
|
|
8
8
|
--navbar-border: 1px solid var(--navbar-border-color);
|
|
9
|
+
--navbar-row-bottom-border-color: var(--navbar-border-color);
|
|
9
10
|
|
|
10
11
|
--navbar-text-color: var(--text-color-secondary); // @presenter Color
|
|
11
12
|
--navbar-height: 64px; // @presenter Spacing
|
|
13
|
+
--navbar-stack-height: var(--navbar-height);
|
|
14
|
+
--navbar-offset: calc(var(--navbar-stack-height) + var(--banner-height));
|
|
12
15
|
--navbar-font-size: var(--font-size-base);
|
|
13
16
|
--navbar-padding: 0 var(--spacing-xl); // @presenter Spacing
|
|
14
17
|
--navbar-font-family: var(--font-family-base);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { NavigationTabRowItem } from '../../core/types';
|
|
3
|
+
export type NavigationTabProps = {
|
|
4
|
+
tab: NavigationTabRowItem;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function NavigationTab({ tab, className }: NavigationTabProps): JSX.Element | null;
|
|
@@ -0,0 +1,93 @@
|
|
|
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.NavigationTab = NavigationTab;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const hooks_1 = require("../../core/hooks");
|
|
11
|
+
const Link_1 = require("../../components/Link/Link");
|
|
12
|
+
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
13
|
+
const NavigationTabMenu_1 = require("../../components/NavigationTabs/NavigationTabMenu");
|
|
14
|
+
const NavigationTabContent_1 = require("../../components/NavigationTabs/NavigationTabContent");
|
|
15
|
+
const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
16
|
+
function NavigationTab({ tab, className }) {
|
|
17
|
+
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
18
|
+
const telemetry = useTelemetry();
|
|
19
|
+
const active = !!tab.active;
|
|
20
|
+
const menuItems = tab.type === 'group' ? tab.items : [];
|
|
21
|
+
const isGroup = tab.type === 'group' && menuItems.length > 0;
|
|
22
|
+
const linkItem = tab.type === 'link' ? tab : undefined;
|
|
23
|
+
if (!(linkItem === null || linkItem === void 0 ? void 0 : linkItem.link) && !isGroup) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
27
|
+
react_1.default.createElement(NavigationTabContent_1.NavigationTabContent, { item: tab }),
|
|
28
|
+
isGroup ? react_1.default.createElement(NavigationTabChevron, { size: "10px" }) : null));
|
|
29
|
+
if (isGroup) {
|
|
30
|
+
return (react_1.default.createElement(NavigationTabWrapper, { "data-component-name": "NavigationTabs/NavigationTab", className: className },
|
|
31
|
+
react_1.default.createElement(NavigationTabDropdown, { triggerEvent: "hover", portalled: true, trigger: react_1.default.createElement(NavigationTabTrigger, { $active: active, "aria-current": active ? 'true' : undefined, onClick: () => telemetry.sendNavbarMenuItemClickedMessage((0, utils_1.getNavbarItemClickedPayload)(tab.type)) }, content) },
|
|
32
|
+
react_1.default.createElement(NavigationTabMenu_1.NavigationTabMenu, { items: menuItems }))));
|
|
33
|
+
}
|
|
34
|
+
return (react_1.default.createElement(NavigationTabWrapper, { "data-component-name": "NavigationTabs/NavigationTab", className: className },
|
|
35
|
+
react_1.default.createElement(NavigationTabLink, { as: Link_1.Link, to: linkItem === null || linkItem === void 0 ? void 0 : linkItem.link, $active: active, external: linkItem === null || linkItem === void 0 ? void 0 : linkItem.external, target: linkItem === null || linkItem === void 0 ? void 0 : linkItem.target, "aria-current": active ? 'page' : undefined, onClick: () => telemetry.sendNavbarMenuItemClickedMessage((0, utils_1.getNavbarItemClickedPayload)(tab.type)) }, content)));
|
|
36
|
+
}
|
|
37
|
+
const NavigationTabChevron = (0, styled_components_1.default)(ChevronDownIcon_1.ChevronDownIcon) `
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
`;
|
|
40
|
+
const NavigationTabWrapper = styled_components_1.default.li `
|
|
41
|
+
list-style: none;
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
align-items: stretch;
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
`;
|
|
46
|
+
const NavigationTabDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: stretch;
|
|
49
|
+
height: 100%;
|
|
50
|
+
`;
|
|
51
|
+
const NavigationTabLink = styled_components_1.default.div `
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: var(--navigation-tabs-item-content-gap);
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
height: 100%;
|
|
57
|
+
padding: var(--navigation-tabs-item-padding);
|
|
58
|
+
font-size: var(--navigation-tabs-item-font-size);
|
|
59
|
+
line-height: var(--navigation-tabs-item-line-height);
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
text-decoration: none;
|
|
62
|
+
transition: border-color var(--navigation-tabs-item-transition);
|
|
63
|
+
|
|
64
|
+
font-weight: ${({ $active }) => $active
|
|
65
|
+
? 'var(--navigation-tabs-item-font-weight-active)'
|
|
66
|
+
: 'var(--navigation-tabs-item-font-weight)'};
|
|
67
|
+
color: ${({ $active }) => $active
|
|
68
|
+
? 'var(--navigation-tabs-item-text-color-active)'
|
|
69
|
+
: 'var(--navigation-tabs-item-text-color)'};
|
|
70
|
+
border-bottom: ${({ $active }) => $active
|
|
71
|
+
? 'var(--navigation-tabs-item-bottom-border-active)'
|
|
72
|
+
: 'var(--navigation-tabs-item-bottom-border)'};
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
color: var(--navigation-tabs-item-text-color-hover);
|
|
76
|
+
border-bottom: ${({ $active }) => !$active && 'var(--navigation-tabs-item-bottom-border-hover)'};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:focus-visible {
|
|
80
|
+
outline: 1px solid var(--navigation-tabs-item-border-color-focused);
|
|
81
|
+
outline-offset: 2px;
|
|
82
|
+
border-radius: var(--navigation-tabs-item-border-radius);
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
const NavigationTabTrigger = (0, styled_components_1.default)(NavigationTabLink).attrs({ as: 'button', type: 'button' }) `
|
|
86
|
+
background: none;
|
|
87
|
+
border-top: none;
|
|
88
|
+
border-left: none;
|
|
89
|
+
border-right: none;
|
|
90
|
+
font-family: inherit;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
`;
|
|
93
|
+
//# sourceMappingURL=NavigationTab.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { NavigationTabRowItem } from '../../core/types';
|
|
3
|
+
export type NavigationTabContentProps = {
|
|
4
|
+
item: NavigationTabRowItem;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function NavigationTabContent({ item, className }: NavigationTabContentProps): JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.NavigationTabContent = NavigationTabContent;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const hooks_1 = require("../../core/hooks");
|
|
10
|
+
const GenericIcon_1 = require("../../icons/GenericIcon/GenericIcon");
|
|
11
|
+
const LaunchIcon_1 = require("../../icons/LaunchIcon/LaunchIcon");
|
|
12
|
+
function NavigationTabContent({ item, className }) {
|
|
13
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
14
|
+
const { translate } = useTranslate();
|
|
15
|
+
const label = translate(item.labelTranslationKey, item.label);
|
|
16
|
+
return (react_1.default.createElement(NavigationTabContentWrapper, { "data-component-name": "NavigationTabs/NavigationTabContent", className: className },
|
|
17
|
+
(item.icon || item.srcSet) && react_1.default.createElement(NavigationTabIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
18
|
+
react_1.default.createElement(NavigationTabLabel, { "data-label": label, "data-translation-key": item.labelTranslationKey }, label),
|
|
19
|
+
'external' in item && item.external ? react_1.default.createElement(NavigationTabExternalIcon, { size: "10px" }) : null));
|
|
20
|
+
}
|
|
21
|
+
const NavigationTabContentWrapper = styled_components_1.default.span `
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: var(--navigation-tabs-item-content-gap);
|
|
25
|
+
`;
|
|
26
|
+
const NavigationTabIcon = (0, styled_components_1.default)(GenericIcon_1.GenericIcon) `
|
|
27
|
+
--icon-width: var(--navigation-tabs-item-icon-size);
|
|
28
|
+
--icon-height: var(--navigation-tabs-item-icon-size);
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
`;
|
|
31
|
+
const NavigationTabLabel = styled_components_1.default.span `
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
|
|
37
|
+
&::after {
|
|
38
|
+
content: attr(data-label);
|
|
39
|
+
height: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
visibility: hidden;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
font-weight: var(--navigation-tabs-item-label-font-weight-active);
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const NavigationTabExternalIcon = (0, styled_components_1.default)(LaunchIcon_1.LaunchIcon) `
|
|
47
|
+
margin-left: var(--navigation-tabs-item-external-icon-margin-left);
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
`;
|
|
50
|
+
//# sourceMappingURL=NavigationTabContent.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { NavigationTabItem } from '../../core/types';
|
|
3
|
+
export type NavigationTabMenuProps = {
|
|
4
|
+
items: NavigationTabItem[];
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function NavigationTabMenu({ items, className }: NavigationTabMenuProps): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
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.NavigationTabMenu = NavigationTabMenu;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
10
|
+
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
11
|
+
const NavigationTabContent_1 = require("../../components/NavigationTabs/NavigationTabContent");
|
|
12
|
+
function NavigationTabMenu({ items, className }) {
|
|
13
|
+
return (react_1.default.createElement(NavigationTabMenuWrapper, { "data-component-name": "NavigationTabs/NavigationTabMenu", className: className },
|
|
14
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, items.map((item, index) => (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: `${item.label}_${index}`, to: item.link, external: item.external, "data-translation-key": item.labelTranslationKey, active: item.active, "aria-current": item.active ? 'page' : undefined },
|
|
15
|
+
react_1.default.createElement(NavigationTabContent_1.NavigationTabContent, { item: item })))))));
|
|
16
|
+
}
|
|
17
|
+
const NavigationTabMenuWrapper = styled_components_1.default.div ``;
|
|
18
|
+
//# sourceMappingURL=NavigationTabMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { NavigationTabsConfig } from '../../core/types';
|
|
3
|
+
export type NavigationTabsProps = {
|
|
4
|
+
config?: NavigationTabsConfig;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function NavigationTabs({ config, className }: NavigationTabsProps): JSX.Element | null;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.NavigationTabs = NavigationTabs;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
+
const utils_1 = require("../../core/utils");
|
|
43
|
+
const hooks_1 = require("../../core/hooks");
|
|
44
|
+
const NavigationTab_1 = require("../../components/NavigationTabs/NavigationTab");
|
|
45
|
+
function NavigationTabs({ config, className }) {
|
|
46
|
+
var _a;
|
|
47
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
48
|
+
const { translate } = useTranslate();
|
|
49
|
+
const listRef = (0, react_1.useRef)(null);
|
|
50
|
+
const tabs = (_a = config === null || config === void 0 ? void 0 : config.items) !== null && _a !== void 0 ? _a : [];
|
|
51
|
+
const activeIndex = tabs.findIndex((tab) => tab.active);
|
|
52
|
+
(0, hooks_1.useScrollItemIntoView)(listRef, activeIndex);
|
|
53
|
+
if (!tabs.length) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return (react_1.default.createElement(NavigationTabsWrapper, { "data-component-name": "NavigationTabs/NavigationTabs", className: className, "aria-label": translate('navigationTabs.label', 'Navigation tabs') },
|
|
57
|
+
react_1.default.createElement(NavigationTabsList, { ref: listRef }, tabs.map((tab, index) => (react_1.default.createElement(NavigationTab_1.NavigationTab, { key: `${tab.label}_${index}`, tab: tab }))))));
|
|
58
|
+
}
|
|
59
|
+
const NavigationTabsWrapper = styled_components_1.default.nav `
|
|
60
|
+
display: none;
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: var(--navigation-tabs-height);
|
|
64
|
+
max-width: var(--navbar-container-max-width);
|
|
65
|
+
padding: var(--navigation-tabs-padding);
|
|
66
|
+
background: var(--navigation-tabs-bg-color);
|
|
67
|
+
border-bottom: var(--navigation-tabs-bottom-border);
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
|
|
70
|
+
@media screen and (min-width: ${utils_1.breakpoints.medium}) {
|
|
71
|
+
display: flex;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media screen and (min-width: ${utils_1.breakpoints.max}) {
|
|
75
|
+
max-width: var(--container-max-width);
|
|
76
|
+
margin-left: auto;
|
|
77
|
+
margin-right: auto;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
const NavigationTabsList = styled_components_1.default.ul `
|
|
81
|
+
list-style: none;
|
|
82
|
+
margin: 0 0 calc(-1 * var(--navigation-tabs-border-width));
|
|
83
|
+
padding: 0;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-wrap: nowrap;
|
|
86
|
+
align-items: stretch;
|
|
87
|
+
gap: var(--navigation-tabs-gap);
|
|
88
|
+
min-width: 0;
|
|
89
|
+
overflow-x: auto;
|
|
90
|
+
scrollbar-width: none;
|
|
91
|
+
-ms-overflow-style: none;
|
|
92
|
+
|
|
93
|
+
&::-webkit-scrollbar {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
//# sourceMappingURL=NavigationTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const navigationTabs: import("styled-components").RuleSet<object>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navigationTabs = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
exports.navigationTabs = (0, styled_components_1.css) `
|
|
6
|
+
--navigation-tabs-height: 48px; // @presenter Spacing
|
|
7
|
+
--navigation-tabs-bg-color: transparent; // @presenter Color
|
|
8
|
+
--navigation-tabs-border-color: var(--border-color-secondary);
|
|
9
|
+
--navigation-tabs-border-width: 1px;
|
|
10
|
+
--navigation-tabs-bottom-border: var(--navigation-tabs-border-width) solid var(--navigation-tabs-border-color);
|
|
11
|
+
--navigation-tabs-padding-vertical: 0;
|
|
12
|
+
--navigation-tabs-padding-horizontal: var(--spacing-xl);
|
|
13
|
+
--navigation-tabs-padding: var(--navigation-tabs-padding-vertical) var(--navigation-tabs-padding-horizontal); // @presenter Spacing
|
|
14
|
+
--navigation-tabs-gap: var(--spacing-base); // @presenter Spacing
|
|
15
|
+
|
|
16
|
+
--navigation-tabs-item-padding-vertical: var(--spacing-xxs);
|
|
17
|
+
--navigation-tabs-item-padding-horizontal: 0;
|
|
18
|
+
--navigation-tabs-item-padding: var(--navigation-tabs-item-padding-vertical) var(--navigation-tabs-item-padding-horizontal);
|
|
19
|
+
--navigation-tabs-item-content-gap: var(--spacing-xs);
|
|
20
|
+
--navigation-tabs-item-font-size: var(--font-size-base);
|
|
21
|
+
--navigation-tabs-item-line-height: var(--line-height-base);
|
|
22
|
+
--navigation-tabs-item-font-weight: var(--font-weight-regular);
|
|
23
|
+
--navigation-tabs-item-font-weight-active: var(--font-weight-medium);
|
|
24
|
+
--navigation-tabs-item-text-color: var(--navbar-text-color); // @presenter Color
|
|
25
|
+
--navigation-tabs-item-text-color-hover: var(--text-color-primary); // @presenter Color
|
|
26
|
+
--navigation-tabs-item-text-color-active: var(--text-color-primary); // @presenter Color
|
|
27
|
+
--navigation-tabs-item-bottom-border: var(--navigation-tabs-border-width) solid transparent;
|
|
28
|
+
--navigation-tabs-item-bottom-border-hover: var(--navigation-tabs-border-width) solid var(--border-color-primary);
|
|
29
|
+
--navigation-tabs-item-bottom-border-active: var(--navigation-tabs-border-width) solid var(--border-color-inverse);
|
|
30
|
+
--navigation-tabs-item-border-color-focused: var(--button-border-color-focused);
|
|
31
|
+
--navigation-tabs-item-border-radius: var(--navbar-item-border-radius);
|
|
32
|
+
--navigation-tabs-item-icon-size: 1.25em; // @presenter Spacing
|
|
33
|
+
--navigation-tabs-item-external-icon-margin-left: 0;
|
|
34
|
+
--navigation-tabs-item-label-font-weight-active: var(--navigation-tabs-item-font-weight-active);
|
|
35
|
+
--navigation-tabs-item-transition: 150ms ease-in-out;
|
|
36
|
+
`;
|
|
37
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -61,13 +61,16 @@ function SearchTrigger({ onClick, className }) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
mainShortcutKey = mainShortcutKey === null || mainShortcutKey === void 0 ? void 0 : mainShortcutKey.toUpperCase();
|
|
64
|
-
|
|
64
|
+
// A page can be cached and served to every platform, so the server renders a hidden
|
|
65
|
+
// placeholder and the browser picks the label after hydration.
|
|
66
|
+
const [isMac, setIsMac] = React.useState(undefined);
|
|
67
|
+
React.useEffect(() => setIsMac((0, utils_1.getUserAgent)().includes('Mac')), []);
|
|
65
68
|
return (React.createElement(SearchTriggerWrapper, { onClick: onClick, className: className, "data-component-name": "Search/SearchTrigger" },
|
|
66
69
|
React.createElement(SearchTriggerButton, { "data-testid": "search-trigger-button", variant: "text", size: "medium", icon: React.createElement(SearchIcon_1.SearchIcon, null), "aria-label": "Search trigger button" }),
|
|
67
70
|
React.createElement(SearchTriggerInput, { "data-testid": "search-trigger-input", "data-translation-key": "search.navbar.label" },
|
|
68
71
|
React.createElement(SearchIcon_1.SearchIcon, null),
|
|
69
72
|
translate('search.navbar.label', 'Search'),
|
|
70
|
-
mainShortcutKey === constants_1.DEFAULT_KEYBOARD_SHORTCUTS ? (React.createElement(
|
|
73
|
+
mainShortcutKey === constants_1.DEFAULT_KEYBOARD_SHORTCUTS ? (React.createElement(SearchTriggerShortcut, { $isPending: isMac === undefined }, isMac ? '⌘K' : 'Ctrl+K')) : (React.createElement("span", null, mainShortcutKey)))));
|
|
71
74
|
}
|
|
72
75
|
const SearchTriggerWrapper = styled_components_1.default.div `
|
|
73
76
|
color: var(--search-trigger-color);
|
|
@@ -85,6 +88,9 @@ const SearchTriggerButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
|
85
88
|
display: none;
|
|
86
89
|
}
|
|
87
90
|
`;
|
|
91
|
+
const SearchTriggerShortcut = styled_components_1.default.span `
|
|
92
|
+
visibility: ${({ $isPending }) => ($isPending ? 'hidden' : 'visible')};
|
|
93
|
+
`;
|
|
88
94
|
const SearchTriggerInput = styled_components_1.default.div `
|
|
89
95
|
display: none;
|
|
90
96
|
align-items: center;
|
|
@@ -32,15 +32,35 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
35
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
47
|
exports.Segmented = void 0;
|
|
37
48
|
const react_1 = __importStar(require("react"));
|
|
38
49
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
39
50
|
const typed_memo_1 = require("../../core/hoc/typed-memo");
|
|
51
|
+
const hooks_1 = require("../../core/hooks");
|
|
40
52
|
function SegmentedComponent({ options, onChange, value, className = '', size = 'regular' }, ref) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
const { tabListProps, getTabProps } = (0, hooks_1.useTabList)({
|
|
54
|
+
count: options.length,
|
|
55
|
+
activeIndex: options.findIndex((opt) => value == opt.value),
|
|
56
|
+
onChange: (index) => onChange(options[index]),
|
|
57
|
+
});
|
|
58
|
+
return (react_1.default.createElement(SegmentedGroup, Object.assign({ ref: ref, "data-component-name": "Segmented/Segmented", className: `tag-grey ${size} ${className}` }, tabListProps, { $size: size }), options.map((opt, index) => {
|
|
59
|
+
const _a = getTabProps(index), { 'aria-controls': _noPanel } = _a, tabProps = __rest(_a, ['aria-controls']);
|
|
60
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: index },
|
|
61
|
+
opt.divider,
|
|
62
|
+
react_1.default.createElement(SegmentedItem, Object.assign({ key: opt.label }, tabProps, { title: opt.label, $isActive: value == opt.value, $size: size }), opt.element || opt.label)));
|
|
63
|
+
})));
|
|
44
64
|
}
|
|
45
65
|
exports.Segmented = (0, typed_memo_1.typedMemo)((0, react_1.forwardRef)(SegmentedComponent));
|
|
46
66
|
const SegmentedGroup = styled_components_1.default.div `
|
|
@@ -68,6 +68,7 @@ function Select(props) {
|
|
|
68
68
|
const [filteredOptions, setFilteredOptions] = (0, react_1.useState)(options);
|
|
69
69
|
const [stickyInputValue, setStickyInputValue] = (0, react_1.useState)(placeholder || '');
|
|
70
70
|
const inputId = (0, react_1.useId)();
|
|
71
|
+
const listboxId = `${inputId}-listbox`;
|
|
71
72
|
(0, hooks_1.useOutsideClick)(selectRef, () => {
|
|
72
73
|
setDropdownActive(false);
|
|
73
74
|
});
|
|
@@ -169,14 +170,20 @@ function Select(props) {
|
|
|
169
170
|
return !!selectedOptions.find((selectOption) => selectOption.value === option.value || selectOption.value === option.label);
|
|
170
171
|
};
|
|
171
172
|
const renderDefaultInput = (inputRef) => {
|
|
172
|
-
return (react_1.default.createElement(SelectInput_1.SelectInput, { id: inputId, listboxId:
|
|
173
|
+
return (react_1.default.createElement(SelectInput_1.SelectInput, { id: inputId, listboxId: listboxId, expanded: dropdownActive, selectedOptions: selectedOptions, searchValue: searchValue, placeholder: placeholder, stickyValue: stickyInputValue, multiple: multiple, searchable: searchable, clearable: clearable, customIcon: icon, inputRef: inputRef, onlyIcon: onlyIcon, clearHandler: clearHandler, searchHandler: searchHandler, inputBlurHandler: inputBlurHandler, inputFocusHandler: inputFocusHandler, clickHandler: inputClickHandler }));
|
|
173
174
|
};
|
|
174
175
|
return (react_1.default.createElement(exports.SelectWrapper, Object.assign({ "data-component-name": "Select/Select", ref: selectRef }, dataAttributes, { disabled: disabled, "data-testid": dataTestId, className: className, onKeyDown: (e) => {
|
|
175
176
|
if (e.key === 'Enter' && document.activeElement === selectRef.current) {
|
|
176
177
|
e.preventDefault();
|
|
177
178
|
setDropdownActive(!dropdownActive);
|
|
178
179
|
}
|
|
179
|
-
}, tabIndex:
|
|
180
|
+
}, tabIndex: searchable ? undefined : 0 }, (!searchable && {
|
|
181
|
+
role: 'combobox',
|
|
182
|
+
'aria-haspopup': 'listbox',
|
|
183
|
+
'aria-expanded': dropdownActive,
|
|
184
|
+
'aria-controls': listboxId,
|
|
185
|
+
'aria-label': 'Select option',
|
|
186
|
+
}), { onFocus: (e) => {
|
|
180
187
|
var _a;
|
|
181
188
|
if (e.target === selectRef.current) {
|
|
182
189
|
(_a = selectInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -185,7 +192,7 @@ function Select(props) {
|
|
|
185
192
|
e.preventDefault();
|
|
186
193
|
} }),
|
|
187
194
|
react_1.default.createElement(SelectDropdown, { closeOnClick: !multiple, withArrow: withArrow, trigger: renderInput ? renderInput() : renderDefaultInput(selectInputRef), triggerEvent: triggerEvent, placement: placement, alignment: alignment, active: !renderInput ? dropdownActive : undefined },
|
|
188
|
-
react_1.default.createElement(SelectDropdownMenu, { role: "listbox", footer: footer }, filteredOptions.length === 0 ? (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { disabled: true }, translate('select.noResults', 'No results'))) : (filteredOptions.map((option, index) => {
|
|
195
|
+
react_1.default.createElement(SelectDropdownMenu, { id: listboxId, role: "listbox", footer: footer }, filteredOptions.length === 0 ? (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { disabled: true }, translate('select.noResults', 'No results'))) : (filteredOptions.map((option, index) => {
|
|
189
196
|
return (react_1.default.createElement(react_1.Fragment, { key: index },
|
|
190
197
|
react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { onAction: () => selectHandler(option), prefix: !hideCheckmarkIcon &&
|
|
191
198
|
(checkmarkIconPosition ? checkmarkIconPosition === 'start' : false) &&
|
|
@@ -44,7 +44,7 @@ const Tag_1 = require("../../components/Tag/Tag");
|
|
|
44
44
|
const CloseIcon_1 = require("../../icons/CloseIcon/CloseIcon");
|
|
45
45
|
const Button_1 = require("../../components/Button/Button");
|
|
46
46
|
function SelectInput(props) {
|
|
47
|
-
const { id, listboxId, onlyIcon, icon, customIcon, selectedOptions, placeholder, stickyValue, multiple, searchable, clearable, clearHandler, searchHandler, clickHandler, searchValue, inputBlurHandler, inputFocusHandler, inputRef: forwardedInputRef, } = props;
|
|
47
|
+
const { id, listboxId, onlyIcon, icon, customIcon, selectedOptions, placeholder, stickyValue, multiple, searchable, expanded, clearable, clearHandler, searchHandler, clickHandler, searchValue, inputBlurHandler, inputFocusHandler, inputRef: forwardedInputRef, } = props;
|
|
48
48
|
const inputRef = (0, react_1.useRef)(null);
|
|
49
49
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
50
50
|
const onChangeHandler = (e) => {
|
|
@@ -95,14 +95,14 @@ function SelectInput(props) {
|
|
|
95
95
|
else {
|
|
96
96
|
forwardedInputRef.current = input;
|
|
97
97
|
}
|
|
98
|
-
}, $width: multiple ? (!searchValue && selectedOptions.length ? '10px' : 'auto') : '100%', tabIndex: 0, onFocus: (e) => {
|
|
98
|
+
}, $width: multiple ? (!searchValue && selectedOptions.length ? '10px' : 'auto') : '100%', tabIndex: 0, role: "combobox", "aria-expanded": !!expanded, "aria-controls": listboxId, "aria-autocomplete": "list", "aria-label": "Select option", onFocus: (e) => {
|
|
99
99
|
e.stopPropagation();
|
|
100
100
|
}, onMouseDown: (e) => {
|
|
101
101
|
e.preventDefault();
|
|
102
102
|
} }));
|
|
103
103
|
const simpleValue = selectedOptions.length ? (selectedOptions[0].label || selectedOptions[0].element || selectedOptions[0].value) : (react_1.default.createElement(SelectInternalInputPlaceholder, null, placeholder));
|
|
104
104
|
const multipleValues = selectedOptions.length ? (selectTags) : (react_1.default.createElement(SelectInternalInputPlaceholder, null, placeholder));
|
|
105
|
-
return (react_1.default.createElement(exports.SelectInputWrapper, { id: id, onFocus: onFocusHandler, onClick: onClickHandler
|
|
105
|
+
return (react_1.default.createElement(exports.SelectInputWrapper, { id: id, onFocus: onFocusHandler, onClick: onClickHandler },
|
|
106
106
|
!onlyIcon && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
107
107
|
react_1.default.createElement(SelectInputValue, null, multiple ? (searchable ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
108
108
|
selectTags,
|
|
@@ -38,8 +38,8 @@ const SidebarContent = styled_components_1.default.aside `
|
|
|
38
38
|
flex-direction: column;
|
|
39
39
|
width: 100%;
|
|
40
40
|
-webkit-font-smoothing: antialiased;
|
|
41
|
-
top:
|
|
42
|
-
height: calc(100vh - var(--navbar-
|
|
41
|
+
top: var(--navbar-offset);
|
|
42
|
+
height: calc(100vh - var(--navbar-offset));
|
|
43
43
|
overflow-x: hidden;
|
|
44
44
|
${({ $opened }) => `
|
|
45
45
|
display: ${$opened ? 'flex' : 'none'}
|
|
@@ -91,8 +91,8 @@ const TableOfContentHeader = styled_components_1.default.div `
|
|
|
91
91
|
`;
|
|
92
92
|
const TableOfContentItems = styled_components_1.default.div `
|
|
93
93
|
position: sticky;
|
|
94
|
-
top: calc(var(--navbar-height) + var(--toc-offset-top));
|
|
95
|
-
max-height: calc(100vh - var(--navbar-height) - var(--toc-offset-top));
|
|
94
|
+
top: calc(var(--navbar-stack-height) + var(--toc-offset-top));
|
|
95
|
+
max-height: calc(100vh - var(--navbar-stack-height) - var(--toc-offset-top));
|
|
96
96
|
overflow-y: auto;
|
|
97
97
|
width: var(--toc-width);
|
|
98
98
|
border-left: solid 1px var(--toc-border-color);
|