@docusaurus/theme-classic 2.0.0-beta.13 → 2.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/index.js +7 -16
- package/lib/theme-classic.d.ts +111 -188
- package/lib/translations.js +13 -4
- package/lib/validateThemeConfig.js +18 -4
- package/lib-next/theme/Admonition/index.js +101 -0
- package/lib-next/theme/BackToTopButton/styles.module.css +1 -1
- package/lib-next/theme/BlogListPaginator/index.js +12 -12
- package/lib-next/theme/BlogPostAuthor/index.js +1 -1
- package/lib-next/theme/BlogPostAuthors/index.js +12 -2
- package/lib-next/theme/BlogPostAuthors/styles.module.css +10 -0
- package/lib-next/theme/BlogPostItem/index.js +12 -15
- package/lib-next/theme/BlogPostPage/index.js +10 -7
- package/lib-next/theme/BlogPostPaginator/index.js +11 -15
- package/lib-next/theme/BlogSidebar/styles.module.css +2 -0
- package/lib-next/theme/CodeBlock/index.js +51 -10
- package/lib-next/theme/CodeBlock/styles.module.css +18 -7
- package/lib-next/theme/DocCard/styles.module.css +3 -3
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +6 -3
- package/lib-next/theme/DocItem/index.js +9 -6
- package/lib-next/theme/DocItem/styles.module.css +2 -2
- package/lib-next/theme/DocPage/index.js +7 -3
- package/lib-next/theme/DocPage/styles.module.css +1 -0
- package/lib-next/theme/DocPaginator/index.js +11 -13
- package/lib-next/theme/DocSidebar/index.js +2 -2
- package/lib-next/theme/DocSidebar/styles.module.css +1 -0
- package/lib-next/theme/DocSidebarItem/index.js +43 -21
- package/lib-next/theme/DocSidebarItem/styles.module.css +1 -0
- package/lib-next/theme/DocSidebarItems/index.js +28 -0
- package/{lib/theme/DocSidebarItem → lib-next/theme/DocSidebarItems}/styles.module.css +1 -0
- package/lib-next/theme/DocVersionBanner/index.js +4 -1
- package/lib-next/theme/Footer/index.js +73 -35
- package/lib-next/theme/Footer/styles.module.css +2 -1
- package/lib-next/theme/Heading/index.js +39 -43
- package/lib-next/theme/Heading/styles.css +1 -1
- package/lib-next/theme/Layout/index.js +1 -2
- package/lib-next/theme/LayoutHead/index.js +5 -9
- package/lib-next/theme/LayoutProviders/index.js +6 -6
- package/lib-next/theme/MDXComponents/index.js +18 -31
- package/lib-next/theme/MDXComponents/styles.css +4 -0
- package/lib-next/theme/MDXPage/index.js +3 -10
- package/lib-next/theme/Navbar/index.js +6 -6
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +4 -66
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +5 -2
- package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +73 -0
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -3
- package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +4 -1
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +6 -7
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +70 -0
- package/lib-next/theme/NavbarItem/index.js +1 -2
- package/lib-next/theme/{UserPreferencesContext.js → NavbarItem/utils.js} +3 -3
- package/lib-next/theme/PaginatorNavLink/index.js +20 -0
- package/lib-next/theme/SkipToContent/index.js +1 -1
- package/lib-next/theme/SkipToContent/styles.module.css +7 -0
- package/lib-next/theme/TOCCollapsible/styles.module.css +2 -2
- package/lib-next/theme/Tabs/__tests__/index.test.js +8 -6
- package/lib-next/theme/Tabs/index.js +20 -10
- package/lib-next/theme/Tag/styles.module.css +4 -4
- package/lib-next/theme/ThemedImage/index.js +2 -2
- package/lib-next/theme/Toggle/styles.module.css +16 -15
- package/lib-next/theme/prism-include-languages.js +10 -3
- package/package.json +17 -19
- package/src/index.ts +12 -26
- package/src/theme/Admonition/index.tsx +106 -0
- package/src/theme/BackToTopButton/styles.module.css +1 -1
- package/src/theme/BlogListPaginator/index.tsx +12 -12
- package/src/theme/BlogPostAuthor/index.tsx +1 -1
- package/src/theme/BlogPostAuthors/index.tsx +12 -2
- package/src/theme/BlogPostAuthors/styles.module.css +10 -0
- package/src/theme/BlogPostItem/index.tsx +13 -15
- package/src/theme/BlogPostPage/index.tsx +10 -7
- package/src/theme/BlogPostPaginator/index.tsx +11 -15
- package/src/theme/BlogSidebar/styles.module.css +2 -0
- package/src/theme/CodeBlock/index.tsx +52 -11
- package/src/theme/CodeBlock/styles.module.css +18 -7
- package/src/theme/DocCard/index.tsx +2 -2
- package/src/theme/DocCard/styles.module.css +3 -3
- package/src/theme/DocCardList/index.tsx +1 -1
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +7 -3
- package/src/theme/DocItem/index.tsx +9 -6
- package/src/theme/DocItem/styles.module.css +2 -2
- package/src/theme/DocItemFooter/index.tsx +1 -1
- package/src/theme/DocPage/index.tsx +8 -4
- package/src/theme/DocPage/styles.module.css +1 -0
- package/src/theme/DocPaginator/index.tsx +13 -15
- package/src/theme/DocSidebar/index.tsx +3 -3
- package/src/theme/DocSidebar/styles.module.css +1 -0
- package/src/theme/DocSidebarItem/index.tsx +34 -23
- package/src/theme/DocSidebarItem/styles.module.css +1 -0
- package/src/theme/DocSidebarItems/index.tsx +32 -0
- package/{lib/theme/DocItemFooter → src/theme/DocSidebarItems}/styles.module.css +10 -8
- package/src/theme/DocVersionBanner/index.tsx +3 -3
- package/src/theme/Footer/index.tsx +84 -38
- package/src/theme/Footer/styles.module.css +2 -1
- package/src/theme/Heading/index.tsx +39 -47
- package/src/theme/Heading/styles.css +1 -1
- package/src/theme/Layout/index.tsx +1 -2
- package/src/theme/LayoutHead/index.tsx +4 -8
- package/src/theme/LayoutProviders/index.tsx +6 -6
- package/src/theme/MDXComponents/index.tsx +26 -37
- package/src/theme/MDXComponents/styles.css +4 -0
- package/src/theme/MDXPage/index.tsx +3 -11
- package/src/theme/Navbar/index.tsx +7 -7
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +6 -62
- package/src/theme/NavbarItem/DocNavbarItem.tsx +8 -5
- package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +84 -0
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +9 -6
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +6 -7
- package/src/theme/NavbarItem/NavbarNavLink.tsx +68 -0
- package/src/theme/NavbarItem/index.tsx +3 -5
- package/{lib-next/theme/hooks/styles.css → src/theme/NavbarItem/utils.ts} +3 -3
- package/src/theme/PaginatorNavLink/index.tsx +22 -0
- package/src/theme/SkipToContent/index.tsx +1 -1
- package/src/theme/SkipToContent/styles.module.css +7 -0
- package/src/theme/TOCCollapsible/styles.module.css +2 -2
- package/src/theme/TOCItems/index.tsx +2 -2
- package/src/theme/Tabs/index.tsx +25 -10
- package/src/theme/Tag/styles.module.css +4 -4
- package/src/theme/TagsListByLetter/index.tsx +1 -1
- package/src/theme/ThemedImage/index.tsx +2 -2
- package/src/theme/Toggle/index.tsx +1 -1
- package/src/theme/Toggle/styles.module.css +16 -15
- package/src/theme/prism-include-languages.ts +10 -3
- package/src/theme-classic.d.ts +111 -188
- package/src/translations.ts +36 -16
- package/src/validateThemeConfig.ts +25 -4
- package/babel.config.js +0 -35
- package/lib/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/lib/__tests__/translations.test.js +0 -112
- package/lib/__tests__/validateThemeConfig.test.js +0 -607
- package/lib/theme/AnnouncementBar/index.js +0 -68
- package/lib/theme/AnnouncementBar/styles.module.css +0 -63
- package/lib/theme/BackToTopButton/index.js +0 -140
- package/lib/theme/BackToTopButton/styles.module.css +0 -42
- package/lib/theme/BlogArchivePage/index.js +0 -89
- package/lib/theme/BlogLayout/index.js +0 -51
- package/lib/theme/BlogListPage/index.js +0 -60
- package/lib/theme/BlogListPaginator/index.js +0 -63
- package/lib/theme/BlogPostAuthor/index.js +0 -51
- package/lib/theme/BlogPostAuthor/styles.module.css +0 -12
- package/lib/theme/BlogPostAuthors/index.js +0 -47
- package/lib/theme/BlogPostAuthors/styles.module.css +0 -11
- package/lib/theme/BlogPostItem/index.js +0 -152
- package/lib/theme/BlogPostItem/styles.module.css +0 -18
- package/lib/theme/BlogPostPage/index.js +0 -82
- package/lib/theme/BlogPostPaginator/index.js +0 -64
- package/lib/theme/BlogSidebar/index.js +0 -49
- package/lib/theme/BlogSidebar/styles.module.css +0 -44
- package/lib/theme/BlogTagsListPage/index.js +0 -40
- package/lib/theme/BlogTagsPostsPage/index.js +0 -86
- package/lib/theme/CodeBlock/index.js +0 -133
- package/lib/theme/CodeBlock/styles.module.css +0 -65
- package/lib/theme/Details/index.js +0 -30
- package/lib/theme/Details/styles.module.css +0 -13
- package/lib/theme/DocCard/index.js +0 -84
- package/lib/theme/DocCard/styles.module.css +0 -43
- package/lib/theme/DocCardList/index.js +0 -28
- package/lib/theme/DocCategoryGeneratedIndexPage/index.js +0 -57
- package/lib/theme/DocCategoryGeneratedIndexPage/styles.module.css +0 -18
- package/lib/theme/DocItem/index.js +0 -112
- package/lib/theme/DocItem/styles.module.css +0 -22
- package/lib/theme/DocItemFooter/index.js +0 -79
- package/lib/theme/DocPage/index.js +0 -154
- package/lib/theme/DocPage/styles.module.css +0 -85
- package/lib/theme/DocPaginator/index.js +0 -62
- package/lib/theme/DocSidebar/index.js +0 -134
- package/lib/theme/DocSidebar/styles.module.css +0 -106
- package/lib/theme/DocSidebarItem/index.js +0 -209
- package/lib/theme/DocTagDocListPage/index.js +0 -89
- package/lib/theme/DocTagsListPage/index.js +0 -44
- package/lib/theme/DocVersionBadge/index.js +0 -34
- package/lib/theme/DocVersionBanner/index.js +0 -130
- package/lib/theme/EditThisPage/index.js +0 -33
- package/lib/theme/ErrorPageContent.js +0 -43
- package/lib/theme/Footer/index.js +0 -119
- package/lib/theme/Footer/styles.module.css +0 -15
- package/lib/theme/Heading/index.js +0 -71
- package/lib/theme/Heading/styles.css +0 -22
- package/lib/theme/Heading/styles.module.css +0 -19
- package/lib/theme/IconArrow/index.js +0 -28
- package/lib/theme/IconClose/index.js +0 -31
- package/lib/theme/IconEdit/index.js +0 -34
- package/lib/theme/IconEdit/styles.module.css +0 -11
- package/lib/theme/IconExternalLink/index.js +0 -30
- package/lib/theme/IconExternalLink/styles.module.css +0 -12
- package/lib/theme/IconLanguage/index.js +0 -29
- package/lib/theme/IconMenu/index.js +0 -30
- package/lib/theme/LastUpdated/index.js +0 -63
- package/lib/theme/Layout/index.js +0 -68
- package/lib/theme/Layout/styles.css +0 -27
- package/lib/theme/LayoutHead/index.js +0 -149
- package/lib/theme/LayoutProviders/index.js +0 -40
- package/lib/theme/Logo/index.js +0 -62
- package/lib/theme/MDXComponents/index.js +0 -106
- package/lib/theme/MDXComponents/styles.css +0 -11
- package/lib/theme/MDXPage/index.js +0 -67
- package/lib/theme/MDXPage/styles.module.css +0 -10
- package/lib/theme/Navbar/index.js +0 -267
- package/lib/theme/Navbar/styles.module.css +0 -27
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +0 -113
- package/lib/theme/NavbarItem/DocNavbarItem.js +0 -62
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +0 -83
- package/lib/theme/NavbarItem/DocsVersionNavbarItem.js +0 -43
- package/lib/theme/NavbarItem/DropdownNavbarItem.js +0 -155
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +0 -68
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +0 -11
- package/lib/theme/NavbarItem/SearchNavbarItem.js +0 -28
- package/lib/theme/NavbarItem/index.js +0 -74
- package/lib/theme/NotFound.js +0 -57
- package/lib/theme/SearchBar.js +0 -15
- package/lib/theme/SearchMetadata/index.js +0 -33
- package/lib/theme/Seo/index.js +0 -52
- package/lib/theme/SkipToContent/index.js +0 -71
- package/lib/theme/SkipToContent/styles.module.css +0 -14
- package/lib/theme/TOC/index.js +0 -39
- package/lib/theme/TOC/styles.module.css +0 -23
- package/lib/theme/TOCCollapsible/index.js +0 -53
- package/lib/theme/TOCCollapsible/styles.module.css +0 -50
- package/lib/theme/TOCInline/index.js +0 -33
- package/lib/theme/TOCInline/styles.module.css +0 -12
- package/lib/theme/TOCItems/index.js +0 -78
- package/lib/theme/TabItem/index.js +0 -32
- package/lib/theme/Tabs/__tests__/index.test.js +0 -123
- package/lib/theme/Tabs/index.js +0 -173
- package/lib/theme/Tabs/styles.module.css +0 -10
- package/lib/theme/Tag/index.js +0 -40
- package/lib/theme/Tag/styles.module.css +0 -70
- package/lib/theme/TagsListByLetter/index.js +0 -48
- package/lib/theme/TagsListByLetter/styles.module.css +0 -11
- package/lib/theme/TagsListInline/index.js +0 -44
- package/lib/theme/TagsListInline/styles.module.css +0 -15
- package/lib/theme/ThemeContext.js +0 -21
- package/lib/theme/ThemeProvider/index.js +0 -43
- package/lib/theme/ThemedImage/index.js +0 -47
- package/lib/theme/ThemedImage/styles.module.css +0 -18
- package/lib/theme/Toggle/index.js +0 -91
- package/lib/theme/Toggle/styles.module.css +0 -105
- package/lib/theme/UserPreferencesContext.js +0 -18
- package/lib/theme/UserPreferencesProvider/index.js +0 -41
- package/lib/theme/hooks/styles.css +0 -10
- package/lib/theme/hooks/useDocs.js +0 -18
- package/lib/theme/hooks/useHideableNavbar.js +0 -74
- package/lib/theme/hooks/useKeyboardNavigation.js +0 -45
- package/lib/theme/hooks/useLocationHash.js +0 -28
- package/lib/theme/hooks/useLockBodyScroll.js +0 -26
- package/lib/theme/hooks/usePrismTheme.js +0 -36
- package/lib/theme/hooks/useTabGroupChoice.js +0 -51
- package/lib/theme/hooks/useTheme.js +0 -97
- package/lib/theme/hooks/useThemeContext.js +0 -31
- package/lib/theme/hooks/useUserPreferencesContext.js +0 -31
- package/lib/theme/hooks/useWindowSize.js +0 -68
- package/lib/theme/prism-include-languages.js +0 -40
- package/lib-next/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/lib-next/__tests__/translations.test.js +0 -128
- package/lib-next/__tests__/validateThemeConfig.test.js +0 -607
- package/lib-next/admonitions.css +0 -35
- package/lib-next/deps.d.ts +0 -13
- package/lib-next/index.js +0 -227
- package/lib-next/prism-include-languages.js +0 -9
- package/lib-next/theme/ThemeContext.js +0 -9
- package/lib-next/theme/ThemeProvider/index.js +0 -28
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -27
- package/lib-next/theme/hooks/useDocs.js +0 -10
- package/lib-next/theme/hooks/useHideableNavbar.js +0 -66
- package/lib-next/theme/hooks/useKeyboardNavigation.js +0 -35
- package/lib-next/theme/hooks/useLocationHash.js +0 -20
- package/lib-next/theme/hooks/useLockBodyScroll.js +0 -18
- package/lib-next/theme/hooks/usePrismTheme.js +0 -20
- package/lib-next/theme/hooks/useTabGroupChoice.js +0 -39
- package/lib-next/theme/hooks/useTheme.js +0 -81
- package/lib-next/theme/hooks/useThemeContext.js +0 -22
- package/lib-next/theme/hooks/useUserPreferencesContext.js +0 -22
- package/lib-next/theme/hooks/useWindowSize.js +0 -59
- package/lib-next/theme-classic.d.ts +0 -806
- package/lib-next/translations.js +0 -141
- package/lib-next/types.d.ts +0 -11
- package/lib-next/validateThemeConfig.js +0 -344
- package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/src/__tests__/translations.test.ts +0 -116
- package/src/__tests__/validateThemeConfig.test.js +0 -607
- package/src/theme/Tabs/__tests__/index.test.tsx +0 -129
- package/src/theme/ThemeContext.ts +0 -15
- package/src/theme/ThemeProvider/index.tsx +0 -28
- package/src/theme/UserPreferencesContext.ts +0 -12
- package/src/theme/UserPreferencesProvider/index.tsx +0 -30
- package/src/theme/hooks/styles.css +0 -10
- package/src/theme/hooks/useDocs.ts +0 -11
- package/src/theme/hooks/useHideableNavbar.ts +0 -72
- package/src/theme/hooks/useKeyboardNavigation.ts +0 -39
- package/src/theme/hooks/useLocationHash.ts +0 -25
- package/src/theme/hooks/useLockBodyScroll.ts +0 -20
- package/src/theme/hooks/usePrismTheme.ts +0 -22
- package/src/theme/hooks/useTabGroupChoice.ts +0 -46
- package/src/theme/hooks/useTheme.ts +0 -91
- package/src/theme/hooks/useThemeContext.ts +0 -23
- package/src/theme/hooks/useUserPreferencesContext.ts +0 -25
- package/src/theme/hooks/useWindowSize.ts +0 -69
- package/tsconfig.json +0 -11
|
@@ -16,17 +16,10 @@ import styles from './styles.module.css';
|
|
|
16
16
|
function MDXPage(props) {
|
|
17
17
|
const {content: MDXPageContent} = props;
|
|
18
18
|
const {
|
|
19
|
-
|
|
20
|
-
frontMatter,
|
|
21
|
-
metadata,
|
|
19
|
+
metadata: {title, description, permalink, frontMatter},
|
|
22
20
|
} = MDXPageContent;
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
description,
|
|
26
|
-
wrapperClassName,
|
|
27
|
-
hide_table_of_contents: hideTableOfContents,
|
|
28
|
-
} = frontMatter;
|
|
29
|
-
const {permalink} = metadata;
|
|
21
|
+
const {wrapperClassName, hide_table_of_contents: hideTableOfContents} =
|
|
22
|
+
frontMatter;
|
|
30
23
|
return (
|
|
31
24
|
<Layout
|
|
32
25
|
title={title}
|
|
@@ -9,17 +9,17 @@ import clsx from 'clsx';
|
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
10
|
import SearchBar from '@theme/SearchBar';
|
|
11
11
|
import Toggle from '@theme/Toggle';
|
|
12
|
-
import useThemeContext from '@theme/hooks/useThemeContext';
|
|
13
12
|
import {
|
|
14
13
|
useThemeConfig,
|
|
15
14
|
useMobileSecondaryMenuRenderer,
|
|
16
15
|
usePrevious,
|
|
17
16
|
useHistoryPopHandler,
|
|
17
|
+
useHideableNavbar,
|
|
18
|
+
useLockBodyScroll,
|
|
19
|
+
useWindowSize,
|
|
20
|
+
useColorMode,
|
|
18
21
|
} from '@docusaurus/theme-common';
|
|
19
|
-
import
|
|
20
|
-
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
|
|
21
|
-
import useWindowSize from '@theme/hooks/useWindowSize';
|
|
22
|
-
import {useActivePlugin} from '@theme/hooks/useDocs';
|
|
22
|
+
import {useActivePlugin} from '@docusaurus/plugin-content-docs/client';
|
|
23
23
|
import NavbarItem from '@theme/NavbarItem';
|
|
24
24
|
import Logo from '@theme/Logo';
|
|
25
25
|
import IconMenu from '@theme/IconMenu';
|
|
@@ -84,7 +84,7 @@ function useColorModeToggle() {
|
|
|
84
84
|
const {
|
|
85
85
|
colorMode: {disableSwitch},
|
|
86
86
|
} = useThemeConfig();
|
|
87
|
-
const {isDarkTheme, setLightTheme, setDarkTheme} =
|
|
87
|
+
const {isDarkTheme, setLightTheme, setDarkTheme} = useColorMode();
|
|
88
88
|
const toggle = useCallback(
|
|
89
89
|
(e) => (e.target.checked ? setDarkTheme() : setLightTheme()),
|
|
90
90
|
[setLightTheme, setDarkTheme],
|
|
@@ -6,70 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import IconExternalLink from '@theme/IconExternalLink';
|
|
12
|
-
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
13
|
-
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
|
14
|
-
import {getInfimaActiveClassName} from './index';
|
|
15
|
-
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
16
|
-
export function NavLink({
|
|
17
|
-
activeBasePath,
|
|
18
|
-
activeBaseRegex,
|
|
19
|
-
to,
|
|
20
|
-
href,
|
|
21
|
-
label,
|
|
22
|
-
activeClassName = '',
|
|
23
|
-
prependBaseUrlToHref,
|
|
24
|
-
...props
|
|
25
|
-
}) {
|
|
26
|
-
// TODO all this seems hacky
|
|
27
|
-
// {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
|
|
28
|
-
const toUrl = useBaseUrl(to);
|
|
29
|
-
const activeBaseUrl = useBaseUrl(activeBasePath);
|
|
30
|
-
const normalizedHref = useBaseUrl(href, {
|
|
31
|
-
forcePrependBaseUrl: true,
|
|
32
|
-
});
|
|
33
|
-
const isExternalLink = label && href && !isInternalUrl(href);
|
|
34
|
-
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
35
|
-
return (
|
|
36
|
-
<Link
|
|
37
|
-
{...(href
|
|
38
|
-
? {
|
|
39
|
-
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
40
|
-
}
|
|
41
|
-
: {
|
|
42
|
-
isNavLink: true,
|
|
43
|
-
activeClassName: !props.className?.includes(activeClassName)
|
|
44
|
-
? activeClassName
|
|
45
|
-
: '',
|
|
46
|
-
to: toUrl,
|
|
47
|
-
...(activeBasePath || activeBaseRegex
|
|
48
|
-
? {
|
|
49
|
-
isActive: (_match, location) =>
|
|
50
|
-
activeBaseRegex
|
|
51
|
-
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
52
|
-
: location.pathname.startsWith(activeBaseUrl),
|
|
53
|
-
}
|
|
54
|
-
: null),
|
|
55
|
-
})}
|
|
56
|
-
{...props}>
|
|
57
|
-
{isExternalLink ? (
|
|
58
|
-
<span>
|
|
59
|
-
{label}
|
|
60
|
-
<IconExternalLink
|
|
61
|
-
{...(isDropdownLink && {
|
|
62
|
-
width: 12,
|
|
63
|
-
height: 12,
|
|
64
|
-
})}
|
|
65
|
-
/>
|
|
66
|
-
</span>
|
|
67
|
-
) : (
|
|
68
|
-
label
|
|
69
|
-
)}
|
|
70
|
-
</Link>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
9
|
+
import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
|
|
10
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
73
11
|
|
|
74
12
|
function DefaultNavbarItemDesktop({
|
|
75
13
|
className,
|
|
@@ -77,7 +15,7 @@ function DefaultNavbarItemDesktop({
|
|
|
77
15
|
...props
|
|
78
16
|
}) {
|
|
79
17
|
const element = (
|
|
80
|
-
<
|
|
18
|
+
<NavbarNavLink
|
|
81
19
|
className={clsx(
|
|
82
20
|
isDropdownItem ? 'dropdown__link' : 'navbar__item navbar__link',
|
|
83
21
|
className,
|
|
@@ -100,7 +38,7 @@ function DefaultNavbarItemMobile({
|
|
|
100
38
|
}) {
|
|
101
39
|
return (
|
|
102
40
|
<li className="menu__list-item">
|
|
103
|
-
<
|
|
41
|
+
<NavbarNavLink className={clsx('menu__link', className)} {...props} />
|
|
104
42
|
</li>
|
|
105
43
|
);
|
|
106
44
|
}
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useLatestVersion,
|
|
11
|
+
useActiveDocContext,
|
|
12
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
10
13
|
import clsx from 'clsx';
|
|
11
|
-
import {getInfimaActiveClassName} from '
|
|
14
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
12
15
|
import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
|
|
13
16
|
|
|
14
17
|
function getDocInVersions(versions, docId) {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
9
|
+
import {
|
|
10
|
+
useLatestVersion,
|
|
11
|
+
useActiveDocContext,
|
|
12
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
13
|
+
import clsx from 'clsx';
|
|
14
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
15
|
+
import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
|
|
16
|
+
|
|
17
|
+
function getSidebarLink(versions, sidebarId) {
|
|
18
|
+
const allSidebars = versions
|
|
19
|
+
.flatMap((version) => {
|
|
20
|
+
if (version.sidebars) {
|
|
21
|
+
return Object.entries(version.sidebars);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return undefined;
|
|
25
|
+
})
|
|
26
|
+
.filter((sidebarItem) => !!sidebarItem);
|
|
27
|
+
const sidebarEntry = allSidebars.find((sidebar) => sidebar[0] === sidebarId);
|
|
28
|
+
|
|
29
|
+
if (!sidebarEntry) {
|
|
30
|
+
throw new Error(`DocSidebarNavbarItem: couldn't find any sidebar with id "${sidebarId}" in version${
|
|
31
|
+
versions.length ? 's' : ''
|
|
32
|
+
} ${versions.map((version) => version.name).join(', ')}".
|
|
33
|
+
Available sidebar ids are:
|
|
34
|
+
- ${Object.keys(allSidebars).join('\n- ')}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!sidebarEntry[1].link) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`DocSidebarNavbarItem: couldn't find any document for sidebar with id "${sidebarId}"`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return sidebarEntry[1].link;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function DocSidebarNavbarItem({
|
|
47
|
+
sidebarId,
|
|
48
|
+
label,
|
|
49
|
+
docsPluginId,
|
|
50
|
+
...props
|
|
51
|
+
}) {
|
|
52
|
+
const {activeVersion, activeDoc} = useActiveDocContext(docsPluginId);
|
|
53
|
+
const {preferredVersion} = useDocsPreferredVersion(docsPluginId);
|
|
54
|
+
const latestVersion = useLatestVersion(docsPluginId); // Versions used to look for the doc to link to, ordered + no duplicate
|
|
55
|
+
|
|
56
|
+
const versions = uniq(
|
|
57
|
+
[activeVersion, preferredVersion, latestVersion].filter(Boolean),
|
|
58
|
+
);
|
|
59
|
+
const sidebarLink = getSidebarLink(versions, sidebarId);
|
|
60
|
+
const activeDocInfimaClassName = getInfimaActiveClassName(props.mobile);
|
|
61
|
+
return (
|
|
62
|
+
<DefaultNavbarItem
|
|
63
|
+
exact
|
|
64
|
+
{...props}
|
|
65
|
+
className={clsx(props.className, {
|
|
66
|
+
[activeDocInfimaClassName]: activeDoc?.sidebar === sidebarId,
|
|
67
|
+
})}
|
|
68
|
+
activeClassName={activeDocInfimaClassName}
|
|
69
|
+
label={label ?? sidebarLink.label}
|
|
70
|
+
to={sidebarLink.path}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useVersions,
|
|
12
12
|
useLatestVersion,
|
|
13
13
|
useActiveDocContext,
|
|
14
|
-
} from '@
|
|
14
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
15
15
|
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
|
16
16
|
import {translate} from '@docusaurus/Translate';
|
|
17
17
|
|
|
@@ -57,7 +57,7 @@ export default function DocsVersionDropdownNavbarItem({
|
|
|
57
57
|
activeDocContext.activeVersion ?? preferredVersion ?? latestVersion; // Mobile dropdown is handled a bit differently
|
|
58
58
|
|
|
59
59
|
const dropdownLabel =
|
|
60
|
-
mobile && items
|
|
60
|
+
mobile && items.length > 1
|
|
61
61
|
? translate({
|
|
62
62
|
id: 'theme.navbar.mobileVersionsDropdown.label',
|
|
63
63
|
message: 'Versions',
|
|
@@ -66,7 +66,9 @@ export default function DocsVersionDropdownNavbarItem({
|
|
|
66
66
|
})
|
|
67
67
|
: dropdownVersion.label;
|
|
68
68
|
const dropdownTo =
|
|
69
|
-
mobile && items
|
|
69
|
+
mobile && items.length > 1
|
|
70
|
+
? undefined
|
|
71
|
+
: getVersionMainDoc(dropdownVersion).path; // We don't want to render a version dropdown with 0 or 1 item
|
|
70
72
|
// If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0'])
|
|
71
73
|
// We'd rather render a button instead of a dropdown
|
|
72
74
|
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useActiveVersion,
|
|
11
|
+
useLatestVersion,
|
|
12
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
10
13
|
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
|
11
14
|
|
|
12
15
|
const getVersionMainDoc = (version) =>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isRegexpStringMatch,
|
|
14
14
|
useLocalPathname,
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
|
-
import
|
|
16
|
+
import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
|
|
17
17
|
import NavbarItem from '@theme/NavbarItem';
|
|
18
18
|
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
19
19
|
|
|
@@ -39,7 +39,6 @@ function containsActiveItems(items, localPathname) {
|
|
|
39
39
|
|
|
40
40
|
function DropdownNavbarItemDesktop({items, position, className, ...props}) {
|
|
41
41
|
const dropdownRef = useRef(null);
|
|
42
|
-
const dropdownMenuRef = useRef(null);
|
|
43
42
|
const [showDropdown, setShowDropdown] = useState(false);
|
|
44
43
|
useEffect(() => {
|
|
45
44
|
const handleClickOutside = (event) => {
|
|
@@ -64,7 +63,7 @@ function DropdownNavbarItemDesktop({items, position, className, ...props}) {
|
|
|
64
63
|
'dropdown--right': position === 'right',
|
|
65
64
|
'dropdown--show': showDropdown,
|
|
66
65
|
})}>
|
|
67
|
-
<
|
|
66
|
+
<NavbarNavLink
|
|
68
67
|
href={props.to ? undefined : '#'}
|
|
69
68
|
className={clsx('navbar__link', className)}
|
|
70
69
|
{...props}
|
|
@@ -76,8 +75,8 @@ function DropdownNavbarItemDesktop({items, position, className, ...props}) {
|
|
|
76
75
|
}
|
|
77
76
|
}}>
|
|
78
77
|
{props.children ?? props.label}
|
|
79
|
-
</
|
|
80
|
-
<ul
|
|
78
|
+
</NavbarNavLink>
|
|
79
|
+
<ul className="dropdown__menu">
|
|
81
80
|
{items.map((childItemProps, i) => (
|
|
82
81
|
<NavbarItem
|
|
83
82
|
isDropdownItem
|
|
@@ -125,7 +124,7 @@ function DropdownNavbarItemMobile({
|
|
|
125
124
|
className={clsx('menu__list-item', {
|
|
126
125
|
'menu__list-item--collapsed': collapsed,
|
|
127
126
|
})}>
|
|
128
|
-
<
|
|
127
|
+
<NavbarNavLink
|
|
129
128
|
role="button"
|
|
130
129
|
className={clsx('menu__link menu__link--sublist', className)}
|
|
131
130
|
{...props}
|
|
@@ -134,7 +133,7 @@ function DropdownNavbarItemMobile({
|
|
|
134
133
|
toggleCollapsed();
|
|
135
134
|
}}>
|
|
136
135
|
{props.children ?? props.label}
|
|
137
|
-
</
|
|
136
|
+
</NavbarNavLink>
|
|
138
137
|
<Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
|
|
139
138
|
{items.map((childItemProps, i) => (
|
|
140
139
|
<NavbarItem
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import Link from '@docusaurus/Link';
|
|
9
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
10
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
11
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
12
|
+
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
|
13
|
+
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
14
|
+
export default function NavbarNavLink({
|
|
15
|
+
activeBasePath,
|
|
16
|
+
activeBaseRegex,
|
|
17
|
+
to,
|
|
18
|
+
href,
|
|
19
|
+
label,
|
|
20
|
+
activeClassName = '',
|
|
21
|
+
prependBaseUrlToHref,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
// TODO all this seems hacky
|
|
25
|
+
// {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
|
|
26
|
+
const toUrl = useBaseUrl(to);
|
|
27
|
+
const activeBaseUrl = useBaseUrl(activeBasePath);
|
|
28
|
+
const normalizedHref = useBaseUrl(href, {
|
|
29
|
+
forcePrependBaseUrl: true,
|
|
30
|
+
});
|
|
31
|
+
const isExternalLink = label && href && !isInternalUrl(href);
|
|
32
|
+
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
33
|
+
return (
|
|
34
|
+
<Link
|
|
35
|
+
{...(href
|
|
36
|
+
? {
|
|
37
|
+
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
isNavLink: true,
|
|
41
|
+
activeClassName: !props.className?.includes(activeClassName)
|
|
42
|
+
? activeClassName
|
|
43
|
+
: '',
|
|
44
|
+
to: toUrl,
|
|
45
|
+
...(activeBasePath || activeBaseRegex
|
|
46
|
+
? {
|
|
47
|
+
isActive: (_match, location) =>
|
|
48
|
+
activeBaseRegex
|
|
49
|
+
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
50
|
+
: location.pathname.startsWith(activeBaseUrl),
|
|
51
|
+
}
|
|
52
|
+
: null),
|
|
53
|
+
})}
|
|
54
|
+
{...props}>
|
|
55
|
+
{isExternalLink ? (
|
|
56
|
+
<span>
|
|
57
|
+
{label}
|
|
58
|
+
<IconExternalLink
|
|
59
|
+
{...(isDropdownLink && {
|
|
60
|
+
width: 12,
|
|
61
|
+
height: 12,
|
|
62
|
+
})}
|
|
63
|
+
/>
|
|
64
|
+
</span>
|
|
65
|
+
) : (
|
|
66
|
+
label
|
|
67
|
+
)}
|
|
68
|
+
</Link>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -22,6 +22,7 @@ const NavbarItemComponents = {
|
|
|
22
22
|
docsVersionDropdown: () =>
|
|
23
23
|
require('@theme/NavbarItem/DocsVersionDropdownNavbarItem').default,
|
|
24
24
|
doc: () => require('@theme/NavbarItem/DocNavbarItem').default,
|
|
25
|
+
docSidebar: () => require('@theme/NavbarItem/DocSidebarNavbarItem').default,
|
|
25
26
|
/* eslint-enable @typescript-eslint/no-var-requires, global-require */
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -45,8 +46,6 @@ function getComponentType(type, isDropdown) {
|
|
|
45
46
|
return type;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
export const getInfimaActiveClassName = (mobile) =>
|
|
49
|
-
mobile ? 'menu__link--active' : 'navbar__link--active';
|
|
50
49
|
export default function NavbarItem({type, ...props}) {
|
|
51
50
|
const componentType = getComponentType(type, props.items !== undefined);
|
|
52
51
|
const NavbarItemComponent = getNavbarItemComponent(componentType);
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
// eslint-disable-next-line import/no-named-export
|
|
8
|
+
export const getInfimaActiveClassName = (mobile) =>
|
|
9
|
+
mobile ? 'menu__link--active' : 'navbar__link--active';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import Link from '@docusaurus/Link';
|
|
9
|
+
|
|
10
|
+
function PaginatorNavLink(props) {
|
|
11
|
+
const {permalink, title, subLabel} = props;
|
|
12
|
+
return (
|
|
13
|
+
<Link className="pagination-nav__link" to={permalink}>
|
|
14
|
+
{subLabel && <div className="pagination-nav__sublabel">{subLabel}</div>}
|
|
15
|
+
<div className="pagination-nav__label">{title}</div>
|
|
16
|
+
</Link>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default PaginatorNavLink;
|
|
@@ -37,7 +37,7 @@ function SkipToContent() {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
return (
|
|
40
|
-
<div ref={containerRef}>
|
|
40
|
+
<div ref={containerRef} role="region">
|
|
41
41
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
42
42
|
<a href="#" className={styles.skipToContent} onClick={handleSkip}>
|
|
43
43
|
<Translate
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
width: 100%;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.tocCollapsibleButton
|
|
23
|
+
.tocCollapsibleButton::after {
|
|
24
24
|
content: '';
|
|
25
25
|
background: var(--ifm-menu-link-sublist-icon) 50% 50% / 2rem 2rem no-repeat;
|
|
26
26
|
filter: var(--ifm-menu-link-sublist-icon-filter);
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
display: block;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.tocCollapsibleExpanded .tocCollapsibleButton
|
|
48
|
+
.tocCollapsibleExpanded .tocCollapsibleButton::after {
|
|
49
49
|
transform: none;
|
|
50
50
|
}
|
|
@@ -8,8 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import renderer from 'react-test-renderer';
|
|
9
9
|
import Tabs from '../index';
|
|
10
10
|
import TabItem from '../../TabItem';
|
|
11
|
-
import
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
TabGroupChoiceProvider,
|
|
13
|
+
ScrollControllerProvider,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
13
15
|
describe('Tabs', () => {
|
|
14
16
|
test('Should reject bad Tabs child', () => {
|
|
15
17
|
expect(() => {
|
|
@@ -55,7 +57,7 @@ describe('Tabs', () => {
|
|
|
55
57
|
expect(() => {
|
|
56
58
|
renderer.create(
|
|
57
59
|
<ScrollControllerProvider>
|
|
58
|
-
<
|
|
60
|
+
<TabGroupChoiceProvider>
|
|
59
61
|
<Tabs>
|
|
60
62
|
<TabItem value="v1">Tab 1</TabItem>
|
|
61
63
|
<TabItem value="v2">Tab 2</TabItem>
|
|
@@ -112,7 +114,7 @@ describe('Tabs', () => {
|
|
|
112
114
|
Tab 2
|
|
113
115
|
</TabItem>
|
|
114
116
|
</Tabs>
|
|
115
|
-
</
|
|
117
|
+
</TabGroupChoiceProvider>
|
|
116
118
|
</ScrollControllerProvider>,
|
|
117
119
|
);
|
|
118
120
|
}).not.toThrow(); // TODO Better Jest infrastructure to mock the Layout
|
|
@@ -123,7 +125,7 @@ describe('Tabs', () => {
|
|
|
123
125
|
const tabs = ['Apple', 'Banana', 'Carrot'];
|
|
124
126
|
renderer.create(
|
|
125
127
|
<ScrollControllerProvider>
|
|
126
|
-
<
|
|
128
|
+
<TabGroupChoiceProvider>
|
|
127
129
|
<Tabs
|
|
128
130
|
values={tabs.map((t, idx) => ({
|
|
129
131
|
label: t,
|
|
@@ -134,7 +136,7 @@ describe('Tabs', () => {
|
|
|
134
136
|
<TabItem value={idx}>{t}</TabItem>
|
|
135
137
|
))}
|
|
136
138
|
</Tabs>
|
|
137
|
-
</
|
|
139
|
+
</TabGroupChoiceProvider>
|
|
138
140
|
</ScrollControllerProvider>,
|
|
139
141
|
);
|
|
140
142
|
}).not.toThrow();
|
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {useState, cloneElement, Children, isValidElement} from 'react';
|
|
8
8
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
|
-
import
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
useScrollPositionBlocker,
|
|
11
|
+
duplicates,
|
|
12
|
+
useTabGroupChoice,
|
|
13
|
+
} from '@docusaurus/theme-common';
|
|
11
14
|
import clsx from 'clsx';
|
|
12
15
|
import styles from './styles.module.css'; // A very rough duck type, but good enough to guard against mistakes while
|
|
13
16
|
// allowing customization
|
|
@@ -39,10 +42,11 @@ function TabsComponent(props) {
|
|
|
39
42
|
);
|
|
40
43
|
});
|
|
41
44
|
const values =
|
|
42
|
-
valuesProp ??
|
|
43
|
-
children.map(({props: {value, label}}) => ({
|
|
45
|
+
valuesProp ?? // We only pick keys that we recognize. MDX would inject some keys by default
|
|
46
|
+
children.map(({props: {value, label, attributes}}) => ({
|
|
44
47
|
value,
|
|
45
48
|
label,
|
|
49
|
+
attributes,
|
|
46
50
|
}));
|
|
47
51
|
const dup = duplicates(values, (a, b) => a.value === b.value);
|
|
48
52
|
|
|
@@ -71,7 +75,7 @@ function TabsComponent(props) {
|
|
|
71
75
|
);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
const {tabGroupChoices, setTabGroupChoices} =
|
|
78
|
+
const {tabGroupChoices, setTabGroupChoices} = useTabGroupChoice();
|
|
75
79
|
const [selectedValue, setSelectedValue] = useState(defaultValue);
|
|
76
80
|
const tabRefs = [];
|
|
77
81
|
const {blockElementScrollPositionUntilNextRender} =
|
|
@@ -139,19 +143,25 @@ function TabsComponent(props) {
|
|
|
139
143
|
},
|
|
140
144
|
className,
|
|
141
145
|
)}>
|
|
142
|
-
{values.map(({value, label}) => (
|
|
146
|
+
{values.map(({value, label, attributes}) => (
|
|
143
147
|
<li
|
|
144
148
|
role="tab"
|
|
145
149
|
tabIndex={selectedValue === value ? 0 : -1}
|
|
146
150
|
aria-selected={selectedValue === value}
|
|
147
|
-
className={clsx('tabs__item', styles.tabItem, {
|
|
148
|
-
'tabs__item--active': selectedValue === value,
|
|
149
|
-
})}
|
|
150
151
|
key={value}
|
|
151
152
|
ref={(tabControl) => tabRefs.push(tabControl)}
|
|
152
153
|
onKeyDown={handleKeydown}
|
|
153
154
|
onFocus={handleTabChange}
|
|
154
|
-
onClick={handleTabChange}
|
|
155
|
+
onClick={handleTabChange}
|
|
156
|
+
{...attributes}
|
|
157
|
+
className={clsx(
|
|
158
|
+
'tabs__item',
|
|
159
|
+
styles.tabItem,
|
|
160
|
+
attributes?.className,
|
|
161
|
+
{
|
|
162
|
+
'tabs__item--active': selectedValue === value,
|
|
163
|
+
},
|
|
164
|
+
)}>
|
|
155
165
|
{label ?? value}
|
|
156
166
|
</li>
|
|
157
167
|
))}
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
border-left: 0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.tagWithCount
|
|
37
|
-
.tagWithCount
|
|
36
|
+
.tagWithCount::before,
|
|
37
|
+
.tagWithCount::after {
|
|
38
38
|
content: '';
|
|
39
39
|
position: absolute;
|
|
40
40
|
top: 50%;
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
transition: inherit;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.tagWithCount
|
|
45
|
+
.tagWithCount::before {
|
|
46
46
|
right: 100%;
|
|
47
47
|
transform: translate(50%, -50%) rotate(-45deg);
|
|
48
48
|
width: 1.18rem;
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
border-bottom: 0;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.tagWithCount
|
|
54
|
+
.tagWithCount::after {
|
|
55
55
|
left: 0;
|
|
56
56
|
transform: translateY(-50%);
|
|
57
57
|
width: 0.5rem;
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
10
|
-
import
|
|
10
|
+
import {useColorMode} from '@docusaurus/theme-common';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
|
|
13
13
|
function ThemedImage(props) {
|
|
14
14
|
const isBrowser = useIsBrowser();
|
|
15
|
-
const {isDarkTheme} =
|
|
15
|
+
const {isDarkTheme} = useColorMode();
|
|
16
16
|
const {sources, className, alt = '', ...propsRest} = props;
|
|
17
17
|
const clientThemes = isDarkTheme ? ['dark'] : ['light'];
|
|
18
18
|
const renderedSourceNames = isBrowser
|