@docusaurus/theme-classic 0.0.0-5043 → 0.0.0-5048
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/index.js +1 -1
- package/lib/theme/CodeBlock/Content/String.js +1 -1
- package/lib/theme/DocSidebarItem/Html/index.js +1 -1
- package/lib/theme/Footer/Links/MultiColumn/index.js +1 -1
- package/lib/theme/MDXComponents/Details.js +3 -1
- package/lib/theme/MDXComponents/Head.js +2 -2
- package/lib/theme/MDXComponents/Pre.js +2 -2
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +2 -2
- package/lib/theme/NavbarItem/index.js +7 -11
- package/lib/theme/Tabs/index.js +3 -3
- package/package.json +13 -13
- package/src/index.ts +4 -3
- package/src/theme/CodeBlock/Content/String.tsx +1 -1
- package/src/theme/DocSidebarItem/Html/index.tsx +1 -1
- package/src/theme/Footer/Links/MultiColumn/index.tsx +1 -1
- package/src/theme/MDXComponents/Details.tsx +5 -3
- package/src/theme/MDXComponents/Head.tsx +5 -3
- package/src/theme/MDXComponents/Pre.tsx +2 -2
- package/src/theme/Navbar/Content/index.tsx +1 -2
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +1 -2
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +1 -2
- package/src/theme/NavbarItem/index.tsx +9 -18
- package/src/theme/Tabs/index.tsx +3 -3
- package/src/theme-classic.d.ts +4 -3
package/lib/index.js
CHANGED
|
@@ -131,7 +131,7 @@ function themeClassic(context, options) {
|
|
|
131
131
|
const plugin = {
|
|
132
132
|
postcssPlugin: 'RtlCssPlugin',
|
|
133
133
|
prepare: (result) => {
|
|
134
|
-
const file = result.root
|
|
134
|
+
const file = result.root.source?.input.file;
|
|
135
135
|
// Skip Infima as we are using the its RTL version.
|
|
136
136
|
if (file === resolvedInfimaFile) {
|
|
137
137
|
return {};
|
|
@@ -15,7 +15,7 @@ export default function DocSidebarItemHtml({item, level, index}) {
|
|
|
15
15
|
className={clsx(
|
|
16
16
|
ThemeClassNames.docs.docSidebarItemLink,
|
|
17
17
|
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
18
|
-
defaultStyle &&
|
|
18
|
+
defaultStyle && [styles.menuHtmlItem, 'menu__list-item'],
|
|
19
19
|
className,
|
|
20
20
|
)}
|
|
21
21
|
key={index}
|
|
@@ -15,7 +15,7 @@ function ColumnLinkItem({item}) {
|
|
|
15
15
|
dangerouslySetInnerHTML={{__html: item.html}}
|
|
16
16
|
/>
|
|
17
17
|
) : (
|
|
18
|
-
<li key={item.href
|
|
18
|
+
<li key={item.href ?? item.to} className="footer__item">
|
|
19
19
|
<LinkItem item={item} />
|
|
20
20
|
</li>
|
|
21
21
|
);
|
|
@@ -10,7 +10,9 @@ export default function MDXDetails(props) {
|
|
|
10
10
|
const items = React.Children.toArray(props.children);
|
|
11
11
|
// Split summary item from the rest to pass it as a separate prop to the
|
|
12
12
|
// Details theme component
|
|
13
|
-
const summary = items.find(
|
|
13
|
+
const summary = items.find(
|
|
14
|
+
(item) => React.isValidElement(item) && item.props?.mdxType === 'summary',
|
|
15
|
+
);
|
|
14
16
|
const children = <>{items.filter((item) => item !== summary)}</>;
|
|
15
17
|
return (
|
|
16
18
|
<Details {...props} summary={summary}>
|
|
@@ -9,7 +9,7 @@ import Head from '@docusaurus/Head';
|
|
|
9
9
|
// MDX elements are wrapped through the MDX pragma. In some cases (notably usage
|
|
10
10
|
// with Head/Helmet) we need to unwrap those elements.
|
|
11
11
|
function unwrapMDXElement(element) {
|
|
12
|
-
if (element
|
|
12
|
+
if (element.props?.mdxType && element.props.originalType) {
|
|
13
13
|
const {mdxType, originalType, ...newProps} = element.props;
|
|
14
14
|
return React.createElement(element.props.originalType, newProps);
|
|
15
15
|
}
|
|
@@ -17,7 +17,7 @@ function unwrapMDXElement(element) {
|
|
|
17
17
|
}
|
|
18
18
|
export default function MDXHead(props) {
|
|
19
19
|
const unwrappedChildren = React.Children.map(props.children, (child) =>
|
|
20
|
-
unwrapMDXElement(child),
|
|
20
|
+
React.isValidElement(child) ? unwrapMDXElement(child) : child,
|
|
21
21
|
);
|
|
22
22
|
return <Head {...props}>{unwrappedChildren}</Head>;
|
|
23
23
|
}
|
|
@@ -11,8 +11,8 @@ export default function MDXPre(props) {
|
|
|
11
11
|
<CodeBlock
|
|
12
12
|
// If this pre is created by a ``` fenced codeblock, unwrap the children
|
|
13
13
|
{...(isValidElement(props.children) &&
|
|
14
|
-
props.children.props
|
|
15
|
-
? props.children
|
|
14
|
+
props.children.props?.originalType === 'code'
|
|
15
|
+
? props.children.props
|
|
16
16
|
: {...props})}
|
|
17
17
|
/>
|
|
18
18
|
);
|
|
@@ -33,13 +33,13 @@ export default function DocsVersionDropdownNavbarItem({
|
|
|
33
33
|
// We try to link to the same doc, in another version
|
|
34
34
|
// When not possible, fallback to the "main doc" of the version
|
|
35
35
|
const versionDoc =
|
|
36
|
-
activeDocContext
|
|
36
|
+
activeDocContext.alternateDocVersions[version.name] ??
|
|
37
37
|
getVersionMainDoc(version);
|
|
38
38
|
return {
|
|
39
39
|
isNavLink: true,
|
|
40
40
|
label: version.label,
|
|
41
41
|
to: versionDoc.path,
|
|
42
|
-
isActive: () => version === activeDocContext
|
|
42
|
+
isActive: () => version === activeDocContext.activeVersion,
|
|
43
43
|
onClick: () => savePreferredVersionName(version.name),
|
|
44
44
|
};
|
|
45
45
|
});
|
|
@@ -6,23 +6,19 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import ComponentTypes from '@theme/NavbarItem/ComponentTypes';
|
|
9
|
-
|
|
10
|
-
const component = ComponentTypes[type];
|
|
11
|
-
if (!component) {
|
|
12
|
-
throw new Error(`No NavbarItem component found for type "${type}".`);
|
|
13
|
-
}
|
|
14
|
-
return component;
|
|
15
|
-
};
|
|
16
|
-
function getComponentType(type, isDropdown) {
|
|
9
|
+
function normalizeComponentType(type, props) {
|
|
17
10
|
// Backward compatibility: navbar item with no type set
|
|
18
11
|
// but containing dropdown items should use the type "dropdown"
|
|
19
12
|
if (!type || type === 'default') {
|
|
20
|
-
return
|
|
13
|
+
return 'items' in props ? 'dropdown' : 'default';
|
|
21
14
|
}
|
|
22
15
|
return type;
|
|
23
16
|
}
|
|
24
17
|
export default function NavbarItem({type, ...props}) {
|
|
25
|
-
const componentType =
|
|
26
|
-
const NavbarItemComponent =
|
|
18
|
+
const componentType = normalizeComponentType(type, props);
|
|
19
|
+
const NavbarItemComponent = ComponentTypes[componentType];
|
|
20
|
+
if (!NavbarItemComponent) {
|
|
21
|
+
throw new Error(`No NavbarItem component found for type "${type}".`);
|
|
22
|
+
}
|
|
27
23
|
return <NavbarItemComponent {...props} />;
|
|
28
24
|
}
|
package/lib/theme/Tabs/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function TabsComponent(props) {
|
|
|
62
62
|
? defaultValueProp
|
|
63
63
|
: defaultValueProp ??
|
|
64
64
|
children.find((child) => child.props.default)?.props.value ??
|
|
65
|
-
children[0]
|
|
65
|
+
children[0].props.value;
|
|
66
66
|
if (defaultValue !== null && !values.some((a) => a.value === defaultValue)) {
|
|
67
67
|
throw new Error(
|
|
68
68
|
`Docusaurus error: The <Tabs> has a defaultValue "${defaultValue}" but none of its children has the corresponding value. Available values are: ${values
|
|
@@ -104,12 +104,12 @@ function TabsComponent(props) {
|
|
|
104
104
|
switch (event.key) {
|
|
105
105
|
case 'ArrowRight': {
|
|
106
106
|
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
107
|
-
focusElement = tabRefs[nextTab]
|
|
107
|
+
focusElement = tabRefs[nextTab] ?? tabRefs[0];
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
110
|
case 'ArrowLeft': {
|
|
111
111
|
const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
|
|
112
|
-
focusElement = tabRefs[prevTab]
|
|
112
|
+
focusElement = tabRefs[prevTab] ?? tabRefs[tabRefs.length - 1];
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5048",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "0.0.0-
|
|
24
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
25
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
27
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
28
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
29
|
-
"@docusaurus/utils": "0.0.0-
|
|
30
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
31
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5048",
|
|
24
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5048",
|
|
25
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5048",
|
|
26
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5048",
|
|
27
|
+
"@docusaurus/theme-common": "0.0.0-5048",
|
|
28
|
+
"@docusaurus/theme-translations": "0.0.0-5048",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-5048",
|
|
30
|
+
"@docusaurus/utils-common": "0.0.0-5048",
|
|
31
|
+
"@docusaurus/utils-validation": "0.0.0-5048",
|
|
32
32
|
"@mdx-js/react": "^1.6.22",
|
|
33
33
|
"clsx": "^1.1.1",
|
|
34
34
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"tslib": "^2.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
47
|
-
"@docusaurus/types": "0.0.0-
|
|
46
|
+
"@docusaurus/module-type-aliases": "0.0.0-5048",
|
|
47
|
+
"@docusaurus/types": "0.0.0-5048",
|
|
48
48
|
"@types/mdx-js__react": "^1.5.5",
|
|
49
49
|
"@types/nprogress": "^0.2.0",
|
|
50
50
|
"@types/prismjs": "^1.26.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "f5680d2f2633fbd6594972ae1f4c1ddb1467f9ac"
|
|
64
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -19,8 +19,9 @@ import type webpack from 'webpack';
|
|
|
19
19
|
const requireFromDocusaurusCore = createRequire(
|
|
20
20
|
require.resolve('@docusaurus/core/package.json'),
|
|
21
21
|
);
|
|
22
|
-
const ContextReplacementPlugin
|
|
23
|
-
|
|
22
|
+
const ContextReplacementPlugin = requireFromDocusaurusCore(
|
|
23
|
+
'webpack/lib/ContextReplacementPlugin',
|
|
24
|
+
) as typeof webpack.ContextReplacementPlugin;
|
|
24
25
|
|
|
25
26
|
// Need to be inlined to prevent dark mode FOUC
|
|
26
27
|
// Make sure the key is the same as the one in `/theme/hooks/useTheme.js`
|
|
@@ -177,7 +178,7 @@ export default function themeClassic(
|
|
|
177
178
|
const plugin: PostCssPlugin = {
|
|
178
179
|
postcssPlugin: 'RtlCssPlugin',
|
|
179
180
|
prepare: (result) => {
|
|
180
|
-
const file = result.root
|
|
181
|
+
const file = result.root.source?.input.file;
|
|
181
182
|
// Skip Infima as we are using the its RTL version.
|
|
182
183
|
if (file === resolvedInfimaFile) {
|
|
183
184
|
return {};
|
|
@@ -23,7 +23,7 @@ export default function DocSidebarItemHtml({
|
|
|
23
23
|
className={clsx(
|
|
24
24
|
ThemeClassNames.docs.docSidebarItemLink,
|
|
25
25
|
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
26
|
-
defaultStyle &&
|
|
26
|
+
defaultStyle && [styles.menuHtmlItem, 'menu__list-item'],
|
|
27
27
|
className,
|
|
28
28
|
)}
|
|
29
29
|
key={index}
|
|
@@ -21,7 +21,7 @@ function ColumnLinkItem({item}: {item: ColumnItemType}) {
|
|
|
21
21
|
dangerouslySetInnerHTML={{__html: item.html}}
|
|
22
22
|
/>
|
|
23
23
|
) : (
|
|
24
|
-
<li key={item.href
|
|
24
|
+
<li key={item.href ?? item.to} className="footer__item">
|
|
25
25
|
<LinkItem item={item} />
|
|
26
26
|
</li>
|
|
27
27
|
);
|
|
@@ -10,11 +10,13 @@ import Details from '@theme/Details';
|
|
|
10
10
|
import type {Props} from '@theme/MDXComponents/Details';
|
|
11
11
|
|
|
12
12
|
export default function MDXDetails(props: Props): JSX.Element {
|
|
13
|
-
const items = React.Children.toArray(props.children)
|
|
13
|
+
const items = React.Children.toArray(props.children);
|
|
14
14
|
// Split summary item from the rest to pass it as a separate prop to the
|
|
15
15
|
// Details theme component
|
|
16
|
-
const summary
|
|
17
|
-
|
|
16
|
+
const summary = items.find(
|
|
17
|
+
(item): item is ReactElement<ComponentProps<'summary'>> =>
|
|
18
|
+
React.isValidElement(item) && item.props?.mdxType === 'summary',
|
|
19
|
+
);
|
|
18
20
|
const children = <>{items.filter((item) => item !== summary)}</>;
|
|
19
21
|
|
|
20
22
|
return (
|
|
@@ -11,8 +11,10 @@ import type {Props} from '@theme/MDXComponents/Head';
|
|
|
11
11
|
|
|
12
12
|
// MDX elements are wrapped through the MDX pragma. In some cases (notably usage
|
|
13
13
|
// with Head/Helmet) we need to unwrap those elements.
|
|
14
|
-
function unwrapMDXElement(
|
|
15
|
-
|
|
14
|
+
function unwrapMDXElement(
|
|
15
|
+
element: ReactElement<{mdxType?: string; originalType?: string} | undefined>,
|
|
16
|
+
) {
|
|
17
|
+
if (element.props?.mdxType && element.props.originalType) {
|
|
16
18
|
const {mdxType, originalType, ...newProps} = element.props;
|
|
17
19
|
return React.createElement(element.props.originalType, newProps);
|
|
18
20
|
}
|
|
@@ -21,7 +23,7 @@ function unwrapMDXElement(element: ReactElement) {
|
|
|
21
23
|
|
|
22
24
|
export default function MDXHead(props: Props): JSX.Element {
|
|
23
25
|
const unwrappedChildren = React.Children.map(props.children, (child) =>
|
|
24
|
-
unwrapMDXElement(child
|
|
26
|
+
React.isValidElement(child) ? unwrapMDXElement(child) : child,
|
|
25
27
|
);
|
|
26
28
|
return (
|
|
27
29
|
<Head {...(props as ComponentProps<typeof Head>)}>{unwrappedChildren}</Head>
|
|
@@ -14,8 +14,8 @@ export default function MDXPre(props: Props): JSX.Element {
|
|
|
14
14
|
<CodeBlock
|
|
15
15
|
// If this pre is created by a ``` fenced codeblock, unwrap the children
|
|
16
16
|
{...(isValidElement(props.children) &&
|
|
17
|
-
props.children.props
|
|
18
|
-
? props.children
|
|
17
|
+
props.children.props?.originalType === 'code'
|
|
18
|
+
? props.children.props
|
|
19
19
|
: {...props})}
|
|
20
20
|
/>
|
|
21
21
|
);
|
|
@@ -11,13 +11,12 @@ import {
|
|
|
11
11
|
useNavbarMobileSidebar,
|
|
12
12
|
useThemeConfig,
|
|
13
13
|
} from '@docusaurus/theme-common';
|
|
14
|
-
import NavbarItem from '@theme/NavbarItem';
|
|
14
|
+
import NavbarItem, {type Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
15
15
|
import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
|
|
16
16
|
import SearchBar from '@theme/SearchBar';
|
|
17
17
|
import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
|
|
18
18
|
import NavbarLogo from '@theme/Navbar/Logo';
|
|
19
19
|
import NavbarSearch from '@theme/Navbar/Search';
|
|
20
|
-
import type {Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
21
20
|
|
|
22
21
|
import styles from './styles.module.css';
|
|
23
22
|
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import {useNavbarMobileSidebar, useThemeConfig} from '@docusaurus/theme-common';
|
|
10
|
-
import NavbarItem from '@theme/NavbarItem';
|
|
11
|
-
import type {Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
10
|
+
import NavbarItem, {type Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
12
11
|
|
|
13
12
|
function useNavbarItems() {
|
|
14
13
|
// TODO temporary casting until ThemeConfig type is improved
|
|
@@ -38,13 +38,13 @@ export default function DocsVersionDropdownNavbarItem({
|
|
|
38
38
|
// We try to link to the same doc, in another version
|
|
39
39
|
// When not possible, fallback to the "main doc" of the version
|
|
40
40
|
const versionDoc =
|
|
41
|
-
activeDocContext
|
|
41
|
+
activeDocContext.alternateDocVersions[version.name] ??
|
|
42
42
|
getVersionMainDoc(version);
|
|
43
43
|
return {
|
|
44
44
|
isNavLink: true,
|
|
45
45
|
label: version.label,
|
|
46
46
|
to: versionDoc.path,
|
|
47
|
-
isActive: () => version === activeDocContext
|
|
47
|
+
isActive: () => version === activeDocContext.activeVersion,
|
|
48
48
|
onClick: () => savePreferredVersionName(version.name),
|
|
49
49
|
};
|
|
50
50
|
});
|
|
@@ -15,12 +15,11 @@ import {
|
|
|
15
15
|
useLocalPathname,
|
|
16
16
|
} from '@docusaurus/theme-common';
|
|
17
17
|
import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
|
|
18
|
-
import NavbarItem from '@theme/NavbarItem';
|
|
18
|
+
import NavbarItem, {type LinkLikeNavbarItemProps} from '@theme/NavbarItem';
|
|
19
19
|
import type {
|
|
20
20
|
DesktopOrMobileNavBarItemProps,
|
|
21
21
|
Props,
|
|
22
22
|
} from '@theme/NavbarItem/DropdownNavbarItem';
|
|
23
|
-
import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
|
|
24
23
|
|
|
25
24
|
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
26
25
|
|
|
@@ -7,31 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import ComponentTypes from '@theme/NavbarItem/ComponentTypes';
|
|
10
|
-
import
|
|
11
|
-
import type {Types, Props} from '@theme/NavbarItem';
|
|
10
|
+
import type {NavbarItemType, Props} from '@theme/NavbarItem';
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
const component = ComponentTypes[type];
|
|
15
|
-
if (!component) {
|
|
16
|
-
throw new Error(`No NavbarItem component found for type "${type}".`);
|
|
17
|
-
}
|
|
18
|
-
return component;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function getComponentType(type: Types, isDropdown: boolean) {
|
|
12
|
+
function normalizeComponentType(type: NavbarItemType, props: object) {
|
|
22
13
|
// Backward compatibility: navbar item with no type set
|
|
23
14
|
// but containing dropdown items should use the type "dropdown"
|
|
24
15
|
if (!type || type === 'default') {
|
|
25
|
-
return
|
|
16
|
+
return 'items' in props ? 'dropdown' : 'default';
|
|
26
17
|
}
|
|
27
|
-
return type
|
|
18
|
+
return type;
|
|
28
19
|
}
|
|
29
20
|
|
|
30
21
|
export default function NavbarItem({type, ...props}: Props): JSX.Element {
|
|
31
|
-
const componentType =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
const componentType = normalizeComponentType(type, props);
|
|
23
|
+
const NavbarItemComponent = ComponentTypes[componentType];
|
|
24
|
+
if (!NavbarItemComponent) {
|
|
25
|
+
throw new Error(`No NavbarItem component found for type "${type}".`);
|
|
26
|
+
}
|
|
36
27
|
return <NavbarItemComponent {...(props as never)} />;
|
|
37
28
|
}
|
package/src/theme/Tabs/index.tsx
CHANGED
|
@@ -75,7 +75,7 @@ function TabsComponent(props: Props): JSX.Element {
|
|
|
75
75
|
? defaultValueProp
|
|
76
76
|
: defaultValueProp ??
|
|
77
77
|
children.find((child) => child.props.default)?.props.value ??
|
|
78
|
-
children[0]
|
|
78
|
+
children[0]!.props.value;
|
|
79
79
|
if (defaultValue !== null && !values.some((a) => a.value === defaultValue)) {
|
|
80
80
|
throw new Error(
|
|
81
81
|
`Docusaurus error: The <Tabs> has a defaultValue "${defaultValue}" but none of its children has the corresponding value. Available values are: ${values
|
|
@@ -126,12 +126,12 @@ function TabsComponent(props: Props): JSX.Element {
|
|
|
126
126
|
switch (event.key) {
|
|
127
127
|
case 'ArrowRight': {
|
|
128
128
|
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
129
|
-
focusElement = tabRefs[nextTab]
|
|
129
|
+
focusElement = tabRefs[nextTab] ?? tabRefs[0]!;
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
case 'ArrowLeft': {
|
|
133
133
|
const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
|
|
134
|
-
focusElement = tabRefs[prevTab]
|
|
134
|
+
focusElement = tabRefs[prevTab] ?? tabRefs[tabRefs.length - 1]!;
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
137
|
default:
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -21,12 +21,14 @@
|
|
|
21
21
|
// in their tsconfig.
|
|
22
22
|
|
|
23
23
|
declare module '@docusaurus/theme-classic' {
|
|
24
|
-
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
24
|
+
import type {LoadContext, Plugin, PluginModule} from '@docusaurus/types';
|
|
25
25
|
|
|
26
26
|
export type Options = {
|
|
27
27
|
customCss?: string | string[];
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
export const getSwizzleConfig: PluginModule['getSwizzleConfig'];
|
|
31
|
+
|
|
30
32
|
export default function themeClassic(
|
|
31
33
|
context: LoadContext,
|
|
32
34
|
options: Options,
|
|
@@ -814,7 +816,6 @@ declare module '@theme/NavbarItem/NavbarNavLink' {
|
|
|
814
816
|
|
|
815
817
|
declare module '@theme/NavbarItem/DropdownNavbarItem' {
|
|
816
818
|
import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
|
|
817
|
-
|
|
818
819
|
import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
|
|
819
820
|
|
|
820
821
|
export type DesktopOrMobileNavBarItemProps = NavbarNavLinkProps & {
|
|
@@ -974,7 +975,7 @@ declare module '@theme/NavbarItem' {
|
|
|
974
975
|
} & SearchNavbarItemProps)
|
|
975
976
|
);
|
|
976
977
|
|
|
977
|
-
export type
|
|
978
|
+
export type NavbarItemType = Props['type'];
|
|
978
979
|
|
|
979
980
|
export default function NavbarItem(props: Props): JSX.Element;
|
|
980
981
|
}
|