@docusaurus/theme-classic 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/getSwizzleConfig.js +35 -1
  2. package/lib/theme/DocBreadcrumbs/Items/Home/index.d.ts +8 -0
  3. package/lib/theme/DocBreadcrumbs/Items/Home/index.js +29 -0
  4. package/lib/theme/DocBreadcrumbs/Items/Home/styles.module.css +14 -0
  5. package/lib/theme/DocBreadcrumbs/index.js +1 -19
  6. package/lib/theme/DocBreadcrumbs/styles.module.css +0 -8
  7. package/lib/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +3 -2
  8. package/lib/theme/DocPage/Layout/Sidebar/index.js +13 -8
  9. package/lib/theme/DocPage/Layout/Sidebar/styles.module.css +7 -0
  10. package/lib/theme/DocPage/Layout/styles.module.css +1 -0
  11. package/lib/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +1 -0
  12. package/lib/theme/DocSidebar/Desktop/Content/index.js +6 -0
  13. package/lib/theme/DocSidebar/Desktop/styles.module.css +0 -6
  14. package/lib/theme/Heading/index.js +17 -8
  15. package/lib/theme/Layout/Provider/index.js +0 -2
  16. package/lib/theme/Layout/styles.module.css +2 -0
  17. package/lib/theme/Navbar/Layout/index.js +6 -0
  18. package/lib/theme/Tabs/index.js +65 -130
  19. package/package.json +14 -14
  20. package/src/getSwizzleConfig.ts +39 -1
  21. package/src/theme/DocBreadcrumbs/Items/Home/index.tsx +33 -0
  22. package/src/theme/DocBreadcrumbs/Items/Home/styles.module.css +14 -0
  23. package/src/theme/DocBreadcrumbs/index.tsx +1 -20
  24. package/src/theme/DocBreadcrumbs/styles.module.css +0 -8
  25. package/src/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +3 -2
  26. package/src/theme/DocPage/Layout/Sidebar/index.tsx +13 -8
  27. package/src/theme/DocPage/Layout/Sidebar/styles.module.css +7 -0
  28. package/src/theme/DocPage/Layout/styles.module.css +1 -0
  29. package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +1 -0
  30. package/src/theme/DocSidebar/Desktop/Content/index.tsx +6 -0
  31. package/src/theme/DocSidebar/Desktop/styles.module.css +0 -6
  32. package/src/theme/Heading/index.tsx +18 -8
  33. package/src/theme/Layout/Provider/index.tsx +0 -2
  34. package/src/theme/Layout/styles.module.css +2 -0
  35. package/src/theme/Navbar/Layout/index.tsx +6 -0
  36. package/src/theme/Tabs/index.tsx +81 -142
  37. package/src/theme-classic.d.ts +8 -25
@@ -17,6 +17,13 @@ function getSwizzleConfig() {
17
17
  },
18
18
  description: 'The component used to render multi-line code blocks, generally used in Markdown files.',
19
19
  },
20
+ 'CodeBlock/Content': {
21
+ actions: {
22
+ eject: 'unsafe',
23
+ wrap: 'forbidden',
24
+ },
25
+ description: 'The folder containing components responsible for rendering different types of CodeBlock content.',
26
+ },
20
27
  ColorModeToggle: {
21
28
  actions: {
22
29
  eject: 'safe',
@@ -24,6 +31,13 @@ function getSwizzleConfig() {
24
31
  },
25
32
  description: 'The color mode toggle to switch between light and dark mode.',
26
33
  },
34
+ 'DocBreadcrumbs/Items': {
35
+ actions: {
36
+ eject: 'unsafe',
37
+ wrap: 'forbidden', // Can't wrap a folder
38
+ },
39
+ description: 'The components responsible for rendering the breadcrumb items',
40
+ },
27
41
  DocCardList: {
28
42
  actions: {
29
43
  eject: 'safe',
@@ -31,6 +45,16 @@ function getSwizzleConfig() {
31
45
  },
32
46
  description: 'The component responsible for rendering a list of sidebar items cards.\nNotable used on the category generated-index pages.',
33
47
  },
48
+ 'DocItem/TOC': {
49
+ actions: {
50
+ // Forbidden because it's a parent folder, makes the CLI crash atm
51
+ // TODO the CLI should rather support --eject
52
+ // Subfolders can be swizzled
53
+ eject: 'forbidden',
54
+ wrap: 'forbidden',
55
+ },
56
+ description: 'The DocItem TOC is not directly swizzle-able, but you can swizzle its sub-components.',
57
+ },
34
58
  DocSidebar: {
35
59
  actions: {
36
60
  eject: 'unsafe',
@@ -94,6 +118,16 @@ function getSwizzleConfig() {
94
118
  },
95
119
  description: 'The footer logo',
96
120
  },
121
+ Icon: {
122
+ actions: {
123
+ // Forbidden because it's a parent folder, makes the CLI crash atm
124
+ // TODO the CLI should rather support --eject
125
+ // Subfolders can be swizzled
126
+ eject: 'forbidden',
127
+ wrap: 'forbidden',
128
+ },
129
+ description: 'The Icon folder is not directly swizzle-able, but you can swizzle its sub-components.',
130
+ },
97
131
  'Icon/Arrow': {
98
132
  actions: {
99
133
  eject: 'safe',
@@ -204,7 +238,7 @@ function getSwizzleConfig() {
204
238
  eject: 'safe',
205
239
  wrap: 'forbidden',
206
240
  },
207
- description: 'The Navbar item components mapping. Can be ejected to add custom navbar item types. See https://github.com/facebook/docusaurus/issues/7227.',
241
+ description: 'The Navbar item components mapping. Can be ejected to add custom navbar item types.\nSee https://github.com/facebook/docusaurus/issues/7227.',
208
242
  },
209
243
  NotFound: {
210
244
  actions: {
@@ -0,0 +1,8 @@
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
+ /// <reference types="react" />
8
+ export default function HomeBreadcrumbItem(): JSX.Element;
@@ -0,0 +1,29 @@
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 {translate} from '@docusaurus/Translate';
11
+ import IconHome from '@theme/Icon/Home';
12
+ import styles from './styles.module.css';
13
+ export default function HomeBreadcrumbItem() {
14
+ const homeHref = useBaseUrl('/');
15
+ return (
16
+ <li className="breadcrumbs__item">
17
+ <Link
18
+ aria-label={translate({
19
+ id: 'theme.docs.breadcrumbs.home',
20
+ message: 'Home page',
21
+ description: 'The ARIA label for the home page in the breadcrumbs',
22
+ })}
23
+ className="breadcrumbs__link"
24
+ href={homeHref}>
25
+ <IconHome className={styles.breadcrumbHomeIcon} />
26
+ </Link>
27
+ </li>
28
+ );
29
+ }
@@ -0,0 +1,14 @@
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
+
8
+ .breadcrumbHomeIcon {
9
+ position: relative;
10
+ top: 1px;
11
+ vertical-align: top;
12
+ height: 1.1rem;
13
+ width: 1.1rem;
14
+ }
@@ -12,9 +12,8 @@ import {
12
12
  useHomePageRoute,
13
13
  } from '@docusaurus/theme-common/internal';
14
14
  import Link from '@docusaurus/Link';
15
- import useBaseUrl from '@docusaurus/useBaseUrl';
16
15
  import {translate} from '@docusaurus/Translate';
17
- import IconHome from '@theme/Icon/Home';
16
+ import HomeBreadcrumbItem from '@theme/DocBreadcrumbs/Items/Home';
18
17
  import styles from './styles.module.css';
19
18
  // TODO move to design system folder
20
19
  function BreadcrumbsItemLink({children, href, isLast}) {
@@ -56,23 +55,6 @@ function BreadcrumbsItem({children, active, index, addMicrodata}) {
56
55
  </li>
57
56
  );
58
57
  }
59
- function HomeBreadcrumbItem() {
60
- const homeHref = useBaseUrl('/');
61
- return (
62
- <li className="breadcrumbs__item">
63
- <Link
64
- aria-label={translate({
65
- id: 'theme.docs.breadcrumbs.home',
66
- message: 'Home page',
67
- description: 'The ARIA label for the home page in the breadcrumbs',
68
- })}
69
- className={clsx('breadcrumbs__link', styles.breadcrumbsItemLink)}
70
- href={homeHref}>
71
- <IconHome className={styles.breadcrumbHomeIcon} />
72
- </Link>
73
- </li>
74
- );
75
- }
76
58
  export default function DocBreadcrumbs() {
77
59
  const breadcrumbs = useSidebarBreadcrumbs();
78
60
  const homePageRoute = useHomePageRoute();
@@ -9,11 +9,3 @@
9
9
  --ifm-breadcrumb-size-multiplier: 0.8;
10
10
  margin-bottom: 0.8rem;
11
11
  }
12
-
13
- .breadcrumbHomeIcon {
14
- position: relative;
15
- top: 1px;
16
- vertical-align: top;
17
- height: 1.1rem;
18
- width: 1.1rem;
19
- }
@@ -7,10 +7,11 @@
7
7
 
8
8
  @media (min-width: 997px) {
9
9
  .expandButton {
10
- position: sticky;
10
+ position: absolute;
11
11
  top: 0;
12
+ right: 0;
13
+ width: 100%;
12
14
  height: 100%;
13
- max-height: 100vh;
14
15
  display: flex;
15
16
  align-items: center;
16
17
  justify-content: center;
@@ -52,15 +52,20 @@ export default function DocPageLayoutSidebar({
52
52
  }
53
53
  }}>
54
54
  <ResetOnSidebarChange>
55
- <DocSidebar
56
- sidebar={sidebar}
57
- path={pathname}
58
- onCollapse={toggleSidebar}
59
- isHidden={hiddenSidebar}
60
- />
55
+ <div
56
+ className={clsx(
57
+ styles.sidebarViewport,
58
+ hiddenSidebar && styles.sidebarViewportHidden,
59
+ )}>
60
+ <DocSidebar
61
+ sidebar={sidebar}
62
+ path={pathname}
63
+ onCollapse={toggleSidebar}
64
+ isHidden={hiddenSidebar}
65
+ />
66
+ {hiddenSidebar && <ExpandButton toggleSidebar={toggleSidebar} />}
67
+ </div>
61
68
  </ResetOnSidebarChange>
62
-
63
- {hiddenSidebar && <ExpandButton toggleSidebar={toggleSidebar} />}
64
69
  </aside>
65
70
  );
66
71
  }
@@ -29,4 +29,11 @@
29
29
  width: var(--doc-sidebar-hidden-width);
30
30
  cursor: pointer;
31
31
  }
32
+
33
+ .sidebarViewport {
34
+ top: 0;
35
+ position: sticky;
36
+ height: 100%;
37
+ max-height: 100vh;
38
+ }
32
39
  }
@@ -12,4 +12,5 @@
12
12
 
13
13
  .docsWrapper {
14
14
  display: flex;
15
+ flex: 1 0 auto;
15
16
  }
@@ -43,4 +43,5 @@
43
43
 
44
44
  .collapseSidebarButton {
45
45
  display: none;
46
+ margin: 0;
46
47
  }
@@ -11,6 +11,7 @@ import {
11
11
  useAnnouncementBar,
12
12
  useScrollPosition,
13
13
  } from '@docusaurus/theme-common/internal';
14
+ import {translate} from '@docusaurus/Translate';
14
15
  import DocSidebarItems from '@theme/DocSidebarItems';
15
16
  import styles from './styles.module.css';
16
17
  function useShowAnnouncementBar() {
@@ -30,6 +31,11 @@ export default function DocSidebarDesktopContent({path, sidebar, className}) {
30
31
  const showAnnouncementBar = useShowAnnouncementBar();
31
32
  return (
32
33
  <nav
34
+ aria-label={translate({
35
+ id: 'theme.docs.sidebar.navAriaLabel',
36
+ message: 'Docs sidebar',
37
+ description: 'The ARIA label for the sidebar navigation',
38
+ })}
33
39
  className={clsx(
34
40
  'menu thin-scrollbar',
35
41
  styles.menu,
@@ -9,13 +9,9 @@
9
9
  .sidebar {
10
10
  display: flex;
11
11
  flex-direction: column;
12
- max-height: 100vh;
13
12
  height: 100%;
14
- position: sticky;
15
- top: 0;
16
13
  padding-top: var(--ifm-navbar-height);
17
14
  width: var(--doc-sidebar-width);
18
- transition: opacity 50ms ease;
19
15
  }
20
16
 
21
17
  .sidebarWithHideableNavbar {
@@ -24,8 +20,6 @@
24
20
 
25
21
  .sidebarHidden {
26
22
  opacity: 0;
27
- height: 0;
28
- overflow: hidden;
29
23
  visibility: hidden;
30
24
  }
31
25
 
@@ -8,6 +8,7 @@ import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import {translate} from '@docusaurus/Translate';
10
10
  import {useThemeConfig} from '@docusaurus/theme-common';
11
+ import Link from '@docusaurus/Link';
11
12
  import styles from './styles.module.css';
12
13
  export default function Heading({as: As, id, ...props}) {
13
14
  const {
@@ -17,6 +18,16 @@ export default function Heading({as: As, id, ...props}) {
17
18
  if (As === 'h1' || !id) {
18
19
  return <As {...props} id={undefined} />;
19
20
  }
21
+ const anchorTitle = translate(
22
+ {
23
+ id: 'theme.common.headingLinkTitle',
24
+ message: 'Direct link to {heading}',
25
+ description: 'Title for link to heading',
26
+ },
27
+ {
28
+ heading: typeof props.children === 'string' ? props.children : id,
29
+ },
30
+ );
20
31
  return (
21
32
  <As
22
33
  {...props}
@@ -25,19 +36,17 @@ export default function Heading({as: As, id, ...props}) {
25
36
  hideOnScroll
26
37
  ? styles.anchorWithHideOnScrollNavbar
27
38
  : styles.anchorWithStickyNavbar,
39
+ props.className,
28
40
  )}
29
41
  id={id}>
30
42
  {props.children}
31
- <a
43
+ <Link
32
44
  className="hash-link"
33
- href={`#${id}`}
34
- title={translate({
35
- id: 'theme.common.headingLinkTitle',
36
- message: 'Direct link to heading',
37
- description: 'Title for link to heading',
38
- })}>
45
+ to={`#${id}`}
46
+ aria-label={anchorTitle}
47
+ title={anchorTitle}>
39
48
  &#8203;
40
- </a>
49
+ </Link>
41
50
  </As>
42
51
  );
43
52
  }
@@ -8,7 +8,6 @@ import React from 'react';
8
8
  import {composeProviders} from '@docusaurus/theme-common';
9
9
  import {
10
10
  ColorModeProvider,
11
- TabGroupChoiceProvider,
12
11
  AnnouncementBarProvider,
13
12
  DocsPreferredVersionContextProvider,
14
13
  ScrollControllerProvider,
@@ -18,7 +17,6 @@ import {
18
17
  const Provider = composeProviders([
19
18
  ColorModeProvider,
20
19
  AnnouncementBarProvider,
21
- TabGroupChoiceProvider,
22
20
  ScrollControllerProvider,
23
21
  DocsPreferredVersionContextProvider,
24
22
  PluginHtmlClassNameProvider,
@@ -12,6 +12,8 @@ body {
12
12
 
13
13
  .mainWrapper {
14
14
  flex: 1 0 auto;
15
+ display: flex;
16
+ flex-direction: column;
15
17
  }
16
18
 
17
19
  /* Docusaurus-specific utility class */
@@ -11,6 +11,7 @@ import {
11
11
  useHideableNavbar,
12
12
  useNavbarMobileSidebar,
13
13
  } from '@docusaurus/theme-common/internal';
14
+ import {translate} from '@docusaurus/Translate';
14
15
  import NavbarMobileSidebar from '@theme/Navbar/MobileSidebar';
15
16
  import styles from './styles.module.css';
16
17
  function NavbarBackdrop(props) {
@@ -31,6 +32,11 @@ export default function NavbarLayout({children}) {
31
32
  return (
32
33
  <nav
33
34
  ref={navbarRef}
35
+ aria-label={translate({
36
+ id: 'theme.NavBar.navAriaLabel',
37
+ message: 'Main',
38
+ description: 'The ARIA label for the main navigation',
39
+ })}
34
40
  className={clsx(
35
41
  'navbar',
36
42
  'navbar--fixed-top',
@@ -4,99 +4,25 @@
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
- import React, {useState, cloneElement, isValidElement} from 'react';
7
+ import React, {cloneElement} from 'react';
8
8
  import clsx from 'clsx';
9
- import useIsBrowser from '@docusaurus/useIsBrowser';
10
- import {duplicates} from '@docusaurus/theme-common';
11
9
  import {
12
10
  useScrollPositionBlocker,
13
- useTabGroupChoice,
11
+ useTabs,
14
12
  } from '@docusaurus/theme-common/internal';
13
+ import useIsBrowser from '@docusaurus/useIsBrowser';
15
14
  import styles from './styles.module.css';
16
- // A very rough duck type, but good enough to guard against mistakes while
17
- // allowing customization
18
- function isTabItem(comp) {
19
- return 'value' in comp.props;
20
- }
21
- function TabsComponent(props) {
22
- const {
23
- lazy,
24
- block,
25
- defaultValue: defaultValueProp,
26
- values: valuesProp,
27
- groupId,
28
- className,
29
- } = props;
30
- const children = React.Children.map(props.children, (child) => {
31
- if (isValidElement(child) && isTabItem(child)) {
32
- return child;
33
- }
34
- // child.type.name will give non-sensical values in prod because of
35
- // minification, but we assume it won't throw in prod.
36
- throw new Error(
37
- `Docusaurus error: Bad <Tabs> child <${
38
- // @ts-expect-error: guarding against unexpected cases
39
- typeof child.type === 'string' ? child.type : child.type.name
40
- }>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`,
41
- );
42
- });
43
- const values =
44
- valuesProp ??
45
- // Only pick keys that we recognize. MDX would inject some keys by default
46
- children.map(({props: {value, label, attributes}}) => ({
47
- value,
48
- label,
49
- attributes,
50
- }));
51
- const dup = duplicates(values, (a, b) => a.value === b.value);
52
- if (dup.length > 0) {
53
- throw new Error(
54
- `Docusaurus error: Duplicate values "${dup
55
- .map((a) => a.value)
56
- .join(', ')}" found in <Tabs>. Every value needs to be unique.`,
57
- );
58
- }
59
- // When defaultValueProp is null, don't show a default tab
60
- const defaultValue =
61
- defaultValueProp === null
62
- ? defaultValueProp
63
- : defaultValueProp ??
64
- children.find((child) => child.props.default)?.props.value ??
65
- children[0].props.value;
66
- if (defaultValue !== null && !values.some((a) => a.value === defaultValue)) {
67
- throw new Error(
68
- `Docusaurus error: The <Tabs> has a defaultValue "${defaultValue}" but none of its children has the corresponding value. Available values are: ${values
69
- .map((a) => a.value)
70
- .join(
71
- ', ',
72
- )}. If you intend to show no default tab, use defaultValue={null} instead.`,
73
- );
74
- }
75
- const {tabGroupChoices, setTabGroupChoices} = useTabGroupChoice();
76
- const [selectedValue, setSelectedValue] = useState(defaultValue);
15
+ function TabList({className, block, selectedValue, selectValue, tabValues}) {
77
16
  const tabRefs = [];
78
17
  const {blockElementScrollPositionUntilNextRender} =
79
18
  useScrollPositionBlocker();
80
- if (groupId != null) {
81
- const relevantTabGroupChoice = tabGroupChoices[groupId];
82
- if (
83
- relevantTabGroupChoice != null &&
84
- relevantTabGroupChoice !== selectedValue &&
85
- values.some((value) => value.value === relevantTabGroupChoice)
86
- ) {
87
- setSelectedValue(relevantTabGroupChoice);
88
- }
89
- }
90
19
  const handleTabChange = (event) => {
91
20
  const newTab = event.currentTarget;
92
21
  const newTabIndex = tabRefs.indexOf(newTab);
93
- const newTabValue = values[newTabIndex].value;
22
+ const newTabValue = tabValues[newTabIndex].value;
94
23
  if (newTabValue !== selectedValue) {
95
24
  blockElementScrollPositionUntilNextRender(newTab);
96
- setSelectedValue(newTabValue);
97
- if (groupId != null) {
98
- setTabGroupChoices(groupId, String(newTabValue));
99
- }
25
+ selectValue(newTabValue);
100
26
  }
101
27
  };
102
28
  const handleKeydown = (event) => {
@@ -122,60 +48,69 @@ function TabsComponent(props) {
122
48
  focusElement?.focus();
123
49
  };
124
50
  return (
125
- <div className={clsx('tabs-container', styles.tabList)}>
126
- <ul
127
- role="tablist"
128
- aria-orientation="horizontal"
129
- className={clsx(
130
- 'tabs',
131
- {
132
- 'tabs--block': block,
133
- },
134
- className,
135
- )}>
136
- {values.map(({value, label, attributes}) => (
137
- <li
138
- role="tab"
139
- tabIndex={selectedValue === value ? 0 : -1}
140
- aria-selected={selectedValue === value}
141
- key={value}
142
- ref={(tabControl) => tabRefs.push(tabControl)}
143
- onKeyDown={handleKeydown}
144
- onClick={handleTabChange}
145
- {...attributes}
146
- className={clsx(
147
- 'tabs__item',
148
- styles.tabItem,
149
- attributes?.className,
150
- {
151
- 'tabs__item--active': selectedValue === value,
152
- },
153
- )}>
154
- {label ?? value}
155
- </li>
156
- ))}
157
- </ul>
158
-
159
- {lazy ? (
160
- cloneElement(
161
- children.filter(
162
- (tabItem) => tabItem.props.value === selectedValue,
163
- )[0],
164
- {className: 'margin-top--md'},
165
- )
166
- ) : (
167
- <div className="margin-top--md">
168
- {children.map((tabItem, i) =>
169
- cloneElement(tabItem, {
170
- key: i,
171
- hidden: tabItem.props.value !== selectedValue,
172
- }),
173
- )}
174
- </div>
51
+ <ul
52
+ role="tablist"
53
+ aria-orientation="horizontal"
54
+ className={clsx(
55
+ 'tabs',
56
+ {
57
+ 'tabs--block': block,
58
+ },
59
+ className,
60
+ )}>
61
+ {tabValues.map(({value, label, attributes}) => (
62
+ <li
63
+ // TODO extract TabListItem
64
+ role="tab"
65
+ tabIndex={selectedValue === value ? 0 : -1}
66
+ aria-selected={selectedValue === value}
67
+ key={value}
68
+ ref={(tabControl) => tabRefs.push(tabControl)}
69
+ onKeyDown={handleKeydown}
70
+ onClick={handleTabChange}
71
+ {...attributes}
72
+ className={clsx('tabs__item', styles.tabItem, attributes?.className, {
73
+ 'tabs__item--active': selectedValue === value,
74
+ })}>
75
+ {label ?? value}
76
+ </li>
77
+ ))}
78
+ </ul>
79
+ );
80
+ }
81
+ function TabContent({lazy, children, selectedValue}) {
82
+ // eslint-disable-next-line no-param-reassign
83
+ children = Array.isArray(children) ? children : [children];
84
+ if (lazy) {
85
+ const selectedTabItem = children.find(
86
+ (tabItem) => tabItem.props.value === selectedValue,
87
+ );
88
+ if (!selectedTabItem) {
89
+ // fail-safe or fail-fast? not sure what's best here
90
+ return null;
91
+ }
92
+ return cloneElement(selectedTabItem, {className: 'margin-top--md'});
93
+ }
94
+ return (
95
+ <div className="margin-top--md">
96
+ {children.map((tabItem, i) =>
97
+ cloneElement(tabItem, {
98
+ key: i,
99
+ hidden: tabItem.props.value !== selectedValue,
100
+ }),
175
101
  )}
176
102
  </div>
177
103
  );
178
104
  }
105
+ function TabsComponent(props) {
106
+ const tabs = useTabs(props);
107
+ return (
108
+ <div className={clsx('tabs-container', styles.tabList)}>
109
+ <TabList {...props} {...tabs} />
110
+ <TabContent {...props} {...tabs} />
111
+ </div>
112
+ );
113
+ }
179
114
  export default function Tabs(props) {
180
115
  const isBrowser = useIsBrowser();
181
116
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,18 +20,18 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "2.2.0",
24
- "@docusaurus/mdx-loader": "2.2.0",
25
- "@docusaurus/module-type-aliases": "2.2.0",
26
- "@docusaurus/plugin-content-blog": "2.2.0",
27
- "@docusaurus/plugin-content-docs": "2.2.0",
28
- "@docusaurus/plugin-content-pages": "2.2.0",
29
- "@docusaurus/theme-common": "2.2.0",
30
- "@docusaurus/theme-translations": "2.2.0",
31
- "@docusaurus/types": "2.2.0",
32
- "@docusaurus/utils": "2.2.0",
33
- "@docusaurus/utils-common": "2.2.0",
34
- "@docusaurus/utils-validation": "2.2.0",
23
+ "@docusaurus/core": "2.3.1",
24
+ "@docusaurus/mdx-loader": "2.3.1",
25
+ "@docusaurus/module-type-aliases": "2.3.1",
26
+ "@docusaurus/plugin-content-blog": "2.3.1",
27
+ "@docusaurus/plugin-content-docs": "2.3.1",
28
+ "@docusaurus/plugin-content-pages": "2.3.1",
29
+ "@docusaurus/theme-common": "2.3.1",
30
+ "@docusaurus/theme-translations": "2.3.1",
31
+ "@docusaurus/types": "2.3.1",
32
+ "@docusaurus/utils": "2.3.1",
33
+ "@docusaurus/utils-common": "2.3.1",
34
+ "@docusaurus/utils-validation": "2.3.1",
35
35
  "@mdx-js/react": "^1.6.22",
36
36
  "clsx": "^1.2.1",
37
37
  "copy-text-to-clipboard": "^3.0.1",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=16.14"
64
64
  },
65
- "gitHead": "a308fb7c81832cca354192fe2984f52749441249"
65
+ "gitHead": "cf12f21a10f6c5439ff931e61419c4bb03a5a2dc"
66
66
  }